Prev: CA53 Up: Map Next: CA70
CA5A: Stop Object At Floor
Used by the routine at BlockMovement.
Stops an object from going through the floor. If the z position of the object after it has moved is below the floor of the room, the object is flagged as blocked along z, and its speed along z is brought closer to zero until the object no longer goes through the floor.
Input
H Speed along the z axis
IX The address of the object
Output
H The new speed along the z axis
Test the floor and slow z.
StopObjectAtFloor CA5A LD A,($5BAE) Fetch FloorHeight.
CA5D LD D,A Copy it to D.
Test whether the object ends up below the floor.
StopObjectAtFloor_Test CA5E LD A,(IX+$03) Fetch the z position of the object.
CA61 ADD A,H Return if the object does not end up below the floor.
CA62 CP D
CA63 RET NC
CA64 SET 2,(IX+$0C) Flag the object as blocked in Z.
CA68 LD A,H Copy H to A.
CA69 CALL BringSpeedCloserToZero Call BringSpeedCloserToZero.
CA6C LD H,A Copy it to H.
CA6D JR NZ,StopObjectAtFloor_Test Jump to StopObjectAtFloor_Test if it is not yet zero.
CA6F RET Return.
View the equivalent code in;
Prev: CA53 Up: Map Next: CA70