Prev: B8E2 Up: Map Next: B938
B90D: Shorten dV at the walls
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
ADJ_DU_FOR_OUT_OF_BOUNDS for V: the room's V half-size from the second byte of ROOM_EXTENT, the object's at +$05, and bit 1 of +$0C.
Input
IX the object
L dV
Output
L dV, shortened
ADJ_DV_FOR_OUT_OF_BOUNDS B90D LD A,(IX+$0C) not while the count in +$0C runs
B910 AND $F0
B912 RET NZ
B913 BIT 0,(IX+$07) not near a doorway
B917 RET NZ
B918 LD A,($A71E) B = the room's V half-size
B91B LD B,A
CLIP_DV_TO_WALLS B91C LD A,(IX+$02) A = |V + dV - 128|
B91F ADD A,L
B920 SUB $80
B922 JR NC,ADJ_DV_FOR_OUT_OF_BOUNDS_0
B924 NEG
ADJ_DV_FOR_OUT_OF_BOUNDS_0 B926 ADD A,(IX+$05) inside if that plus the half-size is less than the room's: done
B929 CP B
B92A JR C,ADJ_DV_FOR_OUT_OF_BOUNDS_1
B92C SET 1,(IX+$0C) stopped in V
B930 LD A,L a unit shorter, and again unless nothing is left
B931 CALL SHORTEN_DELTA
B934 LD L,A
B935 JR NZ,CLIP_DV_TO_WALLS
ADJ_DV_FOR_OUT_OF_BOUNDS_1 B937 RET
Prev: B8E2 Up: Map Next: B938