Prev: D0AC Up: Map Next: D16F
D13A: If all four quest items are done, show the pentagram
Used by the routine at QUEST_ITEM.
Counts the quest records whose graphic is 116 to 119, the quest items done. With all four, each piece of the pentagram (graphics 128 to 135) gets bit 4 of its flags, and PENTAGRAM_ON is set, which is what lets QUEST_INTO_ROOM bring the pieces into room 82 the next time he enters it and makes the collectables there glide to their places (COLLECTABLE).
Input
IX the quest item that has just been done
ALL_FOUR_DONE D13A CALL QUEST_RECORD_LOOP count the quest items done
D13D LD C,$00
ALL_FOUR_DONE_0 D13F LD A,(IY+$00)
D142 AND $FC
D144 CP $74
D146 JR NZ,ALL_FOUR_DONE_1
D148 INC C
ALL_FOUR_DONE_1 D149 ADD IY,DE
D14B DJNZ ALL_FOUR_DONE_0
D14D LD A,C not all four: done
D14E CP $04
D150 RET NZ
D151 CALL QUEST_RECORD_LOOP each piece of the pentagram...
ALL_FOUR_DONE_2 D154 LD A,(IY+$00)
D157 AND $F8
D159 CP $80
D15B JR NZ,ALL_FOUR_DONE_3
D15D SET 0,(IX+$11) (a write to the quest item's link that nothing reads)
D161 SET 4,(IY+$07) ...is to be drawn, and the pentagram is showing
D165 LD A,$01
D167 LD (PENTAGRAM_ON),A
ALL_FOUR_DONE_3 D16A ADD IY,DE
D16C DJNZ ALL_FOUR_DONE_2
D16E RET
Two of its writes have no effect found: bit 4 of the pieces' flags, which QUEST_INTO_ROOM sets anyway as it brings them in; and bit 0 of +11 of the quest item that called, the high byte of its quest record's address, which makes it point 256 bytes further on. Only a carried thing's link is ever followed (TAKE_OR_LEAVE), and a quest item cannot be picked up (CAN_PICK_UP), so nothing reads it.
Prev: D0AC Up: Map Next: D16F