Prev: 41163 Up: Map Next: 41255
41220: 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 41220 LD A,(38546) Fetch the X cell of the camera.
41223 SUB (IX+2) Subtract the X cell of the entity.
41226 JP P,RemoveDistantEntity_TestX Make the difference positive.
41229 NEG
RemoveDistantEntity_TestX 41231 CP 12 Jump to remove the entity if it is twelve or more cells away.
41233 JR NC,RemoveDistantEntity_Remove
41235 LD A,(38548) Fetch the Y cell of the camera.
41238 SUB (IX+4) Subtract the Y cell of the entity.
41241 JP P,RemoveDistantEntity_TestY Make the difference positive.
41244 NEG
RemoveDistantEntity_TestY 41246 CP 12 Return if the entity is less than twelve cells away.
41248 RET C
RemoveDistantEntity_Remove 41249 LD (IX+0),0 Remove the entity by setting its type to zero.
41253 POP HL Discard the return address, so that the handler stops here.
41254 RET Return.
Prev: 41163 Up: Map Next: 41255