Prev: C5E9 Up: Map Next: C63D
C613: 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 (ROOM_HALF_V), 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 C613 LD A,(IX+$0C) Not while the count in +$0C runs
C616 AND $F0
C618 RET NZ
C619 BIT 0,(IX+$07) Not in a doorway
C61D RET NZ
C61E LD A,(ROOM_HALF_V) B = the room's V half-size
C621 LD B,A
CLIP_DV_TO_WALLS C622 LD A,(IX+$02) A = |V + dV - 128|
C625 ADD A,L
C626 SUB $80
C628 JR NC,ADJ_DV_FOR_OUT_OF_BOUNDS_0
C62A NEG
ADJ_DV_FOR_OUT_OF_BOUNDS_0 C62C ADD A,(IX+$05) Inside if that plus the half-size is less than the room's: done
C62F CP B
C630 RET C
C631 SET 1,(IX+$0C) Stopped in V
C635 LD A,L A unit shorter, and again unless nothing is left
C636 CALL SHORTEN_DELTA
C639 LD L,A
C63A JR NZ,CLIP_DV_TO_WALLS
C63C RET
Prev: C5E9 Up: Map Next: C63D