Prev: 42662 Up: Map Next: 43301
43247: 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 43454 with the new x position in A and the room flags in E.
If the x position is less than 207 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 207. If it is not, the contact flags are given the bits 17 and, once the x position reaches 232 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 43247 CP 207 Jump to Apply_Tumbling_Gravity if he has not reached the right wall (x position less than 207).
43249 JP C,Apply_Tumbling_Gravity
43252 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).
43254 JR Z,Handle_Tumbling_At_Right_Edge_No_Wall
43256 LD A,(IX+6) Reverse the x velocity, so that he bounces off the wall.
43259 NEG
43261 LD (IX+6),A
43264 LD (IX+1),207 Stop him at the right wall by setting the x position to 207.
43268 JP Apply_Tumbling_Gravity Jump to Apply_Tumbling_Gravity.
Handle_Tumbling_At_Right_Edge_No_Wall 43271 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'.
43272 LD A,17
43274 OR (IX+11)
43277 LD (IX+11),A
43280 EX AF,AF'
43281 SET 4,E Mark the room as having a floor (bit 4 of E).
43283 CP 232 Jump to Apply_Tumbling_Gravity if he has not left the room (x position less than 232).
43285 JP C,Apply_Tumbling_Gravity
43288 INC (IX+2) Increase the room x, to go to the room on the right.
43291 LD (IX+1),8 Put him at the left edge of the next room (x position 8).
43295 CALL Draw_Room Draw the new room.
43298 JP Update_Object_Sprite Jump to Update_Object_Sprite.
Prev: 42662 Up: Map Next: 43301