Prev: E1B6 Up: Map Next: E262
E22A: Begin Enemy Death Animation
Used by the routine at Handle_Horizontal_Enemy_Entity.
Called when a colliding wave enemy is struck: freezes movement, removes the sprite, flashes it white, marks it as dying, and starts the 32-frame death timer. Decrements the live count for this enemy's class. Called from Handle_Horizontal_Enemy_Entity and Process_Wall_Bouncing_Enemy.
Input
HL Entity record pointer (positioned at the entity type byte)
Freeze the enemy and remove it from the screen.
Begin_Enemy_Death_Animation E22A DEC HL Step back four bytes to the entity handler field.
E22B DEC HL
E22C DEC HL
E22D DEC HL
E22E PUSH HL Freeze the enemy: save the entity pointer and call Initialise_Entity_State with movement state 03.
E22F LD E,$03
E231 CALL Initialise_Entity_State
E234 POP HL Restore the entity pointer into HL and keep a copy on the stack.
E235 PUSH HL
E236 CALL Erase_Wide_Entity_Sprite Erase the enemy sprite from the screen via Erase_Wide_Entity_Sprite.
E239 POP HL Restore the entity pointer from the stack.
Mark the enemy as dying and flash it white to signal the kill.
Begin_Enemy_Death_Animation_Flash E23A LD C,(HL) Save the entity type in C, stash both on the stack, and mark the enemy as dying (0F).
E23B PUSH BC
E23C LD (HL),$0F
E23E PUSH HL
E23F EXX Set the draw colour to INK: WHITE, PAPER: BLACK (BRIGHT) in B'.
E240 LD B,$47
E242 EXX
E243 CALL Draw_Entity_Sprite Flash the enemy white on screen via Draw_Entity_Sprite.
Restore context, reduce the live count, and start the death timer.
E246 POP HL Restore the entity pointer and entity type from the stack.
E247 POP BC
E248 SRL C Shift the entity type right four bits to get the enemy class index.
E24A SRL C
E24C SRL C
E24E SRL C
E250 EX DE,HL Reduce the live enemy count for this class in the table at Table_SlotCount.
E251 LD B,$00
E253 LD HL,$C427
E256 ADD HL,BC
E257 DEC (HL)
E258 EX DE,HL
E259 DEC HL Step back to the animation timer byte and set it to 32 frames.
E25A LD (HL),$32
E25C EXX Step the alternate entity list pointer back three bytes.
E25D DEC HL
E25E DEC HL
E25F DEC HL
E260 EXX
E261 RET Return.
Prev: E1B6 Up: Map Next: E262