Prev: 57782 Up: Map Next: 57954
57898: 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 50-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 57898 DEC HL Step back four bytes to the entity handler field.
57899 DEC HL
57900 DEC HL
57901 DEC HL
57902 PUSH HL Freeze the enemy: save the entity pointer and call Initialise_Entity_State with movement state 3.
57903 LD E,3
57905 CALL Initialise_Entity_State
57908 POP HL Restore the entity pointer into HL and keep a copy on the stack.
57909 PUSH HL
57910 CALL Erase_Wide_Entity_Sprite Erase the enemy sprite from the screen via Erase_Wide_Entity_Sprite.
57913 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 57914 LD C,(HL) Save the entity type in C, stash both on the stack, and mark the enemy as dying (15).
57915 PUSH BC
57916 LD (HL),15
57918 PUSH HL
57919 EXX Set the draw colour to INK: WHITE, PAPER: BLACK (BRIGHT) in B'.
57920 LD B,71
57922 EXX
57923 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.
57926 POP HL Restore the entity pointer and entity type from the stack.
57927 POP BC
57928 SRL C Shift the entity type right four bits to get the enemy class index.
57930 SRL C
57932 SRL C
57934 SRL C
57936 EX DE,HL Reduce the live enemy count for this class in the table at Table_SlotCount.
57937 LD B,0
57939 LD HL,50215
57942 ADD HL,BC
57943 DEC (HL)
57944 EX DE,HL
57945 DEC HL Step back to the animation timer byte and set it to 50 frames.
57946 LD (HL),50
57948 EXX Step the alternate entity list pointer back three bytes.
57949 DEC HL
57950 DEC HL
57951 DEC HL
57952 EXX
57953 RET Return.
Prev: 57782 Up: Map Next: 57954