Prev: C350 Up: Map Next: C36D
C357: 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. FLOOR is 64 in all three room sizes (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. Called by ADJ_FOR_OUT_OF_BOUNDS before the other objects are tried.
Input
IX the object
H dZ
Output
H dZ, shortened
ADJ_DZ_FOR_OUT_OF_BOUNDS C357 LD A,(FLOOR) D = the floor
C35A LD D,A
CLIP_DZ_TO_FLOOR C35B LD A,(IX+$03) Z + dZ at or above the floor: done
C35E ADD A,H
C35F CP D
C360 RET NC
C361 SET 2,(IX+$0C) Stopped in Z
C365 LD A,H A unit shorter, and again unless nothing is left
C366 CALL SHORTEN_DELTA
C369 LD H,A
C36A JR NZ,CLIP_DZ_TO_FLOOR
C36C RET
Prev: C350 Up: Map Next: C36D