/* Test game rules on the Mac without touching GBA screen registers. */ #include #include #define main gba_main #include "../source/main.c" #undef main int main(void) { assert(can_walk(108, 103)); assert(!can_walk(30, 60)); /* Pond. */ assert(!can_walk(175, 60)); /* House. */ assert(!can_walk(0, 100)); /* Map edge. */ assert(!can_walk(NPC_X, NPC_Y)); assert(!can_walk(NPC_X - 12, NPC_Y)); assert(!can_walk(NPC_X, NPC_Y + 8)); assert(can_walk(NPC_X - 13, NPC_Y)); assert(can_walk(NPC_X + 13, NPC_Y)); assert(can_walk(NPC_X, NPC_Y + 9)); assert(can_walk(NPC_X, NPC_Y - 9)); assert(!near_npc(108, 103)); assert(near_npc(NPC_X - 13, NPC_Y)); assert(near_npc(NPC_X + 13, NPC_Y)); assert(near_npc(NPC_X, NPC_Y + 9)); assert(near_npc(NPC_X, NPC_Y - 9)); assert(near_npc(NPC_X - 24, NPC_Y - 20)); assert(!near_npc(NPC_X - 25, NPC_Y)); assert(!near_npc(NPC_X, NPC_Y + 21)); assert(!near_npc(182, 103)); /* The creature does not trigger Mila. */ assert(DIALOGUE_PAGES == 2); assert(next_dialogue_page(0) == 1); assert(next_dialogue_page(1) == -1); for (int page = 0; page < DIALOGUE_PAGES; ++page) { for (int line = 0; line < 2; ++line) { int length = 0; for (const char *p = dialogue[page][line]; *p; ++p) { assert(*p == ' ' || (*p >= 'A' && *p <= 'Z')); ++length; } assert(length <= 52); /* Text stays inside its box. */ } } puts("NPC collision, talk distance, dialogue pages, and text checks passed"); return 0; }