Prev: 46512 Up: Map Next: 46641
46612: Check Bullet Hit
Used by the routines at HandleCactus, HandleOutlaw and HandleBystander.
Checks whether any of the bullets (objects of type 2, in the second, third and fourth slots) is touching the object being handled.
Input
IX The address of the object
Output
F The carry flag is set if a bullet is touching the object
IY The address of the bullet, if there is one
CheckBulletHit 46612 LD IY,41613 Point IY at the second object slot.
46616 LD DE,16 Set the size of an object slot.
46619 LD B,3 Set the number of bullet slots to three.
Check whether this slot holds a bullet.
CheckBulletHit_Loop 46621 LD A,(IY+0) Fetch the type of the object.
46624 CP 2 Jump to CheckBulletHit_Next if it is not a bullet.
46626 JR NZ,CheckBulletHit_Next
46628 PUSH BC Stash the number of slots on the stack.
46629 PUSH DE Stash the size of a slot on the stack.
46630 CALL CheckOverlap Check whether the bullet is touching the object.
46633 POP DE Retrieve the size of a slot.
46634 POP BC Retrieve the number of slots.
46635 RET C Return if the bullet is touching it.
Check the next slot.
CheckBulletHit_Next 46636 ADD IY,DE Move on to the next slot.
46638 DJNZ CheckBulletHit_Loop Loop back until all three slots have been checked.
46640 RET Return.
Prev: 46512 Up: Map Next: 46641