Prev: 51795 Up: Map Next: 51824
51802: 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 51802 LD A,(23470) Fetch FloorHeight.
51805 LD D,A Copy it to D.
Test whether the object ends up below the floor.
StopObjectAtFloor_Test 51806 LD A,(IX+3) Fetch the z position of the object.
51809 ADD A,H Return if the object does not end up below the floor.
51810 CP D
51811 RET NC
51812 SET 2,(IX+12) Flag the object as blocked in Z.
51816 LD A,H Copy H to A.
51817 CALL BringSpeedCloserToZero Call BringSpeedCloserToZero.
51820 LD H,A Copy it to H.
51821 JR NZ,StopObjectAtFloor_Test Jump to StopObjectAtFloor_Test if it is not yet zero.
51823 RET Return.
View the equivalent code in;
Prev: 51795 Up: Map Next: 51824