Prev: D0AC Up: Map Next: D16F
D13A: Check Objects Collected
Used by the routine at RunCollectableObject.
Finds out if all four of the quest objects have been collected, which is when there are four entries in the object store that have the types 74 to 77. If they have, the eight parts of the pentagram are flagged as needing to be drawn, and the pentagram is flagged as being revealed, so that LoadRoomObjects brings the parts into a room.
Input
IX Record of the object that was collected
Count the collected quest objects in the store.
CheckObjectsCollected D13A CALL PointAtStore Call PointAtStore to point IY at the first entry of the object store.
D13D LD C,$00 Set the count of the entries to zero.
CheckObjectsCollected_Count D13F LD A,(IY+$00) Fetch the type of the entry.
D142 AND %11111100 Keep the type without its lowest two bits.
D144 CP $74 Jump to CheckObjectsCollected_Next unless it is one of the types 74 to 77.
D146 JR NZ,CheckObjectsCollected_Next
D148 INC C Add one to the count.
CheckObjectsCollected_Next D149 ADD IY,DE Move on to the next entry.
D14B DJNZ CheckObjectsCollected_Count Jump to CheckObjectsCollected_Count until all of the entries have been tested.
D14D LD A,C Fetch the count.
D14E CP $04 Return unless all four have been collected.
D150 RET NZ
Reveal the parts of the pentagram.
D151 CALL PointAtStore Call PointAtStore to point IY at the first entry of the object store again.
CheckObjectsCollected_Reveal D154 LD A,(IY+$00) Fetch the type of the entry.
D157 AND %11111000 Keep the type without its lowest three bits.
D159 CP $80 Jump to CheckObjectsCollected_RevealNext unless it is one of the types 80 to 87, the parts of the pentagram.
D15B JR NZ,CheckObjectsCollected_RevealNext
D15D SET 0,(IX+$11) Set bit 0 of the high byte of the pointer to the store in the record of the object.
D161 SET 4,(IY+$07) Flag the entry as needing to be drawn.
D165 LD A,$01 Set the flag for the pentagram being revealed.
D167 LD ($A70F),A
CheckObjectsCollected_RevealNext D16A ADD IY,DE Move on to the next entry.
D16C DJNZ CheckObjectsCollected_Reveal Jump to CheckObjectsCollected_Reveal until all of the entries have been tested.
D16E RET Return.
Prev: D0AC Up: Map Next: D16F