Add music, beach fishing, catching, and selectable creature partners

This commit is contained in:
rory committed 2026-10-28 22:22:27 +00:00
1 parent 3469f2e6dd
commit cb77683a87
24 files changed
+1307 -104

No files matched your search

+37 -3
View File
@@ -1,5 +1,6 @@
/* Our first GBA game. No downloaded game art or existing ROM is used. */
#include "game.h"
#include "audio.h"
#ifndef GAME_TEST
#define DISPLAY (*(volatile u16 *)0x04000000)
@@ -66,8 +67,10 @@ int main(void)
int x = 108, y = 103, frame = 0, greeting = 0;
int dialogue_page = -1; /* -1 means we are not talking. */
int team_open = 0;
int team_member = 0;
unsigned previous = 0;
start_movement_timer();
music_init(movement_time());
load_progress();
reset_follower(x, y);
reset_dirty_rows();
@@ -81,6 +84,8 @@ int main(void)
unsigned pressed = keys & ~previous;
previous = keys;
unsigned now = movement_time();
music_update(now);
if (pressed & R_BUTTON) music_toggle_mute();
int movement_ticks = 0;
if (team_open || battle.phase != BATTLE_OFF || dialogue_page >= 0)
pause_movement_at(now);
@@ -88,7 +93,16 @@ int main(void)
movement_ticks = movement_ticks_at(now);
random_state += 0x9e3779b9u; /* Mix in how long the player waits. */
if (team_open) {
if (pressed & (SELECT | A | B)) {
if (partner_owned && (pressed & (LEFT | RIGHT))) {
int members = caught_count + 1;
team_member = (team_member + ((pressed & RIGHT) ? 1 : members - 1)) % members;
DISPLAY = 0x0080;
draw_team_member(team_member);
present_frame();
DISPLAY = 0x0403;
pause_movement_at(movement_time());
} else if (pressed & (SELECT | A | B)) {
if ((pressed & A) && choose_partner(team_member)) reset_follower(x, y);
team_open = 0;
DISPLAY = 0x0080;
draw_scene(x, y);
@@ -106,7 +120,7 @@ int main(void)
greeting = 180;
DISPLAY = 0x0080;
draw_scene(x, y);
status("SPROUT RESTED AND IS READY AGAIN");
status("YOUR PARTNER RESTED AND IS READY AGAIN");
present_frame();
DISPLAY = 0x0403;
pause_movement_at(movement_time());
@@ -143,6 +157,7 @@ int main(void)
}
if (pressed & SELECT) {
team_open = 1;
team_member = 0;
DISPLAY = 0x0080;
draw_team();
present_frame();
@@ -192,7 +207,10 @@ int main(void)
restore(170, 54, 15, 24);
actors(x, y, 0);
present_frame();
for (int tick = 0; tick < 12; ++tick) wait_for_frame();
for (int tick = 0; tick < 12; ++tick) {
wait_for_frame();
music_update(movement_time());
}
}
use_door(&x, &y);
greeting = 0;
@@ -207,6 +225,7 @@ int main(void)
dialogue_page = 0;
greeting = 0;
status(current_room == ROUTE ? "TALKING TO RANGER FINN" :
current_room == BEACH ? "TALKING TO FISHER CORAL" :
current_room == MELLON_HOUSE ? "TALKING TO PROFESSOR MELLON" : "TALKING TO MILA");
} else if (current_room == ROUTE) {
status(near_route_sign(x, y) ? "GREENLEAF VILLAGE IS TO THE NORTH" :
@@ -218,6 +237,20 @@ int main(void)
} else if (current_room == MELLON_GARDEN) {
status("PROFESSOR MELLON IS INSIDE THE HOUSE");
greeting = 180;
} else if (current_room == BEACH) {
if (cast_rod(x, y)) {
greeting = 0;
DISPLAY = 0x0080;
draw_battle();
present_frame();
DISPLAY = 0x0403;
pause_movement_at(movement_time());
continue;
}
status(!rod_owned ? "TALK TO FISHER CORAL FOR A POKE ROD" :
!partner_owned ? "GET SPROUT FROM PROFESSOR MELLON FIRST" :
"FACE DOWN AT THE WATER AND PRESS A");
greeting = 180;
} else if (begin_battle(x, y)) {
greeting = 0;
DISPLAY = 0x0080;
@@ -248,6 +281,7 @@ int main(void)
near_map_exit(old_x, old_y) != near_map_exit(x, y) ||
near_route_sign(old_x, old_y) != near_route_sign(x, y) ||
near_npc(old_x, old_y) != near_npc(x, y) ||
near_water(old_x, old_y) != near_water(x, y) ||
near_golden(old_x, old_y) != near_golden(x, y)))
location_status(x, y);
}