Prev: C350 Up: Map Next: C36D
C357: 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 C357 LD A,($5B0E) Fetch FloorHeight.
C35A LD D,A Copy it to D.
StopObjectAtFloor_Test C35B LD A,(IX+$03) Fetch the z position of the object.
C35E ADD A,H Return if the object does not end up below the floor.
C35F CP D
C360 RET NC
C361 SET 2,(IX+$0C) Set bit 2 of the collision flags.
C365 LD A,H Copy H to A.
C366 CALL BringSpeedCloserToZero Call BringSpeedCloserToZero.
C369 LD H,A Copy it to H.
C36A JR NZ,StopObjectAtFloor_Test Jump to StopObjectAtFloor_Test if it is not zero.
C36C RET Return.
View the equivalent code in;
Prev: C350 Up: Map Next: C36D