Prev: F7BA Up: Map Next: F906
F7C4: Something is in the way: a door takes the knight through, anything else is met
Used by the routine at ANIMATE_AND_MOVE.
Reached when a step would make the object's box meet another record's (FIND_OBSTACLE), IX being the one it meets. Anything but a door (kind 1 in the low nibble of +12, the eleven-byte records of the object table) goes to OBJECTS_MEET. A door stops anyone but the knight, like a wall. For him: The key. If the door's +14 holds a thing's number, the thing in the place in use must be that one, or it is LOCKED (message 2). With the place empty, IX becomes nought and the test reads byte 19 of the ROM, $FF, which is no thing's number, so it is LOCKED. Eight things open doors (numbers 1 to 8; 21 doors need one). The way. The door's +17 has the direction bits (KNIGHT_CONTROLS) of the way through it, and he must be going that way this pass: x or y for a doorway, up or down for a hole (twelve doors). Walking into a door any other way is stopped as by a wall. Going down happens by gravity alone, as he stands over the hole; going up needs a jump. Room 61. The only way out of room 61 also needs the thing of kind 11 to be lying in the room (bit 1 of IY+$11) -- measured: without it he stands on the hole; with it he drops to room 60. Where he arrives. For a doorway along y he must be wholly within the door's width; he arrives as far along x from the door's +15 as he was from the door's corner, at y = +18 (less his depth if he walked down y). For one along x, within its depth; as far along y from +18, at x = +15 (less his width if he walked down x). For a hole his x and y are carried across relative to the door (+15 and +18) and his top is set to +16 (plus his height going up; that case never ran in the build's sessions). Through a doorway his height must lie wholly within the door's, and carries across relative to +16. The room behind. Every thing among the first 163 records of the object table whose record puts it in the room he is going to is tested against where he would arrive, its box made from the table's position and its template's sizes; if one is there, it is BLOCKED (message 1) and he stays. A thing with bit 4 of its +12 -- in the table, only the trolls -- does not count (measured, by moving thing 1 into room 30 where the door from room 29 lands him: BLOCKED; with bit 4 set he went through).
Then the room changes (Krumlinde's RTN_Trigger_Room_Change): the room number is the door's +13, the knight's record is moved to where he arrives, the things' places are saved (SAVE_OBJECT_POSITIONS), and the new room is entered (ROOMST), which goes back to the main loop.
Input
IX The record in the way
B The object's x after the step (D its top, H its y; C, E, L its sizes)
BUMPED F7C4 LD A,(IX+OBJ_KIND) Not a door: meet it
F7C7 AND $0F
F7C9 CP $01
F7CB JP NZ,OBJECTS_MEET
F7CE SET 7,(IY+STEP_AXES-V) A door was met this pass
F7D2 LD A,(THIS_RECORD) Only the knight goes through; for anything else it is a wall (MEET_DECOY)
F7D5 CP $07
F7D7 JP NZ,BLOCKED_MOVE
F7DA LD A,(IX+OBJ_STATE) No key needed
F7DD AND A
F7DE JR Z,DOOR_WAY
F7E0 PUSH HL The thing in the place in use (nought, the ROM, if none)
F7E1 PUSH DE
F7E2 PUSH IX
F7E4 LD L,(IY+SELECTED-V)
F7E7 LD H,$FF
F7E9 LD E,(HL)
F7EA INC HL
F7EB LD D,(HL)
F7EC PUSH DE
F7ED POP IX
F7EF CP (IX+OBJ_NUMBER) Is it the key?
F7F2 POP IX
F7F4 POP DE
F7F5 POP HL
F7F6 JR Z,DOOR_WAY
F7F8 LD (IY+MESSAGE-V),$02 No: LOCKED, and it is a wall
F7FC JP BLOCKED_MOVE
DOOR_WAY F7FF LD A,(IX+OBJ_FRAME) Krumlinde's RTN_Check_Door_Keys, though the key is already settled here. C = the way through the door
F802 LD C,A
F803 AND (IY+ASKED_DIRECTION-V) Is he going that way? This is AND (IY+ASKED_DIRECTION-V): Krumlinde has a DB and a label at its second byte, and reads the rest as AND (HL) and LD A,H
F806 JP Z,BLOCKED_MOVE
F809 LD A,(ROOM) In room 61...
F80C CP $3D
F80E JR NZ,DOOR_ARRIVAL
F810 BIT 1,(IY+THINGS_NOTED-V) ...only if the thing of kind 11 lies there
F814 JP Z,BLOCKED_MOVE
DOOR_ARRIVAL F817 CALL WORKING_POSITION B, D, H = where he is (before the step)
F81A LD L,(IX+OBJ_COUNT) L = the x he arrives at, E = the y (the door's +15 and +18)
F81D LD E,(IX+OBJ_COURSE)
F820 LD A,C Is the way along y (neither x nor height)?
F821 AND $3C
F823 JR NZ,BUMPED_0
F825 LD A,B Along y: he must be wholly within the door's width
F826 SUB (IX+OBJ_X)
F829 JP C,BLOCKED_MOVE
F82C LD B,A
F82D ADD A,(IY+REPEATS+$01-V)
F830 SUB (IX+OBJ_LEN_X)
F833 JP NC,BLOCKED_MOVE
F836 LD A,L x: as far along from +15 as he was from the door's corner
F837 ADD A,B
F838 LD B,A
F839 LD H,E y: +18 when going up y...
F83A BIT 6,C
F83C JR NZ,BUMPED_2
F83E LD A,E ...or his depth less, going down y
F83F SUB (IY+REPEAT_FROM+$01-V)
F842 LD H,A
F843 JR BUMPED_2
BUMPED_0 F845 LD A,C A hole (up or down)?
F846 AND $30
F848 JR Z,BUMPED_1
F84A LD A,B x: carried across relative to the door
F84B SUB (IX+OBJ_X)
F84E ADD A,L
F84F LD B,A
F850 LD A,H And y
F851 SUB (IX+OBJ_Z)
F854 ADD A,E
F855 LD H,A
F856 LD A,(IX+OBJ_WEIGHT) His top: the door's +16...
F859 BIT 4,C ...when going down
F85B JR Z,BUMPED_3
F85D ADD A,(IY+REPEAT_FROM-V) Going up, plus his height (never ran in the build's sessions)
F860 JR BUMPED_3
BUMPED_1 F862 LD A,H Along x: he must be wholly within the door's depth
F863 SUB (IX+OBJ_Z)
F866 JP C,BLOCKED_MOVE
F869 LD H,A
F86A ADD A,(IY+REPEAT_FROM+$01-V)
F86D SUB (IX+OBJ_LEN_Z)
F870 JP NC,BLOCKED_MOVE
F873 LD A,H (A wasted load: A is loaded again at once)
F874 LD A,E y: as far along from +18 as he was from the door's corner
F875 ADD A,H
F876 LD H,A
F877 LD A,L x: +15 when going up x...
F878 LD B,A
F879 BIT 3,C ...or his width less, going down x
F87B JR NZ,BUMPED_2
F87D SUB (IY+REPEATS+$01-V)
F880 LD B,A
BUMPED_2 F881 LD A,D Through a doorway: his top must be below the door's top...
F882 SUB (IX+OBJ_TOP)
F885 JP NC,BLOCKED_MOVE
F888 LD D,A ...and his feet not below the door's foot
F889 SUB (IY+REPEAT_FROM-V)
F88C ADD A,(IX+OBJ_HEIGHT)
F88F JP NC,BLOCKED_MOVE
F892 LD A,(IX+OBJ_WEIGHT) His top: as far below +16 as it was below the door's top
F895 ADD A,D
BUMPED_3 F896 LD D,A D = his top on arrival
F897 CALL WORKING_SIZES C, E, L = his sizes; keep all six in the other set
F89A EXX
F89B LD C,(IX+OBJ_DIRECTION) C = the room behind the door (+13)
ARRIVAL_CHECK F89E LD HL,$A91F HL five bytes before the object table, so that each step of five and the byte read after it moves on one six-byte record; keep the door's record
F8A1 PUSH IX
BUMPED_4 F8A3 LD DE,$0005 Next record: E = its room, A = its type
F8A6 ADD HL,DE
F8A7 LD E,(HL)
F8A8 INC HL
F8A9 LD A,(HL)
F8AA CP $46 The first eleven-byte record ends the things: none is in the way
F8AC JR NC,GO_THROUGH_DOOR
F8AE LD A,E A thing in another room: next
F8AF CP C
F8B0 JR NZ,BUMPED_4
F8B2 PUSH HL Make a record of it at IY+$4B: its +12 byte and its place (x, top, y) go to +5 to +8 (+5 and +6 are PRINT_X and PRINT_Y; whatever prints next sets them again)
F8B3 PUSH BC
F8B4 LD A,(HL)
F8B5 INC HL
F8B6 LD DE,$FFD0
F8B9 LD BC,$0004
F8BC LDIR
F8BE PUSH DE Its template (TEMPLATES): the sizes, at byte 6
F8BF LD HL,$B72F
F8C2 LD DE,$000B
F8C5 INC A
BUMPED_5 F8C6 ADD HL,DE
F8C7 DEC A
F8C8 JR NZ,BUMPED_5
F8CA POP DE To +9 to +11
F8CB LD BC,$0003
F8CE LDIR
F8D0 LD IX,ARRIVAL_BOX Would he arrive in its box? (the box test in TEST_ONE_RECORD, with his arrival in the other set)
F8D4 EXX
F8D5 CALL BOX_OVERLAP
F8D8 EXX
F8D9 POP BC No: next thing
F8DA POP HL
F8DB JR NC,BUMPED_4
F8DD BIT 4,(IX+OBJ_SPRITE+$01) A thing with bit 4 of +12 does not count
F8E1 JR NZ,BUMPED_4
F8E3 LD (IY+MESSAGE-V),$01 Anything else: BLOCKED, and it is a wall
F8E7 POP IX
F8E9 JP BLOCKED_MOVE
GO_THROUGH_DOOR F8EC LD (IY+ROOM-V),C Krumlinde's RTN_Trigger_Room_Change. The room is the one behind the door
F8EF POP AF Drop the scan's IX, and the two words the main loop left (MAIN_LOOP): ROOMST goes back into the loop itself
F8F0 EXX
F8F1 POP AF
F8F2 POP AF
F8F3 LD IX,(WORK_RECORD) Move the knight to where he arrives
F8F7 CALL ISO_MOVE
F8FA LD A,(WORK_BEHAVIOUR) With the state he had
F8FD LD (IX+OBJ_STATE),A
F900 CALL SAVE_OBJECT_POSITIONS Save where the things of the room are (SAVE_OBJECT_POSITIONS)
F903 JP ROOMST And enter the new one
Prev: F7BA Up: Map Next: F906