Add manual cartridge saving and a right-side menu
This commit is contained in:
17 files changed
+449
-63
No files matched your search
+33
-10
@@ -12,8 +12,17 @@ void check_partner_selection(void)
|
||||
caught_count = CAUGHT_CAPACITY;
|
||||
for (int i = 0; i < CAUGHT_CAPACITY; ++i) caught_species[i] = (unsigned char)i;
|
||||
assert(!choose_partner(-1) && !choose_partner(6));
|
||||
save_from_menu();
|
||||
for (int member = 0; member <= caught_count; ++member) {
|
||||
unsigned char previous[sizeof(test_save)];
|
||||
memcpy(previous, test_save, sizeof(previous));
|
||||
int previous_member = active_member;
|
||||
assert(choose_partner(member));
|
||||
assert(memcmp(previous, test_save, sizeof(previous)) == 0);
|
||||
load_progress();
|
||||
assert(active_member == previous_member);
|
||||
assert(choose_partner(member));
|
||||
save_from_menu();
|
||||
load_progress();
|
||||
assert(active_member == member && rod_owned && ball_count == 5);
|
||||
assert(strcmp(partner_name(), member ? species[member - 1].name : "SPROUT") == 0);
|
||||
@@ -84,11 +93,16 @@ void check_fishing(void)
|
||||
assert(begin_conversation(FISHER_X - 14, FISHER_Y));
|
||||
assert(!rod_owned);
|
||||
assert(advance_conversation(0) == 1 && rod_owned);
|
||||
assert(test_save[4] == 5);
|
||||
for (int i = 0; i < (int)sizeof(test_save); ++i) assert(test_save[i] == 0xff);
|
||||
dialogue_box(1);
|
||||
write_preview("build/rod-gift-preview.ppm");
|
||||
assert(advance_conversation(1) == -1);
|
||||
load_progress();
|
||||
assert(!rod_owned);
|
||||
assert(begin_conversation(FISHER_X - 14, FISHER_Y));
|
||||
assert(advance_conversation(0) == 1 && advance_conversation(1) == -1);
|
||||
save_from_menu();
|
||||
load_progress();
|
||||
assert(rod_owned && !partner_owned);
|
||||
assert(!cast_rod(x, y));
|
||||
assert(begin_conversation(FISHER_X, FISHER_Y));
|
||||
@@ -114,7 +128,9 @@ void check_fishing(void)
|
||||
battle.enemy_hp = 1;
|
||||
assert(battle_input(SELECT) && battle.phase == BATTLE_CAUGHT);
|
||||
assert(ball_count == 4 && has_caught(TIDEFIN));
|
||||
assert(memcmp(before, test_save, sizeof(before)) == 0);
|
||||
assert(battle_input(A));
|
||||
save_from_menu();
|
||||
load_progress();
|
||||
assert(rod_owned && has_caught(TIDEFIN) && ball_count == 4);
|
||||
draw_team_member(1);
|
||||
@@ -160,7 +176,7 @@ void check_catching(void)
|
||||
assert(battle_input(SELECT));
|
||||
assert(ball_count == 4 && caught_count == 0 && battle.turns == 1);
|
||||
assert(battle.notice == NOTICE_BROKE_FREE && battle.sprout_hp == 20);
|
||||
assert(test_save[4] == 5 && test_save[6] == 4);
|
||||
assert(memcmp(before, test_save, sizeof(before)) == 0);
|
||||
assert(!battle_input(0) && ball_count == 4); /* Holding Select cannot throw twice. */
|
||||
draw_battle_hud();
|
||||
assert(pending_pixels() < 16500);
|
||||
@@ -168,7 +184,7 @@ void check_catching(void)
|
||||
assert(memcmp(visible, SCREEN, sizeof(visible)) == 0);
|
||||
write_preview("build/catch-failed-preview.ppm");
|
||||
load_progress();
|
||||
assert(partner_owned && ball_count == 4 && caught_count == 0);
|
||||
assert(partner_owned && ball_count == 5 && caught_count == 0);
|
||||
|
||||
assert(battle_input(RIGHT));
|
||||
assert(battle_input(A) && battle.enemy_hp == 11);
|
||||
@@ -178,7 +194,7 @@ void check_catching(void)
|
||||
copy_pending_rows(visible);
|
||||
assert(battle_input(SELECT)); /* Quarter health is a guaranteed catch. */
|
||||
assert(battle.phase == BATTLE_CAUGHT && battle.sprout_hp == hp);
|
||||
assert(ball_count == 3 && caught_count == 1 && caught_species[0] == FERNFOX);
|
||||
assert(ball_count == 4 && caught_count == 1 && caught_species[0] == FERNFOX);
|
||||
assert(has_caught(FERNFOX) && !has_caught(GOLDEN));
|
||||
draw_battle_hud();
|
||||
assert(pending_pixels() < 16500);
|
||||
@@ -188,10 +204,12 @@ void check_catching(void)
|
||||
draw_battle();
|
||||
assert(memcmp(expected, SCREEN, sizeof(expected)) == 0);
|
||||
write_preview("build/caught-preview.ppm");
|
||||
assert(!battle_input(SELECT) && ball_count == 3 && caught_count == 1);
|
||||
load_progress();
|
||||
assert(ball_count == 3 && caught_count == 1 && caught_species[0] == FERNFOX);
|
||||
assert(!battle_input(SELECT) && ball_count == 4 && caught_count == 1);
|
||||
assert(memcmp(before, test_save, sizeof(before)) == 0);
|
||||
assert(battle_input(A) && battle.phase == BATTLE_OFF);
|
||||
save_from_menu();
|
||||
load_progress();
|
||||
assert(ball_count == 4 && caught_count == 1 && caught_species[0] == FERNFOX);
|
||||
draw_team_member(1);
|
||||
write_preview("build/caught-team-preview.ppm");
|
||||
|
||||
@@ -200,13 +218,14 @@ void check_catching(void)
|
||||
assert(begin_battle(182, 113));
|
||||
battle.enemy_hp = 1;
|
||||
assert(battle_input(SELECT) && battle.phase == BATTLE_CAUGHT);
|
||||
assert(ball_count == 2 && caught_count == 2 && caught_species[1] == GOLDEN);
|
||||
assert(ball_count == 3 && caught_count == 2 && caught_species[1] == GOLDEN);
|
||||
assert(!near_golden(182, 113));
|
||||
assert(battle_input(A));
|
||||
assert(!begin_battle(182, 113));
|
||||
reset_follower(108, 103);
|
||||
render_scene(108, 103);
|
||||
assert(SCREEN[95 * WIDTH + 181] == scenery(181, 95));
|
||||
save_from_menu();
|
||||
load_progress();
|
||||
assert(has_caught(GOLDEN) && !near_golden(182, 113));
|
||||
|
||||
@@ -221,6 +240,7 @@ void check_catching(void)
|
||||
assert(battle_input(A));
|
||||
}
|
||||
assert(caught_count == CAUGHT_CAPACITY && ball_count == 2);
|
||||
save_from_menu();
|
||||
memcpy(before, test_save, sizeof(before));
|
||||
assert(start_battle(FERNFOX));
|
||||
rng = random_state;
|
||||
@@ -259,17 +279,20 @@ void check_catching(void)
|
||||
load_progress();
|
||||
assert(!partner_owned && caught_count == 0); /* No captured team without Sprout. */
|
||||
|
||||
/* A failed attempt can end a battle, and the used ball still stays spent. */
|
||||
/* Loss does not autosave a spent ball: reload restores the last menu save. */
|
||||
memset(test_save, 0xff, sizeof(test_save));
|
||||
load_progress();
|
||||
partner_owned = balls_given = 1;
|
||||
ball_count = 1;
|
||||
save_from_menu();
|
||||
memcpy(before, test_save, sizeof(before));
|
||||
assert(start_battle(EMBERWING));
|
||||
battle.sprout_hp = 1;
|
||||
random_state = 1;
|
||||
assert(battle_input(SELECT) && battle.phase == BATTLE_LOST && ball_count == 0);
|
||||
assert(memcmp(before, test_save, sizeof(before)) == 0);
|
||||
load_progress();
|
||||
assert(partner_owned && balls_given && ball_count == 0 && caught_count == 0);
|
||||
assert(partner_owned && balls_given && ball_count == 1 && caught_count == 0);
|
||||
assert(battle_input(A));
|
||||
ball_count = 1;
|
||||
assert(start_battle(PEBBLIT));
|
||||
|
||||
Reference in new issue
Block a user