actors rework: cleanup
authorLukas Krickl <lukas@krickl.dev>
Fri, 21 Feb 2025 17:19:06 +0000 (18:19 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 21 Feb 2025 17:19:06 +0000 (18:19 +0100)
src/actor.s
src/defs.s
src/state.s

index 29357d65a6127a748871e5fc3f69141532366ee1..300733cde4447a914b4b8e01edf8d406b0a0b5a5 100644 (file)
@@ -172,15 +172,6 @@ actor_anim_verify:
   call anim_clear
   pop af
   ret
-
-  ; truncates the position 
-  ; to only use the high nibble
-  ; inputs:
-  ;   hl: ptr to y/x
-  ; returns:
-  ;   hl: trunacted y/x
-anim_truncate_pos:
-  ret
   
   ; macro version of actor_tile_update_rf_flag
   ; inputs:
@@ -266,7 +257,6 @@ actor_tile_update_rf_flags:
 actor_update_table:
   dw actor_update_null
   dw actor_update_bat
-  dw actor_update_rock
 
 actor_update_null:
   actor_check_who
@@ -373,39 +363,6 @@ actor_update_bat:
 
   ret
 
-  ; rock actor
-actor_update_rock:
-  actor_check_who 
-  jr nz, @skip REL
-  
-  actor_end_turn
-
-@skip:
-
-  ; load oam ptr 
-  ld a, [actor_soam_ptr]
-  ld h, a
-  ld a, [actor_soam_ptr+1]
-  ld l, a
-  
-  inc bc ; bc = actor_y 
-
-  ld a, [bc] ; a = y
-  ld [hl+], a ; set y
-  inc bc
-
-  ld a, [bc] ; a = x
-  ld [hl+], a ; set x
-
-  ld a, PLAYER_TILE_IDLE1
-  ld [hl+], a
-  
-  xor a, a
-  ld [hl+], a
-  
-  actor_store_soam_ptr
-
-  ret
 
   ; updates all active actors from 
   ; the current actor table
index c94acac45222864502ba694abda6491619efd8b2..a5e119487719f8db0f4f09d699724d2a4be5f3c6 100644 (file)
@@ -64,7 +64,6 @@
   ; null actor type = nop
 .de ACTOR_TYPE_NULL, 1
 .de ACTOR_TYPE_BAT, 1
-.de ACTOR_TYPE_ROCK, 1 
 
 
 ; struct actor 
index b0f0a30bd6b49c0a6d1ede827a302f2b10314b0c..dabc90853ca2dc1134e09b29f09d58fcdcab1252 100644 (file)
@@ -116,24 +116,38 @@ sm_player_poll_inputs:
   ; after verifying collision
   ; otherwise -> end turn
 sm_bat_pick_direction:
+  push bc
   ; move bat in random direction
   call rand
   and a, 0b11 ; rnadom direction 0-3
   
   ; call correct movement setup
   cp a, NORTH
-  call z, actor_up
+  jr nz, @not_north REL
+
+@not_north:
+
   cp a, SOUTH
-  call z, actor_down
+  jr nz, @not_south REL
+
+@not_south:
+
   cp a, WEST
-  call z, actor_left
+  jr nz, @not_west REL
+
+@not_west:
+
   cp a, EAST
-  call z, actor_right
+  jr nz, @not_east REL
+
+@not_east:
 
   ; verify collision
-  
+
   ; transition
 
+  pop bc
+
   ret
 
   ; loads initial state if