From ee5de03138863c0ad113a3b60582347633b0596e Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 25 Nov 2024 10:12:39 +0100 Subject: [PATCH] WIP: actor table update --- src/actor.s | 22 ++++++++++------------ src/macros.inc | 6 ++++++ src/player.s | 8 ++++---- src/wram.s | 2 +- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/actor.s b/src/actor.s index 7157158..d36fef8 100644 --- a/src/actor.s +++ b/src/actor.s @@ -17,10 +17,11 @@ ; skips a turn by calling turn_finish ; and who_next #macro actor_skip_turn - call turn_finish + turn_finish call who_next #endmacro + ; stores hl back into soam ptr #macro actor_store_soam_ptr ; store soam ptr again @@ -41,11 +42,11 @@ actor_update_table: actor_update_null: actor_check_who - jr nz, @skip REL + ret nz - actor_skip_turn -@skip: - ret + ; actor_skip_turn + turn_finish + jp who_next ; bat actor actor_update_bat: @@ -155,8 +156,10 @@ actors_update: ld [act], a ld hl, actor_update_table - ld a, [bc] - call call_tbl + ld a, [bc] + cp a, 0 + call nz, call_tbl + call z, actor_update_null pop bc pop de @@ -220,11 +223,6 @@ anim_move: ret - ; sets turn to end -turn_finish: - ld a, 1 - ld [end_turn], a - ret ; advance to the next actor if end_turn != 0 ; effectively ending the current actor's turn diff --git a/src/macros.inc b/src/macros.inc index 7275e50..e2ac287 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -49,4 +49,10 @@ #macro dwb .db ($1 >> 8) & 0xFF .db $1 & 0xFF +#endmacro + + ; sets turn to end +#macro turn_finish + ld a, 1 + ld [end_turn], a #endmacro diff --git a/src/player.s b/src/player.s index dce99ca..9fb75ee 100644 --- a/src/player.s +++ b/src/player.s @@ -121,7 +121,7 @@ player_update: ld [tmp], a call play_noise - call turn_finish + turn_finish @notdown: input_held BTNUP @@ -139,7 +139,7 @@ player_update: ld [tmp], a call play_noise - call turn_finish + turn_finish @notup: @@ -160,7 +160,7 @@ player_update: ld [tmp+1], a call play_noise - call turn_finish + turn_finish @notleft: input_held BTNRIGHT @@ -180,7 +180,7 @@ player_update: ld [tmp+1], a call play_noise - call turn_finish + turn_finish @notright: @action_buttons: diff --git a/src/wram.s b/src/wram.s index 58b8a32..5e30e8d 100644 --- a/src/wram.s +++ b/src/wram.s @@ -9,7 +9,7 @@ shadow_oam: .adv OBJSMAX * oamsize frame_ready: .adv 1 frame_count: .adv 1 -#define ACTORS_MAX 16 +#define ACTORS_MAX 8 ; current frame's inputs curr_inputs: .adv 1 -- 2.30.2