Prev: B95A Up: Map Next: B979
B963: Shorten dZ at the floor
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
The floor is the only limit on Z: there is no ceiling. The floor's height is the third byte of ROOM_EXTENT, 128 in all three room sizes. A move that would take the object's base below it is shortened a unit at a time until it would not, and bit 2 of +$0C records that the move was stopped.
Input
IX the object
H dZ
Output
H dZ, shortened
ADJ_DZ_FOR_OUT_OF_BOUNDS B963 LD A,($A71F) D = the floor
B966 LD D,A
CLIP_DZ_TO_FLOOR B967 LD A,(IX+$03) Z + dZ at or above the floor: done
B96A ADD A,H
B96B CP D
B96C RET NC
B96D SET 2,(IX+$0C) stopped in Z
B971 LD A,H a unit shorter, and again unless nothing is left
B972 CALL SHORTEN_DELTA
B975 LD H,A
B976 JR NZ,CLIP_DZ_TO_FLOOR
B978 RET
Prev: B95A Up: Map Next: B979