actor: removed bat update code
authorLukas Krickl <lukas@krickl.dev>
Sun, 23 Feb 2025 13:56:56 +0000 (14:56 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 23 Feb 2025 13:56:56 +0000 (14:56 +0100)
This is now replaced with a never ending state machine update.

src/actor.s
src/defs.s
src/state.s

index ccfda643c7483209e6e9ff0e2f56086f4b63f615..fc948804fd928f5baec8a0fe57d7fed8e54bc93e 100644 (file)
@@ -272,49 +272,14 @@ actor_update_bat:
   actor_check_who
   jr nz, @skip REL
 
-  ld a, [end_turn]
-  cp a, 0
-  jr z, @no_anim REL
-
-  ; transfer bc into hl
-  ld a, b
-  ld h, a
-  ld a, c
-  ld l, a
-  inc hl ; hl = y/x ptr
+  ; call state update
+  ld a, smt_player_poll_inputs
+  ; load initial state if required
+  call sm_load_initial_state
+  
   push bc
-  call anim_move
+  call sm_call_state
   pop bc
-  cp a, 0 ; is animation done?
-  jr nz, @skip REL
-  ; play animation at end of turn
-  call who_next
-  call anim_clear
-  jr @skip REL ; darw update 
-@no_anim:
-  ; set up movement 
-  call actor_ld_anim_target
-
-  ; 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
-  cp a, SOUTH
-  call z, actor_down
-  cp a, WEST
-  call z, actor_left
-  cp a, EAST
-  call z, actor_right
-
-  ; check anim collision
-  call actor_anim_verify
-  ; set flags on z
-  call z, actor_tile_update_rf_flags
-
-  turn_finish
 
 @skip:
   ; load tile to use into tmp
index 5c2a9c24efdc1ae34189292495e422c835759ad7..96ab9e7a01c97b179a7dc6c6242feac2980cfc37 100644 (file)
 .de smt_actor_go_south, 1
 .de smt_actor_go_east, 1
 .de smt_actor_go_west, 1
+.de smt_bat_pick_direction, 1
index 15f85c8607a98d30b5806a6bd91bc9652ca86ad4..64be0cc64f8423f3e1d7f15600d05b7202ac1b57 100644 (file)
@@ -14,6 +14,7 @@ state_table:
   dw anim_walk_south
   dw anim_walk_east
   dw anim_walk_west
+  dw sm_bat_pick_direction
 
 sm_nop:
   ret
@@ -199,7 +200,8 @@ sm_load_initial_state:
   pop hl
   ret
 
-  ; calls the current state machine state 
+  ; calls the current state machine state
+  ; depends on sm_load_ptr
 sm_call_state:
   sm_load_ptr hl
   ld a, [hl]