Prev: 59692 Up: Map Next: 59852
59764: Kill Wall Bouncing Enemy
Used by the routine at Process_Wall_Bouncing_Enemy.
Reached when a wall-bouncing enemy makes contact with the player. Saves the entity position in Entity_Record_Pointer, erases the sprite via Erase_Narrow_Entity_Sprite, and removes the entity from the list via Remove_Entity_From_List. Decrements the wave enemy total at Active_Enemy_Count and the bouncing enemy count at Bouncing_Enemy_Count. Triggers the border colour effect via Initialise_Entity_State and awards 5 BCD points. Refreshes the colour bar, double-erases the sprite via Erase_Wide_Entity_Sprite and Draw_Wide_Entity_Sprite_Pixels_Only, writes the dying handler Animate_Wall_Bouncing_Enemy_Death into the record, and returns.
Save the entity position and remove the bouncer from the enemy list.
Kill_Wall_Bouncing_Enemy 59764 LD DE,6 Step back six bytes to the entity position.
59767 SBC HL,DE
59769 LD (50394),HL Save the entity position in Entity_Record_Pointer.
59772 CALL Erase_Narrow_Entity_Sprite Call Erase_Narrow_Entity_Sprite to erase the bouncer sprite.
59775 CALL Remove_Entity_From_List Call Remove_Entity_From_List to remove the bouncer from the entity list.
Decrement the wave enemy and bouncing enemy counts.
59778 LD HL,50204 Decrement the wave enemy total at Active_Enemy_Count.
59781 DEC (HL)
59782 LD HL,50223 Decrement the bouncing enemy count at Bouncing_Enemy_Count.
59785 DEC (HL)
Trigger the border colour flash and award five BCD points for the kill.
59786 LD E,0 Call Initialise_Entity_State to trigger the border colour effect.
59788 CALL Initialise_Entity_State
59791 LD HL,50181 Add 5 BCD points to the units score digit at 50181.
59794 LD A,(HL)
59795 ADD A,5
59797 DAA
59798 LD (HL),A
59799 JR NC,Kill_Wall_Bouncing_Enemy_Spawn
59801 DEC HL Propagate the BCD carry through the tens and hundreds score digits.
59802 LD A,(HL)
59803 ADD A,1
59805 DAA
59806 LD (HL),A
59807 JR NC,Kill_Wall_Bouncing_Enemy_Spawn
59809 DEC HL
59810 LD A,(HL)
59811 ADD A,1
59813 DAA
59814 LD (HL),A
Refresh the colour bar and set up the dying animation handler.
Kill_Wall_Bouncing_Enemy_Spawn 59815 CALL Clear_Colour_Bar_Column Call Clear_Colour_Bar_Column to refresh the colour bar.
59818 LD B,2 Load RED into B.
59820 EXX Switch to alternate registers.
59821 DEC HL Step back to the entity position field.
59822 LD (50447),HL Save the position pointer at Entity_Pointer_Stash.
59825 CALL Erase_Wide_Entity_Sprite Call Erase_Wide_Entity_Sprite to erase the sprite.
59828 LD HL,(50447) Reload the position pointer from Entity_Pointer_Stash.
59831 CALL Draw_Wide_Entity_Sprite_Pixels_Only Call Draw_Wide_Entity_Sprite_Pixels_Only to XOR-erase the sprite.
59834 LD HL,(50447) Reload the position pointer from Entity_Pointer_Stash.
Install the dying animation handler and advance past the entity record.
59837 DEC HL Step back and set the death timer to 2.
59838 LD (HL),2
59840 DEC HL Write the dying handler address Animate_Wall_Bouncing_Enemy_Death into the entity record.
59841 LD DE,59852
59844 LD (HL),D
59845 DEC HL
59846 LD (HL),E
59847 LD DE,9 Step nine bytes forward to the next entity slot.
59850 ADD HL,DE
59851 RET Return.
Prev: 59692 Up: Map Next: 59852