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
dw anim_walk_south
dw anim_walk_east
dw anim_walk_west
+ dw sm_bat_pick_direction
sm_nop:
ret
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]