Prev: 38670 Up: Map Next: 39086
39044: Test Alien Beside Slot
Return with the Z flag set if the alien is beside the object in World_Slot_2_Position, otherwise with the Z flag unset.
Input
IX Actor slot
TestAlienBesideSlot 39044 LD H,(IX+3) Fetch the high byte of the world X.
39047 LD L,(IX+2) Fetch the low byte of the world X.
39050 LD DE,(24770) Fetch World_Slot_2_Position.
39054 LD BC,8 Add an 8 tolerance.
39057 ADD HL,BC
39058 SBC HL,DE Subtract the slot-2 position.
39060 LD A,H Fetch the high byte of the gap.
39061 AND %00011111 Keep only bits 0-4.
39063 JR NZ,TestAlienBesideSlot_NotBeside Jump to TestAlienBesideSlot_NotBeside if they are not on the same screen.
39065 LD A,L Fetch the low byte of the gap.
39066 CP 16 Jump to TestAlienBesideSlot_NotBeside if it is at least 16.
39068 JR NC,TestAlienBesideSlot_NotBeside
Test whether the alien is vertically close to the object.
39070 LD A,(24772) Fetch World_Slot_2_Y.
39073 SUB (IX+4) Subtract the alien's Y position.
39076 CP 16 Jump to TestAlienBesideSlot_NotBeside if the Y gap is at least 16.
39078 JR NC,TestAlienBesideSlot_NotBeside
39080 XOR A Return with the Z flag set.
39081 RET
TestAlienBesideSlot_NotBeside 39082 LD A,1 Return with the Z flag unset.
39084 AND A
39085 RET
Prev: 38670 Up: Map Next: 39086