Prev: C52F Up: Map Next: C554
C538: 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 50 to 5F. 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 C538 LD IY,$BCAE Point IY at the first shot, and set a counter for two shots.
C53C LD B,$02
CheckShotHit_Loop C53E PUSH BC Check whether this shot hits the object, and return if it does.
C53F CALL CheckShotHit_Shot
C542 POP BC
C543 RET C
C544 LD DE,$0010 Set the distance from one object to the next (10 bytes).
C547 DJNZ CheckShotHit_Loop Loop back until both shots have been checked.
C549 RET Return.
CheckShotHit_Shot C54A LD A,(IY+$00) Return if the object at IY is not a shot (type 50 to 5F).
C54D SUB $50
C54F CP $10
C551 RET NC
C552 JR CheckObjectsOverlap Jump to CheckObjectsOverlap to check whether the shot overlaps the object.
Prev: C52F Up: Map Next: C554