Prev: C0BE Up: Map Next: C13C
C117: Is he inside the room's walls?
Used by the routines at TAKE_OR_LEAVE and PLAYER_LEGS.
Compares the object's distance from the room's centre, 128 on U and V, with the room's half-size in each (ROOM_HALF_U, ROOM_HALF_V) less its own half-size. Carry means the whole of its footprint is inside on both; no carry, that it touches or crosses the line of a wall, which only a doorway allows. As Knight Lore's chk_plyr_OOB.
Input
IX the object, the robot's legs
Output
F carry set if it is
CHK_PLYR_OOB C117 LD HL,(ROOM_HALF_U) L = the room's half-size in U less his; H = the same for V
C11A LD A,L
C11B SUB (IX+$04)
C11E LD L,A
C11F LD A,H
C120 SUB (IX+$05)
C123 LD H,A
C124 LD A,(IX+$01) |U - 128|: no carry, outside
C127 SUB $80
C129 JP P,CHK_PLYR_OOB_0
C12C NEG
CHK_PLYR_OOB_0 C12E CP L
C12F RET NC
C130 LD A,(IX+$02) |V - 128|
C133 SUB $80
C135 JP P,CHK_PLYR_OOB_1
C138 NEG
CHK_PLYR_OOB_1 C13A CP H
C13B RET
Prev: C0BE Up: Map Next: C13C