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:
actor_update_table:
dw actor_update_null
dw actor_update_bat
- dw actor_update_rock
actor_update_null:
actor_check_who
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
; 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