![]() |
Routines |
| Prev: B8CC | Up: Map | Next: B90D |
|
Used by the routine at BlockMovement.
Brings the speed along x of an object closer to zero until the object stays within the walls of the room. Nothing is done while the object is entering the room, or while it is near an arch, as it can then go out through the wall.
|
||||||||||||||
|
Return while entering or near an arch.
|
||||||||||||||
| KeepObjectInRoomInX | B8E2 | LD A,(IX+$0C) | Fetch the collision flags. | |||||||||||
| B8E5 | AND %11110000 | Keep only the countdown from entering the room. | ||||||||||||
| B8E7 | RET NZ | Return if the object has only just entered the room. | ||||||||||||
| B8E8 | BIT 0,(IX+$07) | Return if the object ignores the walls. | ||||||||||||
| B8EC | RET NZ | |||||||||||||
| B8ED | LD A,($A71D) | Fetch RoomSizeX. | ||||||||||||
| B8F0 | LD B,A | Copy it to B. | ||||||||||||
|
Slow x until the object stays in the room.
|
||||||||||||||
| KeepObjectInRoomInX_Test | B8F1 | LD A,(IX+$01) | Fetch the x position of the object. | |||||||||||
| B8F4 | ADD A,C | Add C. | ||||||||||||
| B8F5 | SUB $80 | Subtract 80. | ||||||||||||
| B8F7 | JR NC,KeepObjectInRoomInX_Compare | Jump to KeepObjectInRoomInX_Compare if that is not negative. | ||||||||||||
| B8F9 | NEG | Negate A. | ||||||||||||
| KeepObjectInRoomInX_Compare | B8FB | ADD A,(IX+$04) | Add the half size of the object, to get the distance of its edge from the middle. | |||||||||||
| B8FE | CP B | Return if the edge is inside the limit. | ||||||||||||
| B8FF | JR C,KeepObjectInRoomInX_Done | |||||||||||||
| B901 | SET 0,(IX+$0C) | Flag that the object has been stopped along x. | ||||||||||||
| B905 | LD A,C | Copy C to A. | ||||||||||||
| B906 | CALL BringSpeedCloserToZero | Call BringSpeedCloserToZero. | ||||||||||||
| B909 | LD C,A | Copy it to C. | ||||||||||||
| B90A | JR NZ,KeepObjectInRoomInX_Test | Jump to KeepObjectInRoomInX_Test to test again, unless the distance is zero. | ||||||||||||
| KeepObjectInRoomInX_Done | B90C | RET | Return. | |||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: B8CC | Up: Map | Next: B90D |