Prev: 58570 Up: Map Next: 58710
58651: Check Eagle Release
Used by the routine at Handle_Carrying_Eagle.
Makes the eagle let go of Sabreman, if it is in the open part of the room (the x position is from 24 to 207 and the y position is from 72 to 159). If it is not, the routine returns and the eagle goes on carrying him.
When the eagle lets go, the routine does not return to its caller but carries on at Release_Sabreman, which ends the handler. The position of Sabreman is set to the position of the eagle, 16 further down but no lower than 159 if the room has a floor. The contact flags of Sabreman and the target of the eagle are cleared.
Input
IX Object record of the eagle
E Flags of the room
Check_Eagle_Release 58651 DI Disable interrupts.
58652 LD A,(IX+1) Fetch the x position of the eagle.
58655 CP 24 Return if it is less than 24.
58657 RET C
58658 CP 208 Return if it is 208 or more.
58660 RET NC
58661 LD A,(IX+3) Fetch the y position of the eagle.
58664 CP 72 Return if it is less than 72.
58666 RET C
58667 CP 160 Return if it is 160 or more.
58669 RET NC
58670 POP HL Discard the return address.
58671 LD A,(IX+11) Fetch the contact flags.
58674 OR E Combine them with the flags of the room.
58675 LD E,A Store the result in E.
58676 LD A,(IX+3) Fetch the y position of the eagle.
58679 ADD A,16 Add 16.
58681 BIT 4,E Jump to Check_Eagle_Release_Set_Position if the room has no floor.
58683 JR Z,Check_Eagle_Release_Set_Position
58685 CP 159 Jump to Check_Eagle_Release_Set_Position if the result is less than 159.
58687 JR C,Check_Eagle_Release_Set_Position
58689 LD A,159 Limit the y position to 159.
Check_Eagle_Release_Set_Position 58691 LD (36643),A Set the y position of Sabreman.
58694 LD A,(IX+1) Fetch the x position of the eagle.
58697 LD (36642),A Set the x position of Sabreman.
58700 XOR A Clear the contact flags of Sabreman.
58701 LD (36645),A
58704 LD (IX+12),A Clear the x position of the target.
58707 LD (IX+14),A Clear the y position of the target.
Prev: 58570 Up: Map Next: 58710