Prev: E4A7 Up: Map Next: E520
E4B9: Kill Tracked Enemy Entity
Used by the routine at Process_Tracked_Enemy_Entity.
Kill path reached when no collision-free slot is available for a tracked enemy. Steps back six bytes to the entity position fields, erases the sprite via Erase_Narrow_Entity_Sprite, removes the entity record from the list via Remove_Entity_From_List_Step, and erases the spawn buffer via Erase_Wide_Entity_Sprite. Decrements the active entity count at C42C and the total wave enemy count at Active_Enemy_Count. Initialises a dying-state colour timer via Initialise_Entity_State, writes a replacement Tick_Entity_Colour_Timer entity record at the same position, and scores 10 BCD points. Refreshes the colour bar via Clear_Colour_Bar_Column.
Kill_Tracked_Enemy_Entity E4B9 LD DE,$0006 Step back six bytes to the entity position, erase the sprite via Erase_Narrow_Entity_Sprite, and restore HL.
E4BC AND A
E4BD SBC HL,DE
E4BF PUSH HL
E4C0 CALL Erase_Narrow_Entity_Sprite
E4C3 POP HL Remove the entity from the list via Remove_Entity_From_List_Step and erase the spawn buffer via Erase_Wide_Entity_Sprite.
E4C4 CALL Remove_Entity_From_List_Step
E4C7 EXX Decrement the active count at C42C and the wave enemy count at Active_Enemy_Count.
E4C8 LD HL,$C511
E4CB CALL Erase_Wide_Entity_Sprite
E4CE LD HL,$C42C Initialise a dying entity state via Initialise_Entity_State with code 02.
E4D1 DEC (HL)
E4D2 LD HL,$C41C
E4D5 DEC (HL) Write handler Tick_Entity_Colour_Timer at Entity_Pointer_Stash and set the entity timer to 32 frames.
E4D6 LD E,$02
E4D8 CALL Initialise_Entity_State
E4DB LD DE,$E492
E4DE LD HL,($C50F)
E4E1 DEC HL Copy the entity Y and X position data and set the colour timer initial value.
E4E2 LD (HL),D
E4E3 DEC HL
E4E4 LD (HL),E
E4E5 INC HL
E4E6 INC HL
E4E7 LD (HL),$32
E4E9 INC HL
E4EA LD (HL),$14 Point HL back to the Y position, set colour INK: WHITE, PAPER: BLACK (BRIGHT) in B', and draw via Draw_Entity_Sprite.
E4EC INC HL
E4ED LD D,H
E4EE LD E,L
E4EF INC DE
E4F0 LD A,(DE)
E4F1 LD (HL),A
E4F2 INC HL
E4F3 INC DE
E4F4 INC DE
E4F5 LD A,(DE)
E4F6 LD (HL),A
E4F7 DEC HL
E4F8 DEC HL
E4F9 EXX
E4FA LD B,$47
E4FC EXX
E4FD CALL Draw_Entity_Sprite
Update the player's BCD score by 10 points and propagate any carry through the higher-order score digits.
E500 LD HL,$C405 Add 10 BCD to the units score at C405 and propagate carry through two further score digits.
E503 LD A,(HL)
E504 ADD A,$10
E506 DAA
E507 LD (HL),A
E508 JP NC,Kill_Tracked_Enemy_Score_Bar
E50B DEC HL
E50C LD A,(HL)
E50D ADD A,$01
E50F DAA
E510 LD (HL),A
E511 JP NC,Kill_Tracked_Enemy_Score_Bar
E514 DEC HL
E515 LD A,(HL)
E516 ADD A,$01
E518 DAA
E519 LD (HL),A
Kill_Tracked_Enemy_Score_Bar E51A CALL Clear_Colour_Bar_Column Refresh the colour bar via Clear_Colour_Bar_Column and advance via Process_Tracked_Enemy_Entity_Reload.
E51D JP Process_Tracked_Enemy_Entity_Reload
Prev: E4A7 Up: Map Next: E520