ld a, [anim_target_x]
sub a, ANIM_MOVE_TILE_SIZE / 2 ; -8 to be in center
ld e, a
- ld a, RF_WALL | RF_DOOR | RF_ACTOR
+ ld a, RF_WALL | RF_DOOR | RF_ACTOR | RF_PLAYER
call room_get_flag_masked
pop bc
; hl: trunacted y/x
anim_truncate_pos:
ret
-
- ; same as actor_tile_update_rf_flags
- ; but decs hl before calling and
- ; increments again after
-player_tile_update_rf_flags:
- dec hl
- call actor_tile_update_rf_flags
- inc hl
- ret
-
- ; marks the current actor's tile
- ; as occupied by an actor
- ; also removes the flag from the actor's current tile
- ; this only works for the default case of
- ; an acotr needing a single tile.
+
+ ; macro version of actor_tile_update_rf_flag
; inputs:
- ; bc: (actor ptr) original y/x position ptr
+ ; $1: RF FLAG to set / unset
+ ; bc: original y/x position ptr
; anim_target_y/x: target position
; returns:
- ; sets the RF_ACTOR flag at target_y/x
- ; unsets RF_ACTOR at [bc] and [bc+1]
+ ; sets the $1 flag at target_y/x
+ ; unsets $1 at [bc] and [bc+1]
; preserves registers
-actor_tile_update_rf_flags:
- push_all
-
- inc bc ; bc = y pos
-
+#macro update_rf_flag
; first unset existing flags
; sub 8 to positions to center on tile
; unset flag
ld a, [hl]
- and a, 0xFF ^ RF_ACTOR
+ and a, 0xFF ^ $1
ld [hl], a
; set flag
ld a, [hl]
- or a, RF_ACTOR
+ or a, $1
ld [hl], a
@skip:
+#endmacro
+
+ ; same as actor_tile_update_rf_flags
+ ; but decs hl before calling and
+ ; increments again after
+player_tile_update_rf_flags:
+ push_all
+ update_rf_flag RF_PLAYER
+ pop_all
+ ret
+
+ ; marks the current actor's tile
+ ; as occupied by an actor
+ ; also removes the flag from the actor's current tile
+ ; this only works for the default case of
+ ; an acotr needing a single tile.
+ ; inputs:
+ ; bc: (actor ptr) original y/x position ptr
+ ; anim_target_y/x: target position
+ ; returns:
+ ; sets the RF_ACTOR flag at target_y/x
+ ; unsets RF_ACTOR at [bc] and [bc+1]
+ ; preserves registers
+actor_tile_update_rf_flags:
+ push_all
+
+ inc bc ; bc = y pos
+
+ update_rf_flag RF_ACTOR
+
pop_all
ret