Prev: 50000 Up: Map Next: 50029
50007: 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 50007 LD A,(23310) Fetch FloorHeight.
50010 LD D,A Copy it to D.
StopObjectAtFloor_Test 50011 LD A,(IX+3) Fetch the z position of the object.
50014 ADD A,H Return if the object does not end up below the floor.
50015 CP D
50016 RET NC
50017 SET 2,(IX+12) Set bit 2 of the collision flags.
50021 LD A,H Copy H to A.
50022 CALL BringSpeedCloserToZero Call BringSpeedCloserToZero.
50025 LD H,A Copy it to H.
50026 JR NZ,StopObjectAtFloor_Test Jump to StopObjectAtFloor_Test if it is not zero.
50028 RET Return.
View the equivalent code in;
Prev: 50000 Up: Map Next: 50029