Prev: 58463 Up: Map Next: 58570
58518: 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 128 (at the top of the room) and the second (Limit_Eagle_Vertical_Movement_Bottom_Gap) for a y position of 159 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 58518 CP 76 Jump to Handle_Carrying_Eagle_Store_Y to store the y position if it is 76 or more.
58520 JP NC,Handle_Carrying_Eagle_Store_Y
58523 BIT 0,E Jump to Limit_Eagle_Vertical_Movement_Top_Gap if the room has no ceiling.
58525 JP Z,Limit_Eagle_Vertical_Movement_Top_Gap
58528 LD A,(IX+9) Fetch the y velocity.
58531 CPL Invert it.
58532 LD (IX+9),A Store the y velocity.
58535 CALL Choose_Eagle_Target Choose a new target.
58538 LD A,76 Set the y position to 76.
58540 JP Handle_Carrying_Eagle_Store_Y Jump to Handle_Carrying_Eagle_Store_Y.
Limit_Eagle_Vertical_Movement_Top_Gap 58543 CP 40 Jump to Limit_Eagle_Vertical_Movement_In_Gap if the y position is 40 or more, as the eagle is in the gap.
58545 JR NC,Limit_Eagle_Vertical_Movement_In_Gap
58547 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 58550 CP 175 Jump to Limit_Eagle_Vertical_Movement_In_Gap if the y position is less than 175 as the eagle is in the gap.
58552 JR C,Limit_Eagle_Vertical_Movement_In_Gap
58554 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 58557 EX AF,AF' Save the y position.
58558 LD A,(IX+11) Fetch the contact flags.
58561 OR %01000100 Set bits 2 and 6.
58563 LD (IX+11),A Store the contact flags.
58566 EX AF,AF' Restore the y position.
58567 JP Handle_Carrying_Eagle_Store_Y Jump to Handle_Carrying_Eagle_Store_Y to store the y position.
Prev: 58463 Up: Map Next: 58570