Prev: A6A6 Up: Map Next: A925
A8EF: Handle Tumbling At Right Edge
Used by the routine at Handle_Sabreman_Tumbling.
Deals with Sabreman when he tumbles and his x position has gone past the right-hand side of the room. It is entered from A9BE with the new x position in A and the room flags in E.
If the x position is less than CF nothing happens and the routine goes on at Apply_Tumbling_Gravity. If the right wall is solid (bit 2 of E), the x velocity is reversed and the x position is set to CF. If it is not, the contact flags are given the bits 11 and, once the x position reaches E8 he enters the room on the right.
Input
A New x position of Sabreman
E Flags of the room
IX Object record of Sabreman
Handle_Tumbling_At_Right_Edge A8EF CP $CF Jump to Apply_Tumbling_Gravity if he has not reached the right wall (x position less than CF).
A8F1 JP C,Apply_Tumbling_Gravity
A8F4 BIT 2,E Jump to Handle_Tumbling_At_Right_Edge_No_Wall if the right wall is not solid (bit 2 of E is clear).
A8F6 JR Z,Handle_Tumbling_At_Right_Edge_No_Wall
A8F8 LD A,(IX+$06) Reverse the x velocity, so that he bounces off the wall.
A8FB NEG
A8FD LD (IX+$06),A
A900 LD (IX+$01),$CF Stop him at the right wall by setting the x position to CF.
A904 JP Apply_Tumbling_Gravity Jump to Apply_Tumbling_Gravity.
Handle_Tumbling_At_Right_Edge_No_Wall A907 EX AF,AF' Mark the ceiling and the floor as solid (bits 0 and 4 of the contact flags of Sabreman), as he is in the gap in the wall, keeping the new x position in AF'.
A908 LD A,$11
A90A OR (IX+$0B)
A90D LD (IX+$0B),A
A910 EX AF,AF'
A911 SET 4,E Mark the room as having a floor (bit 4 of E).
A913 CP $E8 Jump to Apply_Tumbling_Gravity if he has not left the room (x position less than E8).
A915 JP C,Apply_Tumbling_Gravity
A918 INC (IX+$02) Increase the room x, to go to the room on the right.
A91B LD (IX+$01),$08 Put him at the left edge of the next room (x position 08).
A91F CALL Draw_Room Draw the new room.
A922 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Prev: A6A6 Up: Map Next: A925