Prev: FCA5 Up: Map Next: FD20
FCDC: Test a box against one record, unless it is the mover's own or hidden
Used by the routines at TEST_OTHER and FIND_OBSTACLE.
A record counts unless it is the one being updated (FOUND_RECORD equal to THIS_RECORD), or has bit 5 of +16 set -- carried, or vanished -- when it is not a door. Doors always count.
BOX_OVERLAP, the author's BB2, is the box test itself, used on its own by CHE3D and BUMPED. A box runs from a corner: from +6 for the length +9 along x, from +8 for +11 along z, and down from the top, +7, for the height +10. Two boxes overlap when they overlap along all three axes, each test strict, so boxes that only touch do not; each axis that does not overlap returns at once with the carry clear.
Input
IX The record
B, D, H x, y and z of the box
C, E, L its x length, height and z length
Output
F Carry set if they overlap
TEST_ONE_RECORD FCDC LD A,(FOUND_RECORD) The mover's own record: no
FCDF SUB (IY+THIS_RECORD-V)
FCE2 RET Z
FCE3 LD A,(IX+OBJ_KIND) A door: always
FCE6 AND $0F
FCE8 CP $01
FCEA JR Z,BOX_OVERLAP
FCEC AND A Anything else, unless hidden
FCED BIT 5,(IX+OBJ_WEIGHT)
FCF1 RET NZ
This entry point is used by the routines at CHE3D and BUMPED.
BOX_OVERLAP FCF2 LD A,(IX+OBJ_Z) BOX_OVERLAP: z -- the record's corner less the box's must lie between minus the record's length and the box's
FCF5 SUB H
FCF6 JR C,TEST_ONE_RECORD_0
FCF8 SUB L
FCF9 RET NC
FCFA JR TEST_ONE_RECORD_1
TEST_ONE_RECORD_0 FCFC NEG
FCFE SUB (IX+OBJ_LEN_Z)
FD01 RET NC
TEST_ONE_RECORD_1 FD02 LD A,(IX+OBJ_X) x the same way
FD05 SUB B
FD06 JR C,TEST_ONE_RECORD_2
FD08 SUB C
FD09 RET NC
FD0A JR TEST_ONE_RECORD_3
TEST_ONE_RECORD_2 FD0C NEG
FD0E SUB (IX+OBJ_LEN_X)
FD11 RET NC
TEST_ONE_RECORD_3 FD12 LD A,(IX+OBJ_TOP) y, from the tops down: the carry from the last subtraction is the answer
FD15 SUB D
FD16 JR C,TEST_ONE_RECORD_4
FD18 SUB (IX+OBJ_HEIGHT)
FD1B RET
TEST_ONE_RECORD_4 FD1C NEG
FD1E SUB E
FD1F RET
Prev: FCA5 Up: Map Next: FD20