From: Lukas Krickl Date: Sun, 23 Feb 2025 06:26:43 +0000 (+0100) Subject: actor: Renamed player_go to actor_go states X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=f29c8b2d9e59b6668952151925884417650bceff;p=gbrg%2F.git actor: Renamed player_go to actor_go states --- diff --git a/src/defs.s b/src/defs.s index a5e1194..5c2a9c2 100644 --- a/src/defs.s +++ b/src/defs.s @@ -208,7 +208,7 @@ .se 1 .de smt_end_turn, 1 .de smt_player_poll_inputs, 1 -.de smt_player_go_north, 1 -.de smt_player_go_south, 1 -.de smt_player_go_east, 1 -.de smt_player_go_west, 1 +.de smt_actor_go_north, 1 +.de smt_actor_go_south, 1 +.de smt_actor_go_east, 1 +.de smt_actor_go_west, 1 diff --git a/src/macros.inc b/src/macros.inc index 2682689..fcc79db 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -98,10 +98,14 @@ @noassert #endmacro + ; loads the state machine ptr ; into $1 ; inptuts: ; $1: register (hl, de, bc) #macro sm_load_ptr + ; TODO: take into account offset for each + ; actor by adding who*sm_size to hl + ; => also need to reserve wram for this purpose ld $1, state_machine #endmacro diff --git a/src/state.s b/src/state.s index dabc908..059e54a 100644 --- a/src/state.s +++ b/src/state.s @@ -43,7 +43,7 @@ sm_player_poll_inputs: jr z, @notdown REL ; set animation params - ld a, smt_player_go_south + ld a, smt_actor_go_south ld [hl+], a ; set next state ld a, ANIM_PLAYER_WALK_FRAMES ld [hl], a ; set param[0] @@ -60,7 +60,7 @@ sm_player_poll_inputs: jr z, @notup REL ; set animation params - ld a, smt_player_go_north + ld a, smt_actor_go_north ld [hl+], a ; set next state ld a, ANIM_PLAYER_WALK_FRAMES ld [hl], a ; set param[0] @@ -78,7 +78,7 @@ sm_player_poll_inputs: jr z, @notleft REL ; set animation params - ld a, smt_player_go_west + ld a, smt_actor_go_west ld [hl+], a ; set next state ld a, ANIM_PLAYER_WALK_FRAMES ld [hl], a ; set param[0] @@ -95,7 +95,7 @@ sm_player_poll_inputs: jr z, @notright REL ; set animation params - ld a, smt_player_go_east + ld a, smt_actor_go_east ld [hl+], a ; set next state ld a, ANIM_PLAYER_WALK_FRAMES ld [hl], a ; set param[0] @@ -116,6 +116,9 @@ sm_player_poll_inputs: ; after verifying collision ; otherwise -> end turn sm_bat_pick_direction: + ; hl = sm ptr + sm_load_ptr hl + push bc ; move bat in random direction call rand