Prev: E451 Up: Map Next: E496
E45F: Limit Eagle Sideways Movement
Used by the routine at Handle_Carrying_Eagle.
Deals with an eagle that has moved to a new x position that is outside the main part of the room.
The first entry point is for an x position below 80 and the second (Limit_Eagle_Sideways_Movement_Right_Gap) for an x position of D0 or more in a room that has no wall on the right. The eagle bounces off a wall on the left, 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 0 and 4 of the contact flags and of the flags of the room, so that the eagle bounces off it like it would off a ceiling or a floor.
Input
A New x position of the eagle
E Flags of the room
IX Object record of the eagle
Limit_Eagle_Sideways_Movement E45F CP $18 Jump to Handle_Carrying_Eagle_Store_X to store the x position if it is 18 or more.
E461 JP NC,Handle_Carrying_Eagle_Store_X
E464 BIT 6,E Jump to Limit_Eagle_Sideways_Movement_Left_Gap if the room has no wall on the left.
E466 JR Z,Limit_Eagle_Sideways_Movement_Left_Gap
E468 LD A,(IX+$08) Fetch the x velocity.
E46B CPL Invert it.
E46C LD (IX+$08),A Store the x velocity.
E46F CALL Choose_Eagle_Target Choose a new target.
E472 LD A,$18 Set the x position to 18.
E474 JP Handle_Carrying_Eagle_Store_X Jump to Handle_Carrying_Eagle_Store_X.
Limit_Eagle_Sideways_Movement_Left_Gap E477 CP $08 Jump to Limit_Eagle_Sideways_Movement_In_Gap if the x position is 08 or more, as the eagle is in the gap.
E479 JR NC,Limit_Eagle_Sideways_Movement_In_Gap
E47B JP Move_Eagle_To_Room_On_Left Jump to Move_Eagle_To_Room_On_Left to move the eagle into the next room on the left.
This entry point is used by the routine at Handle_Carrying_Eagle.
Limit_Eagle_Sideways_Movement_Right_Gap E47E CP $E7 Jump to Limit_Eagle_Sideways_Movement_In_Gap if the x position is less than E7 as the eagle is in the gap.
E480 JR C,Limit_Eagle_Sideways_Movement_In_Gap
E482 JP Move_Eagle_To_Room_On_Right Jump to Move_Eagle_To_Room_On_Right to move the eagle into the next room on the right.
Limit_Eagle_Sideways_Movement_In_Gap E485 EX AF,AF' Save the x position.
E486 LD A,(IX+$0B) Fetch the contact flags.
E489 OR %00010001 Set bits 0 and 4.
E48B LD (IX+$0B),A Store the contact flags.
E48E LD A,E Copy the flags of the room to A.
E48F OR %00010001 Set bits 0 and 4.
E491 LD E,A Store the result in E.
E492 EX AF,AF' Restore the x position.
E493 JP Handle_Carrying_Eagle_Store_X Jump to Handle_Carrying_Eagle_Store_X to store the x position.
Prev: E451 Up: Map Next: E496