Prev: A0CB Up: Map Next: A127
A104: Remove Distant Entity
Used by the routines at MoveThief, MoveHunter, MoveSaucer and MoveDome.
Removes an entity that is twelve cells or more from the camera in either direction. When the entity is removed the handler that called this routine is finished too.
Input
IX Entity
RemoveDistantEntity A104 LD A,($9692) Fetch the X cell of the camera.
A107 SUB (IX+$02) Subtract the X cell of the entity.
A10A JP P,RemoveDistantEntity_TestX Make the difference positive.
A10D NEG
RemoveDistantEntity_TestX A10F CP $0C Jump to remove the entity if it is twelve or more cells away.
A111 JR NC,RemoveDistantEntity_Remove
A113 LD A,($9694) Fetch the Y cell of the camera.
A116 SUB (IX+$04) Subtract the Y cell of the entity.
A119 JP P,RemoveDistantEntity_TestY Make the difference positive.
A11C NEG
RemoveDistantEntity_TestY A11E CP $0C Return if the entity is less than twelve cells away.
A120 RET C
RemoveDistantEntity_Remove A121 LD (IX+$00),$00 Remove the entity by setting its type to zero.
A125 POP HL Discard the return address, so that the handler stops here.
A126 RET Return.
Prev: A0CB Up: Map Next: A127