Prev: 58449 Up: Map Next: 58518
58463: 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 128 and the second (Limit_Eagle_Sideways_Movement_Right_Gap) for an x position of 208 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 58463 CP 24 Jump to Handle_Carrying_Eagle_Store_X to store the x position if it is 24 or more.
58465 JP NC,Handle_Carrying_Eagle_Store_X
58468 BIT 6,E Jump to Limit_Eagle_Sideways_Movement_Left_Gap if the room has no wall on the left.
58470 JR Z,Limit_Eagle_Sideways_Movement_Left_Gap
58472 LD A,(IX+8) Fetch the x velocity.
58475 CPL Invert it.
58476 LD (IX+8),A Store the x velocity.
58479 CALL Choose_Eagle_Target Choose a new target.
58482 LD A,24 Set the x position to 24.
58484 JP Handle_Carrying_Eagle_Store_X Jump to Handle_Carrying_Eagle_Store_X.
Limit_Eagle_Sideways_Movement_Left_Gap 58487 CP 8 Jump to Limit_Eagle_Sideways_Movement_In_Gap if the x position is 8 or more, as the eagle is in the gap.
58489 JR NC,Limit_Eagle_Sideways_Movement_In_Gap
58491 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 58494 CP 231 Jump to Limit_Eagle_Sideways_Movement_In_Gap if the x position is less than 231 as the eagle is in the gap.
58496 JR C,Limit_Eagle_Sideways_Movement_In_Gap
58498 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 58501 EX AF,AF' Save the x position.
58502 LD A,(IX+11) Fetch the contact flags.
58505 OR %00010001 Set bits 0 and 4.
58507 LD (IX+11),A Store the contact flags.
58510 LD A,E Copy the flags of the room to A.
58511 OR %00010001 Set bits 0 and 4.
58513 LD E,A Store the result in E.
58514 EX AF,AF' Restore the x position.
58515 JP Handle_Carrying_Eagle_Store_X Jump to Handle_Carrying_Eagle_Store_X to store the x position.
Prev: 58449 Up: Map Next: 58518