Prev: 52921 Up: Map Next: 53043
52959: 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 52959 INC HL Step past the entity type byte.
52960 EX DE,HL Copy the entity pointer to DE.
52961 LD HL,(50485) Advance the animation phase counter by 64.
52964 LD BC,64
52967 ADD HL,BC
52968 LD (50485),HL
52971 EX DE,HL Copy the entity pointer back to HL.
52972 LD A,D Jump to Step_Narrow_Entity_Approach_Wrap to wrap the approach at the screen boundary.
52973 CP 15
52975 JR Z,Step_Narrow_Entity_Approach_Wrap
52977 JR NC,Step_Narrow_Entity_Approach_Advance_Six Jump to Step_Narrow_Entity_Approach_Advance_Six if the entity's approach descent is complete.
52979 EXX Load the entity draw colour.
52980 LD B,A
52981 INC B
52982 EXX
52983 PUSH HL Draw the entity sprite.
52984 CALL Draw_Clipped_Wide_Sprite
52987 POP HL
52988 INC HL Move the entity six pixels down the screen.
52989 LD A,(HL)
52990 ADD A,6
52992 LD (HL),A
52993 DEC HL Step back within the entity record.
52994 LD A,(50486) Skip spawning if this is not the final approach frame.
52997 CP 1
52999 JR NZ,Step_Narrow_Entity_Approach_Draw
53001 EXX Switch to the entity arrival colour INK: YELLOW, PAPER: BLACK (BRIGHT) .
53002 LD B,70
53004 EXX
53005 PUSH HL Draw the entity's arrival frame.
53006 CALL Draw_Entity_Sprite
53009 POP HL
53010 DEC HL Install Handle_Homing_Enemy as the entity's new handler to begin homing on the player.
53011 DEC HL
53012 LD DE,52560
53015 LD (HL),D
53016 DEC HL
53017 LD (HL),E
53018 LD DE,9 Advance nine bytes to the next entity record.
53021 JR Step_Narrow_Entity_Approach_Advance
Step_Narrow_Entity_Approach_Wrap 53023 INC HL Reset the descent position to wrap the approach path.
53024 LD A,(HL)
53025 SUB 84
53027 LD (HL),A
53028 DEC HL Step back and prepare the draw colour.
53029 LD A,D
Step_Narrow_Entity_Approach_Draw 53030 EXX Load the draw colour.
53031 LD B,A
53032 EXX
53033 PUSH HL Draw the entity sprite.
53034 CALL Draw_Clipped_Wide_Sprite
53037 POP HL
Step_Narrow_Entity_Approach_Advance_Six 53038 LD DE,6 Prepare to advance past this entity record.
Step_Narrow_Entity_Approach_Advance 53041 ADD HL,DE Advance to the next entity record and return.
53042 RET
Prev: 52921 Up: Map Next: 53043