This seems to still be a bit broken, but actors are now setting up their
room flags when they move.
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
+ ld a, RF_WALL | RF_DOOR | RF_ACTOR
call room_get_flag_masked
pop bc
; returns:
; sets the RF_ACTOR flag at target_y/x
; unsets RF_ACTOR at [bc] and [bc+1]
+ ; preserves registers
actor_tile_update_flag:
+ push_all
+
+ ; first unset existing flags
+
+ inc bc ; bc = y pos
+ ld a, [bc]
+ ld d, a ; d = y pos
+ inc bc ; bc = x pos
+ ld a, [bc]
+ ld e, a ; e = x pos
+ call room_get_flag_ptr
+
+ ; unset flag
+ ld a, [hl]
+ and a, 0xFF ^ RF_ACTOR
+ ld [hl], a
+
+
+ ; then set the new position's flag
+ ld a, [anim_target_y]
+ ld d, a ; d = y pos
+ ld a, [anim_target_x]
+ ld e, a ; e = x pos
+ call room_get_flag_ptr
+
+ ; set flag
+ ld a, [hl]
+ or a, RF_ACTOR
+ ld [hl], a
+
+ pop_all
ret
; function ptrs for each actor type
; check anim collision
call actor_anim_verify
+ ; set flags on z
+ call z, actor_tile_update_flag
turn_finish