Split game code and tests into focused modules
This commit is contained in:
20 files changed
+2611
-2431
No files matched your search
@@ -0,0 +1,69 @@
|
||||
#include "game.h"
|
||||
|
||||
void status(const char *message)
|
||||
{
|
||||
rectangle(0, 0, WIDTH, 18, RGB(29, 30, 25));
|
||||
rectangle(0, 16, WIDTH, 2, RGB(10, 18, 14));
|
||||
text(8, 6, message, RGB(5, 9, 11));
|
||||
}
|
||||
|
||||
void location_status(int x, int y)
|
||||
{
|
||||
if (near_map_exit(x, y)) {
|
||||
if (current_room == MELLON_GARDEN) status("WALK LEFT TO GREENLEAF VILLAGE");
|
||||
else if (current_room == ROUTE) status("WALK UP TO GREENLEAF VILLAGE");
|
||||
else status(x >= 216 ? "WALK RIGHT TO PROFESSOR MELLON" : "WALK DOWN TO SUNPETAL TRAIL");
|
||||
}
|
||||
else if (near_route_sign(x, y)) status("A READ SIGN");
|
||||
else if (current_room == ROUTE && near_npc(x, y)) status("A TALK TO RANGER FINN");
|
||||
else if (current_room == ROUTE) status("SUNPETAL TRAIL");
|
||||
else if (near_door(x, y)) status(indoors() ? "A GO OUTSIDE" : "A OPEN DOOR");
|
||||
else if (current_room == MELLON_GARDEN) status("PROFESSOR MELLONS GARDEN");
|
||||
else if (current_room == MELLON_HOUSE) status("PROFESSOR MELLONS HOUSE");
|
||||
else if (partner_owned && near_golden(x, y) && !near_npc(x, y)) status("A BATTLE THE GOLDEN CREATURE");
|
||||
else status(current_room == COTTAGE ? "INSIDE THE COTTAGE" : "GREENLEAF VILLAGE");
|
||||
}
|
||||
|
||||
void draw_scene(int x, int y)
|
||||
{
|
||||
restore(0, 0, WIDTH, HEIGHT);
|
||||
location_status(x, y);
|
||||
text(8, 148, "ARROWS MOVE A USE SELECT TEAM START RESET", RGB(5, 9, 11));
|
||||
actors(x, y, 0);
|
||||
}
|
||||
|
||||
void draw_team(void)
|
||||
{
|
||||
u16 ink = RGB(5, 8, 11), cream = RGB(30, 30, 26);
|
||||
rectangle(0, 0, WIDTH, HEIGHT, RGB(15, 24, 20));
|
||||
status("YOUR TEAM");
|
||||
rectangle(8, 25, 224, 112, ink);
|
||||
rectangle(10, 27, 220, 108, cream);
|
||||
if (partner_owned) {
|
||||
draw_sprout(50, 105, 3);
|
||||
large_text(94, 42, "SPROUT", ink);
|
||||
large_text(94, 58, "GRASS TYPE", RGB(7, 17, 11));
|
||||
large_text(94, 73, "LEVEL FIVE", ink);
|
||||
text(94, 89, "HEALTH FULL", ink);
|
||||
rectangle(94, 99, 106, 6, RGB(7, 14, 11));
|
||||
rectangle(95, 100, 104, 4, RGB(10, 25, 12));
|
||||
} else {
|
||||
large_text(28, 57, "NO PARTNER YET", ink);
|
||||
large_text(28, 76, "VISIT PROFESSOR MELLON", ink);
|
||||
text(28, 96, "HIS HOUSE IS EAST OF GREENLEAF VILLAGE", ink);
|
||||
}
|
||||
/* A small bag summary is visible even before you receive Sprout. */
|
||||
rectangle(24, 118, 8, 8, ink);
|
||||
rectangle(25, 119, 6, 3, RGB(29, 8, 9));
|
||||
rectangle(25, 122, 6, 3, RGB(31, 31, 28));
|
||||
rectangle(27, 121, 2, 2, ink);
|
||||
text(38, 119, "POKE BALLS", ink);
|
||||
char count_text[3];
|
||||
int count_index = 0;
|
||||
if (ball_count >= 10) count_text[count_index++] = (char)('0' + ball_count / 10);
|
||||
count_text[count_index++] = (char)('0' + ball_count % 10);
|
||||
count_text[count_index] = 0;
|
||||
text(88, 119, count_text, ink);
|
||||
rectangle(0, 142, WIDTH, 18, cream);
|
||||
text(8, 148, "SELECT OR A OR B TO RETURN", ink);
|
||||
}
|
||||
Reference in new issue
Block a user