.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
@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
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]
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]
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]
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]
; 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