Prev: B95A Up: Map Next: B979
B963: 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 B963 LD A,($A71F) Fetch FloorHeight.
B966 LD D,A Copy it to D.
Slow z until the object stays above the floor.
StopObjectAtFloor_Test B967 LD A,(IX+$03) Fetch the z position of the object.
B96A ADD A,H Return if the object does not end up below the floor.
B96B CP D
B96C RET NC
B96D SET 2,(IX+$0C) Flag that the object has been stopped along z, which is on the ground.
B971 LD A,H Copy H to A.
B972 CALL BringSpeedCloserToZero Call BringSpeedCloserToZero.
B975 LD H,A Copy it to H.
B976 JR NZ,StopObjectAtFloor_Test Jump to StopObjectAtFloor_Test to test again, unless the distance is zero.
B978 RET Return.
View the equivalent code in;
Prev: B95A Up: Map Next: B979