Prev: CCCE Up: Map Next: CD13
CCE9: Process Enemy Entity
Used by the routine at Primary_Enemy_Entity_Handler.
Draws a wave enemy entity's sprite, updates its handler to the entity update completion routine, then checks for contact with the player. If the enemy touches the player, the entity is erased, removed from the list, the wave enemy count is decremented, and execution returns to the dispatcher.
Process_Enemy_Entity CCE9 PUSH HL Stash the entity record pointer, advance four bytes to the screen address field, and draw the entity sprite via Draw_Spawned_Entity.
CCEA INC HL
CCEB INC HL
CCEC INC HL
CCED INC HL
CCEE CALL Draw_Spawned_Entity
CCF1 POP HL Restore the entity record pointer, step back to the handler field, and write the entity update completion address Advance_Entity_Pointer.
CCF2 DEC HL
CCF3 DEC HL
CCF4 LD DE,$CD13
CCF7 LD (HL),E
CCF8 INC HL
CCF9 LD (HL),D
CCFA INC HL
CCFB EXX Switch to alternate registers, subtract 6 from the entity list position to locate the record within the list.
CCFC LD DE,$0006
CCFF SBC HL,DE
CD01 PUSH HL Stash the record position, erase the entity sprite via Erase_Narrow_Entity_Sprite, and restore the position.
CD02 CALL Erase_Narrow_Entity_Sprite
CD05 POP HL
CD06 LD ($C4DA),HL Save the record pointer to Entity_Record_Pointer and remove the entity from the list via Remove_Entity_From_List.
CD09 CALL Remove_Entity_From_List
CD0C LD HL,$C423 Decrement the wave enemy count at Wave_Enemy_Count and set the entity colour to INK: WHITE, PAPER: BLACK (BRIGHT) in B'.
CD0F DEC (HL)
CD10 LD B,$47
CD12 EXX Return to the main register set.
Prev: CCCE Up: Map Next: CD13