Prev: C4A2 Up: Map Next: C4C8
C4A3: 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 reach in each (ROOM_EXTENT) 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. FIRE has the same test written out again for a bolt. As Knight Lore's chk_plyr_OOB.
Input
IX the object, the player's legs
Output
F carry set if it is
CHK_PLYR_OOB C4A3 LD HL,(ROOM_EXTENT) L = the reach in U less the half-size in U; H = the same for V
C4A6 LD A,L
C4A7 SUB (IX+$04)
C4AA LD L,A
C4AB LD A,H
C4AC SUB (IX+$05)
C4AF LD H,A
C4B0 LD A,(IX+$01) |U - 128|: no carry, outside
C4B3 SUB $80
C4B5 JP P,CHK_PLYR_OOB_0
C4B8 NEG
CHK_PLYR_OOB_0 C4BA CP L
C4BB RET NC
C4BC LD A,(IX+$02) |V - 128|
C4BF SUB $80
C4C1 JP P,CHK_PLYR_OOB_1
C4C4 NEG
CHK_PLYR_OOB_1 C4C6 CP H
C4C7 RET
Prev: C4A2 Up: Map Next: C4C8