Prev: 44339 Up: Map Next: 44377
44342: Test Actor Side
Test whether this actor is to the left of Jetman. The world wraps at 8192 so carry is set when Jetman's world X (Jetman_Position) is less than 4096 ahead of the actor.
Input
IX Actor slot
Handler_Missile 44342 LD HL,(24698) Fetch Jetman_Position.
This entry point is used by the routine at AlignToRover.
Handler_Missile_FetchActorX 44345 LD C,(IX+2) Fetch the actor world X.
44348 LD B,(IX+3) Fetch the high byte.
This entry point is used by the routines at InitialiseJetman and Handler_Bombs.
Return carry if HL is ahead of BC (to its right) by less than 4096 (allowing for the wrap at 8192).
Handler_Missile_CompareWorldX 44351 AND A Subtract the second world X.
44352 SBC HL,BC
44354 LD A,H Fetch the high byte of the difference.
44355 AND A Jump to Handler_Missile_NegateThenRange if the result is negative.
44356 JP M,Handler_Missile_NegateThenRange
Test a positive difference against the range and return carry.
44359 LD BC,4096 Set the range in BC to 4096.
44362 AND A Subtract the range.
44363 SBC HL,BC
44365 RET Return.
Call NegateHL on a negative difference, then test it against the range and invert the carry.
Handler_Missile_NegateThenRange 44366 CALL NegateHL Call NegateHL.
44369 LD BC,4096 Set the range in BC to 4096.
44372 AND A Subtract the range.
44373 SBC HL,BC
44375 CCF Invert the carry flag.
44376 RET Return.
Prev: 44339 Up: Map Next: 44377