Prev: CF33 Up: Map Next: CFA4
CF52: Step Wide Entity Approach
Per-entity frame handler for an approaching wide entity. Advances the scroll counter, moves the entity down by eight pixels per frame, and on the final frame installs Handle_Horizontal_Enemy_Entity as the entity's new handler. Called from Main_Game_Loop.
Step_Wide_Entity_Approach CF52 EX DE,HL Copy the entity pointer to DE.
CF53 LD HL,($C535) Advance the animation phase counter by 40.
CF56 LD BC,$0040
CF59 ADD HL,BC
CF5A LD ($C535),HL
CF5D EX DE,HL Copy the entity pointer back to HL.
CF5E LD A,D Jump to Step_Wide_Entity_Approach_Wrap to wrap the approach at the screen boundary.
CF5F CP $0F
CF61 JR Z,Step_Wide_Entity_Approach_Wrap
CF63 JR NC,Step_Wide_Entity_Approach_Advance_Six Jump to Step_Wide_Entity_Approach_Advance_Six if the entity's approach descent is complete.
CF65 EXX Load the entity draw colour.
CF66 LD B,A
CF67 INC B
CF68 EXX
CF69 PUSH HL Draw the entity sprite.
CF6A CALL Draw_Wide_Entity_Sprite_Pixels_Only
CF6D POP HL
CF6E INC HL Move the entity eight pixels down the screen.
CF6F LD A,(HL)
CF70 ADD A,$08
CF72 LD (HL),A
CF73 DEC HL Step back within the entity record.
CF74 LD A,($C536) Skip spawning if this is not the final approach frame.
CF77 CP $01
CF79 JR NZ,Step_Wide_Entity_Approach_Draw
CF7B EXX Switch to the entity arrival colour INK: GREEN, PAPER: BLACK (BRIGHT) .
CF7C LD B,$44
CF7E EXX
CF7F PUSH HL Draw the entity's arrival frame.
CF80 CALL Draw_Wide_Entity_Sprite
CF83 POP HL
CF84 DEC HL Install Handle_Horizontal_Enemy_Entity as the entity handler to begin horizontal movement.
CF85 LD DE,$E1B6
CF88 LD (HL),D
CF89 DEC HL
CF8A LD (HL),E
CF8B LD DE,$0008 Advance eight bytes to the next entity record.
CF8E JR Step_Wide_Entity_Approach_Advance
Step_Wide_Entity_Approach_Wrap CF90 INC HL Reset the descent position to wrap the approach path.
CF91 LD A,(HL)
CF92 SUB $70
CF94 LD (HL),A
CF95 DEC HL Step back and prepare the draw colour.
CF96 LD A,D
Step_Wide_Entity_Approach_Draw CF97 EXX Load the draw colour.
CF98 LD B,A
CF99 EXX
CF9A PUSH HL Draw the entity sprite.
CF9B CALL Draw_Wide_Entity_Sprite_Pixels_Only
CF9E POP HL
Step_Wide_Entity_Approach_Advance_Six CF9F LD DE,$0006 Prepare to advance past this entity record.
Step_Wide_Entity_Approach_Advance CFA2 ADD HL,DE Advance to the next entity record and return.
CFA3 RET
Prev: CF33 Up: Map Next: CFA4