Prev: E45F Up: Map Next: E4CA
E496: Limit Eagle Vertical Movement
Used by the routine at Handle_Carrying_Eagle.
Deals with an eagle that has moved to a new y position that is outside the main part of the room.
The first entry point is for a y position of less than 80 (at the top of the room) and the second (Limit_Eagle_Vertical_Movement_Bottom_Gap) for a y position of 9F or more in a room that has no floor. The eagle bounces off a ceiling, flies through the gaps in the frame of the room and goes into the next room when it reaches the edge.
A gap sets bits 2 and 6 of the contact flags, so that the eagle bounces off it like it would off a wall.
Input
A New y position of the eagle
E Flags of the room
IX Object record of the eagle
Limit_Eagle_Vertical_Movement E496 CP $4C Jump to Handle_Carrying_Eagle_Store_Y to store the y position if it is 4C or more.
E498 JP NC,Handle_Carrying_Eagle_Store_Y
E49B BIT 0,E Jump to Limit_Eagle_Vertical_Movement_Top_Gap if the room has no ceiling.
E49D JP Z,Limit_Eagle_Vertical_Movement_Top_Gap
E4A0 LD A,(IX+$09) Fetch the y velocity.
E4A3 CPL Invert it.
E4A4 LD (IX+$09),A Store the y velocity.
E4A7 CALL Choose_Eagle_Target Choose a new target.
E4AA LD A,$4C Set the y position to 4C.
E4AC JP Handle_Carrying_Eagle_Store_Y Jump to Handle_Carrying_Eagle_Store_Y.
Limit_Eagle_Vertical_Movement_Top_Gap E4AF CP $28 Jump to Limit_Eagle_Vertical_Movement_In_Gap if the y position is 28 or more, as the eagle is in the gap.
E4B1 JR NC,Limit_Eagle_Vertical_Movement_In_Gap
E4B3 JP Move_Eagle_To_Next_Room Jump to Move_Eagle_To_Next_Room to move the eagle into the next room above.
This entry point is used by the routine at Handle_Carrying_Eagle.
Limit_Eagle_Vertical_Movement_Bottom_Gap E4B6 CP $AF Jump to Limit_Eagle_Vertical_Movement_In_Gap if the y position is less than AF as the eagle is in the gap.
E4B8 JR C,Limit_Eagle_Vertical_Movement_In_Gap
E4BA JP Move_Eagle_To_Room_Below Jump to Move_Eagle_To_Room_Below to move the eagle into the next room below.
Limit_Eagle_Vertical_Movement_In_Gap E4BD EX AF,AF' Save the y position.
E4BE LD A,(IX+$0B) Fetch the contact flags.
E4C1 OR %01000100 Set bits 2 and 6.
E4C3 LD (IX+$0B),A Store the contact flags.
E4C6 EX AF,AF' Restore the y position.
E4C7 JP Handle_Carrying_Eagle_Store_Y Jump to Handle_Carrying_Eagle_Store_Y to store the y position.
Prev: E45F Up: Map Next: E4CA