Prev: F309 Up: Map Next: F4F4
F4E6: Write a thing's room into the object table
Used by the routines at CREATURE_UPDATE, PICK_UP_LOOK_ON, OBJECTS_MEET and MEET_DECOY.
The author's ROMM. A thing's number (+19 of its record, counted from 1, PLACE_ROOM_OBJECTS) is its place in the object table (OBJECTS), and the first 163 records of that table are all six bytes long, so the number times six, from six bytes before the table, reaches the room byte of the thing's own record. Dropping writes the room it is dropped in; picking up and the things that vanish (OBJECTS_MEET) write $FE, which no room is, so the thing is placed nowhere until it is dropped again. (A thing's place in the room is saved separately, by SAVE_OBJECT_POSITIONS, when the knight leaves.)
Only the first 163 records of the table can be reached this way, and they are the things that can move between rooms. A record with no number (+19 nought) runs the loop 256 times and reaches 1536 bytes past the start, among the eleven-byte records -- and that happens: room 19's drawing places two things of its own (not from the object table, so with no number) that can be picked up, and picking one up writes $FE into the x of the object table's record 214, the door from room 25 to room 21. Measured: after that the door is at x 254 and room 25 cannot be left that way. (Dropping the thing would write 19 there instead.)
Input
IX The thing's record
C The room, or $FE for none
SET_THING_ROOM F4E6 LD B,(IX+OBJ_NUMBER) HL = six bytes before the object table, plus six for each step of the thing's number
F4E9 LD HL,$A91E
F4EC LD DE,$0006
SET_THING_ROOM_0 F4EF ADD HL,DE
F4F0 DJNZ SET_THING_ROOM_0
F4F2 LD (HL),C The room
F4F3 RET
Prev: F309 Up: Map Next: F4F4