Prev: 50479 Up: Map Next: 50516
50488: Check Shot Hits Object
Used by the routines at UpdateGhost, UpdateCreature and UpdateSpore.
Checks whether the object at IX has been hit by a shot. The shots are objects of type 80 to 95. The first shot is checked twice, as IY is not moved on to the second.
Input
IX Object
Output
IY The shot
F The carry flag is set if the object has been hit
CheckShotHit 50488 LD IY,48302 Point IY at the first shot, and set a counter for two shots.
50492 LD B,2
CheckShotHit_Loop 50494 PUSH BC Check whether this shot hits the object, and return if it does.
50495 CALL CheckShotHit_Shot
50498 POP BC
50499 RET C
50500 LD DE,16 Set the distance from one object to the next (16 bytes).
50503 DJNZ CheckShotHit_Loop Loop back until both shots have been checked.
50505 RET Return.
CheckShotHit_Shot 50506 LD A,(IY+0) Return if the object at IY is not a shot (type 80 to 95).
50509 SUB 80
50511 CP 16
50513 RET NC
50514 JR CheckObjectsOverlap Jump to CheckObjectsOverlap to check whether the shot overlaps the object.
Prev: 50479 Up: Map Next: 50516