Prev: 53420 Up: Map Next: 53615
53562: 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 116 to 119. 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 53562 CALL PointAtStore Call PointAtStore to point IY at the first entry of the object store.
53565 LD C,0 Set the count of the entries to zero.
CheckObjectsCollected_Count 53567 LD A,(IY+0) Fetch the type of the entry.
53570 AND %11111100 Keep the type without its lowest two bits.
53572 CP 116 Jump to CheckObjectsCollected_Next unless it is one of the types 116 to 119.
53574 JR NZ,CheckObjectsCollected_Next
53576 INC C Add one to the count.
CheckObjectsCollected_Next 53577 ADD IY,DE Move on to the next entry.
53579 DJNZ CheckObjectsCollected_Count Jump to CheckObjectsCollected_Count until all of the entries have been tested.
53581 LD A,C Fetch the count.
53582 CP 4 Return unless all four have been collected.
53584 RET NZ
Reveal the parts of the pentagram.
53585 CALL PointAtStore Call PointAtStore to point IY at the first entry of the object store again.
CheckObjectsCollected_Reveal 53588 LD A,(IY+0) Fetch the type of the entry.
53591 AND %11111000 Keep the type without its lowest three bits.
53593 CP 128 Jump to CheckObjectsCollected_RevealNext unless it is one of the types 128 to 135, the parts of the pentagram.
53595 JR NZ,CheckObjectsCollected_RevealNext
53597 SET 0,(IX+17) Set bit 0 of the high byte of the pointer to the store in the record of the object.
53601 SET 4,(IY+7) Flag the entry as needing to be drawn.
53605 LD A,1 Set the flag for the pentagram being revealed.
53607 LD (42767),A
CheckObjectsCollected_RevealNext 53610 ADD IY,DE Move on to the next entry.
53612 DJNZ CheckObjectsCollected_Reveal Jump to CheckObjectsCollected_Reveal until all of the entries have been tested.
53614 RET Return.
Prev: 53420 Up: Map Next: 53615