![]() |
Routines |
| Prev: B00C | Up: Map | Next: B115 |
|
Used by the routine at START.
The quest things -- the four quest items, the five collectables, the eight pieces of the pentagram and the bucket -- are not in the room directory. They live in 18 records of 16 bytes at QUEST_RECORDS, each with its room at +8, and are copied into the object records when he enters a room, after the room is built (START). QUEST_OUT_OF_ROOM copies them back when he leaves.
Each thing in this room goes into the lowest free record of the room's 48, with its flag to be drawn set, the address of its quest record in +10 and +11, and the rest of the record zeroed. Two exceptions: the pieces of the pentagram stay out until all four quest items are done (PENTAGRAM_ON, CONTROL), and anything but a piece is lifted 12 at a time until it overlaps nothing (DO_ANY_OBJS_INTERSECT), so that it stands on whatever it was left on top of -- in the sessions the lift never ran; poked in, a quest item put where a hazard stands came in 12 higher (measured). With no free record left it gives up on the rest.
|
||||
| QUEST_INTO_ROOM | B097 | LD IY,QUEST_START_BUCKET | IY 16 bytes before the live quest records, since the loop adds 16 before it looks; 18 records | |
| B09B | LD B,$12 | |||
| QUEST_INTO_ROOM_0 | B09D | LD DE,$0010 | C = the room he is in | |
| B0A0 | LD A,(PLAYER_ROOM) | |||
| B0A3 | LD C,A | |||
| QUEST_INTO_ROOM_1 | B0A4 | ADD IY,DE | The next record; graphic 0 has nothing to place: a thing being carried, or the bucket before the well gives it | |
| B0A6 | LD A,(IY+$00) | |||
| B0A9 | AND A | |||
| B0AA | JR Z,QUEST_INTO_ROOM_2 | |||
| B0AC | LD A,(IY+$08) | In this room? | ||
| B0AF | CP C | |||
| B0B0 | JR Z,QUEST_INTO_ROOM_3 | |||
| QUEST_INTO_ROOM_2 | B0B2 | DJNZ QUEST_INTO_ROOM_1 | No: the next | |
| B0B4 | RET | |||
| QUEST_INTO_ROOM_3 | B0B5 | LD HL,ROOM_OBJECTS | Find the lowest empty record of the room's 48 | |
| B0B8 | LD DE,$0020 | |||
| B0BB | PUSH BC | |||
| B0BC | LD B,$30 | |||
| QUEST_INTO_ROOM_4 | B0BE | LD A,(HL) | ||
| B0BF | AND A | |||
| B0C0 | JR Z,QUEST_INTO_ROOM_5 | |||
| B0C2 | ADD HL,DE | |||
| B0C3 | DJNZ QUEST_INTO_ROOM_4 | |||
| B0C5 | POP BC | None free: give up | ||
| B0C6 | RET | |||
| QUEST_INTO_ROOM_5 | B0C7 | EX DE,HL | DE = the free record | |
| B0C8 | LD A,(IY+$00) | A piece of the pentagram (graphics 128 to 135) stays out until all four quest items are done | ||
| B0CB | AND $F8 | |||
| B0CD | CP $80 | |||
| B0CF | JR NZ,QUEST_INTO_ROOM_6 | |||
| B0D1 | LD A,(PENTAGRAM_ON) | |||
| B0D4 | AND A | |||
| B0D5 | JR Z,QUEST_INTO_ROOM_9 | |||
| QUEST_INTO_ROOM_6 | B0D7 | SET 4,(IY+$07) | To be drawn: set in the quest record itself, so the copy carries it | |
| B0DB | PUSH IY | The quest record's 16 bytes into the object record | ||
| B0DD | POP HL | |||
| B0DE | LD BC,$0010 | |||
| B0E1 | LDIR | |||
| B0E3 | PUSH IY | Its address into +10 and +11, so the thing can find its record again | ||
| B0E5 | POP HL | |||
| B0E6 | EX DE,HL | |||
| B0E7 | LD (HL),E | |||
| B0E8 | INC HL | |||
| B0E9 | LD (HL),D | |||
| B0EA | INC HL | |||
| B0EB | LD B,$0E | +12 to +1F zeroed | ||
| B0ED | XOR A | |||
| QUEST_INTO_ROOM_7 | B0EE | LD (HL),A | ||
| B0EF | INC HL | |||
| B0F0 | DJNZ QUEST_INTO_ROOM_7 | |||
| B0F2 | LD DE,$FFE0 | IX = the record: back 32 from its end | ||
| B0F5 | ADD HL,DE | |||
| B0F6 | PUSH HL | |||
| B0F7 | POP IX | |||
| B0F9 | LD A,(IX+$00) | A piece of the pentagram lies where it is | ||
| B0FC | AND $F8 | |||
| B0FE | CP $80 | |||
| B100 | JR Z,QUEST_INTO_ROOM_9 | |||
| QUEST_INTO_ROOM_8 | B102 | CALL DO_ANY_OBJS_INTERSECT | Anything else: does it overlap something? | |
| B105 | JR NC,QUEST_INTO_ROOM_9 | |||
| B107 | LD A,(IX+$03) | Yes: lift it 12 and try again | ||
| B10A | ADD A,$0C | |||
| B10C | LD (IX+$03),A | |||
| B10F | JR QUEST_INTO_ROOM_8 | |||
| QUEST_INTO_ROOM_9 | B111 | POP BC | The next quest record | |
| B112 | DJNZ QUEST_INTO_ROOM_0 | |||
| B114 | RET | |||
| Prev: B00C | Up: Map | Next: B115 |