Prev: F8B4 Up: Map Next: FA5A
F9EE: Erase Entity
Used by the routine at JumpTable_EraseEntity.
Tests whether the entity overlaps the player.
Erase_Entity F9EE LD A,($6411) Return if *RestartRoomFlag is already set.
F9F1 OR A
F9F2 RET NZ
F9F3 LD C,(IX+$00) Fetch the column, row, width and height.
F9F6 LD B,(IX+$01)
F9F9 LD E,(IX+$04)
F9FC LD D,(IX+$05)
F9FF CALL Next_PrintCell Call Next_PrintCell.
FA02 XOR A Return if the clipped width or height is zero.
FA03 CP E
FA04 RET Z
FA05 CP D
FA06 RET Z
FA07 LD L,E Write the width*08+10 into the compare at FA35.
FA08 LD H,D
FA09 ADD HL,HL
FA0A ADD HL,HL
FA0B ADD HL,HL
FA0C LD A,$10
FA0E ADD A,L
FA0F LD ($FA35),A
FA12 LD A,$18 Write the height*08+18 into the compare at FA4F.
FA14 ADD A,H
FA15 LD ($FA4F),A
FA18 PUSH IY Point IY at the player at Player.
FA1A LD IY,$64A4
FA1E LD A,C Jump to Erase_Entity_Branch unless the entity overlaps the player horizontally.
FA1F ADD A,A
FA20 ADD A,A
FA21 ADD A,A
FA22 ADD A,(IX+$02)
FA25 LD C,A
FA26 LD A,(IY+$00)
FA29 ADD A,A
FA2A ADD A,A
FA2B ADD A,A
FA2C ADD A,(IY+$02)
FA2F CP C
FA30 SBC A,$00
FA32 ADD A,L
FA33 SUB C
Erase_Entity_WidthCompare FA34 CP $00 Compare against the stored width and jump to Erase_Entity_Branch if there is no overlap.
FA36 JR NC,Erase_Entity_Branch
FA38 LD A,B Jump to Erase_Entity_Branch unless the entity overlaps the player vertically.
FA39 ADD A,A
FA3A ADD A,A
FA3B ADD A,A
FA3C ADD A,(IX+$03)
FA3F LD C,A
FA40 LD A,(IY+$01)
FA43 ADD A,A
FA44 ADD A,A
FA45 ADD A,A
FA46 ADD A,(IY+$03)
FA49 CP C
FA4A SBC A,$00
FA4C ADD A,H
FA4D SUB C
Erase_Entity_HeightCompare FA4E CP $00 Compare against the stored height and jump to Erase_Entity_Branch if there is no overlap.
FA50 JR NC,Erase_Entity_Branch
FA52 LD A,$01 Write 01 to *RestartRoomFlag.
FA54 LD ($6411),A
Erase_Entity_Branch FA57 POP IY Restore IY from the stack.
FA59 RET Return.
Prev: F8B4 Up: Map Next: FA5A