Prev: 26224 Up: Map Next: 26352
26328: Check whether Sam is within firing range of the sniper
Used by the routine at 25118. Returns with the zero flag set if the sniper (who is not visible at this point) has an x-coordinate that would place him on screen and at least 8 x-coordinates away from Sam.
Input
H 227 (sniper)
26328 LD L,1 Point HL at byte 1 of the sniper's buffer
This entry point is used by the routine at 25307 with HL pointing at byte 1 of the sniper's buffer.
26330 LD A,(58881) A=Sam's x-coordinate
26333 SUB (HL) Subtract the sniper's x-coordinate
26334 JR NC,26338 Jump if the result is non-negative
26336 NEG Negate the (negative) result
26338 CP 8 Is Sam less than 8 x-coordinates away from the sniper?
26340 RET C Return with the zero flag reset if so
26341 LD A,(32766) A=x-coordinate of the leftmost column of the play area on screen
26344 SUB 2 Is the sniper off-screen to the left or right?
26346 SUB (HL)
26347 ADD A,32
26349 RET NC Return with the zero flag reset if so
26350 XOR A Set the zero flag
26351 RET
Prev: 26224 Up: Map Next: 26352