From 9c174cdd53429e570514b9044250bfa209133649 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 6 May 2025 17:04:23 +0200 Subject: [PATCH] game: Added new unit placement state --- src/mem.s | 10 ++++++++-- src/player.s | 5 ++++- src/state.s | 2 ++ src/update.s | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/mem.s b/src/mem.s index 64d93ee..ab644d4 100644 --- a/src/mem.s +++ b/src/mem.s @@ -14,13 +14,19 @@ mem_init: call memcpy ; set up game mode - call game_init + call unit_placement_init call mbc1_init ret +unit_placement_init: + ld de, st_update_unit_placement + ld hl, game_mode + ld bc, st_size + jp memcpy + game_init: - ld de, st_update_game + ld de, st_update_game ld hl, game_mode ld bc, st_size jp memcpy diff --git a/src/player.s b/src/player.s index bec7b87..c790126 100644 --- a/src/player.s +++ b/src/player.s @@ -63,7 +63,10 @@ player_draw_cursor: handle_inputs: input_held BTNA jr z, @not_a REL - + ; TODO: remove demo actor load + ; and load real units + call map_load_demo_actors + call game_init @not_a: ; movement keys with cooldown diff --git a/src/state.s b/src/state.s index 15d6743..fef5c98 100644 --- a/src/state.s +++ b/src/state.s @@ -90,6 +90,8 @@ st_cursor_delay: st_update_game: st_def 0x00, update_game, st_update_game +st_update_unit_placement: + st_def 0x00, update_unit_placement, st_update_unit_placement st_update_pause: st_def 0x00, update_pause, st_update_pause st_update_game_over: diff --git a/src/update.s b/src/update.s index e078d9a..170c2b5 100644 --- a/src/update.s +++ b/src/update.s @@ -6,6 +6,16 @@ update_game: call rand call rand_save_srand + ld hl, p0_units + call units_update + ld hl, p1_units + call units_update + + ldnull bc + ret + +update_unit_placement: + ld de, actor_player call st_update -- 2.30.2