Prev: E4CA Up: Map Next: E556
E51B: 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 18 to CF and the y position is from 48 to 9F). 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, 10 further down but no lower than 9F 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 E51B DI Disable interrupts.
E51C LD A,(IX+$01) Fetch the x position of the eagle.
E51F CP $18 Return if it is less than 18.
E521 RET C
E522 CP $D0 Return if it is D0 or more.
E524 RET NC
E525 LD A,(IX+$03) Fetch the y position of the eagle.
E528 CP $48 Return if it is less than 48.
E52A RET C
E52B CP $A0 Return if it is A0 or more.
E52D RET NC
E52E POP HL Discard the return address.
E52F LD A,(IX+$0B) Fetch the contact flags.
E532 OR E Combine them with the flags of the room.
E533 LD E,A Store the result in E.
E534 LD A,(IX+$03) Fetch the y position of the eagle.
E537 ADD A,$10 Add 10.
E539 BIT 4,E Jump to Check_Eagle_Release_Set_Position if the room has no floor.
E53B JR Z,Check_Eagle_Release_Set_Position
E53D CP $9F Jump to Check_Eagle_Release_Set_Position if the result is less than 9F.
E53F JR C,Check_Eagle_Release_Set_Position
E541 LD A,$9F Limit the y position to 9F.
Check_Eagle_Release_Set_Position E543 LD ($8F23),A Set the y position of Sabreman.
E546 LD A,(IX+$01) Fetch the x position of the eagle.
E549 LD ($8F22),A Set the x position of Sabreman.
E54C XOR A Clear the contact flags of Sabreman.
E54D LD ($8F25),A
E550 LD (IX+$0C),A Clear the x position of the target.
E553 LD (IX+$0E),A Clear the y position of the target.
Prev: E4CA Up: Map Next: E556