actor: Renamed player_go to actor_go states
authorLukas Krickl <lukas@krickl.dev>
Sun, 23 Feb 2025 06:26:43 +0000 (07:26 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 23 Feb 2025 06:26:43 +0000 (07:26 +0100)
src/defs.s
src/macros.inc
src/state.s

index a5e119487719f8db0f4f09d699724d2a4be5f3c6..5c2a9c24efdc1ae34189292495e422c835759ad7 100644 (file)
 .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
index 26826894d94172222c958d2fbfc82907c6e229be..fcc79db72879b7944dc73b88f7c25ce6c62b5399 100644 (file)
 @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 
index dabc90853ca2dc1134e09b29f09d58fcdcab1252..059e54a7a3ccce07843e7f06a19743607f69932d 100644 (file)
@@ -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