Prev: BA47 Up: Map Next: BA8B
BA63: Check Crosshair On Outlaw
Used by the routine at HandleWaitingOutlaw.
Checks whether the player's shot is on the outlaw. The outlaw cannot be hit once he has fired his first shot.
Input
IX The address of the outlaw
Output
F The carry flag is set if the outlaw has been hit
Return unless the player's shot is in the air.
CheckCrosshairOnOutlaw BA63 LD A,($A212) Return if ShotsFiredCount is not zero.
BA66 AND A
BA67 RET NZ
BA68 LD IY,$A34D Point IY at the fourteenth object slot, which holds the player's shot.
BA6C LD A,(IY+$00) Return if the shot slot is not in use.
BA6F AND A
BA70 RET Z
Test whether the shot is on the outlaw.
BA71 LD A,(IX+$02) Fetch the horizontal position of the outlaw.
BA74 ADD A,$04 Move four pixels to the right.
BA76 SUB (IY+$02) Subtract the horizontal position of the shot.
BA79 NEG Make it positive.
BA7B CP $18 Return if the shot is 18 or more to the side.
BA7D RET NC
BA7E LD A,(IX+$04) Fetch the vertical position of the outlaw.
BA81 ADD A,$0C Move twelve pixels up.
BA83 SUB (IY+$04) Subtract the vertical position of the shot.
BA86 NEG Make it positive.
BA88 CP $30 Compare it with forty eight.
BA8A RET Return with the carry flag set if the shot is on the outlaw.
Prev: BA47 Up: Map Next: BA8B