@done:
; unset flag
- ld a, [gameplay_flags]
- and a, ~GPF_ATTACK_ONGOING & 0xFF
- ld [gameplay_flags], a
+ ld a, [gpf_attack_ongoing]
+ dec a
+ ld [gpf_attack_ongoing], a
; set animation timer and delay
ld bc, st_unit_delay_to_active_template
unit_action_attack_damage_calc:
; set flag
- ld a, [gameplay_flags]
- or a, GPF_ATTACK_ONGOING
- ld [gameplay_flags], a
+ ld a, [gpf_attack_ongoing]
+ inc a
+ ld [gpf_attack_ongoing], a
; calculate damage
push de
; this will allow all other units to
; perform their update
.de GPF_PLAYER_TURN_TAKEN, 2
- ; set while an attack animation is playing
- ; delay to active actor stats should wait until this
- ; is cleared
-.de GPF_ATTACK_ONGOING, 4
; cell flags
.se 1
call disableinterrutpts
call next_vblank_wait
call lcd_off
+
+ xor a, a
+ ld [gpf_attack_ongoing], a
ret
; draws the map
ld a, [gameplay_flags]
and a, GPF_PLAYER_TURN_TAKEN
ret nz
+
+ ; check if an attack is ongoing
+ ld a, [gpf_attack_ongoing]
+ cp a, 0
+ ret nz
push de
ld hl, act_oam_flags
@not_player:
; do not proceed if an attack animation is ongoing
- ld a, [gameplay_flags]
- and a, GPF_ATTACK_ONGOING
+ ld a, [gpf_attack_ongoing]
+ cp a, 0
jr nz, @delay_again REL
ldnull bc
; dummy oam
; same memory as empty_unit
empty_oam: .adv oamsize
+
+ ; > 0 if an actor has an ongoing attack
+ ; used to delay other actors during the animation
+gpf_attack_ongoing: .adv 0
; can be used for custom state transtions