Prev: CEB9 Up: Map Next: CF33
CEDF: Step Narrow Entity Approach
Per-entity frame handler for an approaching narrow entity. Advances the animation phase counter, moves the entity down by six pixels per frame, and on the final frame installs Handle_Homing_Enemy as the entity's new handler. Called from Main_Game_Loop.
Step_Narrow_Entity_Approach CEDF INC HL Step past the entity type byte.
CEE0 EX DE,HL Copy the entity pointer to DE.
CEE1 LD HL,($C535) Advance the animation phase counter by 40.
CEE4 LD BC,$0040
CEE7 ADD HL,BC
CEE8 LD ($C535),HL
CEEB EX DE,HL Copy the entity pointer back to HL.
CEEC LD A,D Jump to Step_Narrow_Entity_Approach_Wrap to wrap the approach at the screen boundary.
CEED CP $0F
CEEF JR Z,Step_Narrow_Entity_Approach_Wrap
CEF1 JR NC,Step_Narrow_Entity_Approach_Advance_Six Jump to Step_Narrow_Entity_Approach_Advance_Six if the entity's approach descent is complete.
CEF3 EXX Load the entity draw colour.
CEF4 LD B,A
CEF5 INC B
CEF6 EXX
CEF7 PUSH HL Draw the entity sprite.
CEF8 CALL Draw_Clipped_Wide_Sprite
CEFB POP HL
CEFC INC HL Move the entity six pixels down the screen.
CEFD LD A,(HL)
CEFE ADD A,$06
CF00 LD (HL),A
CF01 DEC HL Step back within the entity record.
CF02 LD A,($C536) Skip spawning if this is not the final approach frame.
CF05 CP $01
CF07 JR NZ,Step_Narrow_Entity_Approach_Draw
CF09 EXX Switch to the entity arrival colour INK: YELLOW, PAPER: BLACK (BRIGHT) .
CF0A LD B,$46
CF0C EXX
CF0D PUSH HL Draw the entity's arrival frame.
CF0E CALL Draw_Entity_Sprite
CF11 POP HL
CF12 DEC HL Install Handle_Homing_Enemy as the entity's new handler to begin homing on the player.
CF13 DEC HL
CF14 LD DE,$CD50
CF17 LD (HL),D
CF18 DEC HL
CF19 LD (HL),E
CF1A LD DE,$0009 Advance nine bytes to the next entity record.
CF1D JR Step_Narrow_Entity_Approach_Advance
Step_Narrow_Entity_Approach_Wrap CF1F INC HL Reset the descent position to wrap the approach path.
CF20 LD A,(HL)
CF21 SUB $54
CF23 LD (HL),A
CF24 DEC HL Step back and prepare the draw colour.
CF25 LD A,D
Step_Narrow_Entity_Approach_Draw CF26 EXX Load the draw colour.
CF27 LD B,A
CF28 EXX
CF29 PUSH HL Draw the entity sprite.
CF2A CALL Draw_Clipped_Wide_Sprite
CF2D POP HL
Step_Narrow_Entity_Approach_Advance_Six CF2E LD DE,$0006 Prepare to advance past this entity record.
Step_Narrow_Entity_Approach_Advance CF31 ADD HL,DE Advance to the next entity record and return.
CF32 RET
Prev: CEB9 Up: Map Next: CF33