Prev: CB81 Up: Map Next: CBAB
CB89: Check Special Objects
Used by the routine at RunGame.
Looks for any special object in the room, which is an ordinary object of one of the types 70 to 78 or 80 to 87, and sets the flag at SpecialObjectFlag to show if there is one. It is called when a room has been built.
Look through the ordinary objects.
CheckSpecialObjects CB89 CALL PointAtObjects Call PointAtObjects to point IY at the first ordinary object, with the number of them in B and the size of each in DE.
CB8C LD C,$70 Set the first of the types to look for, 70.
CheckSpecialObjects_Loop CB8E LD A,(IY+$00) Fetch the type of the object.
CB91 CP $78 Jump to CheckSpecialObjects_FoundSpecialObject if it is type 78.
CB93 JR Z,CheckSpecialObjects_FoundSpecialObject
CB95 AND %11111000 Keep the type without its lowest three bits.
CB97 CP C Jump to CheckSpecialObjects_FoundSpecialObject if it is one of the types 70 to 77.
CB98 JR Z,CheckSpecialObjects_FoundSpecialObject
CB9A CP $80 Jump to CheckSpecialObjects_FoundSpecialObject if it is one of the types 80 to 87.
CB9C JR Z,CheckSpecialObjects_FoundSpecialObject
CB9E ADD IY,DE Move on to the next object.
CBA0 DJNZ CheckSpecialObjects_Loop Jump to CheckSpecialObjects_Loop until all of the objects have been checked.
Set the flag from whether a special object was found.
CBA2 XOR A Set the flag value to zero, as there is not a special object.
CheckSpecialObjects_SetSpecialObjectFlag CBA3 LD ($A742),A Store the flag.
CBA6 RET Return.
CheckSpecialObjects_FoundSpecialObject CBA7 LD A,$01 Set the flag value to one.
CBA9 JR CheckSpecialObjects_SetSpecialObjectFlag Jump to CheckSpecialObjects_SetSpecialObjectFlag to store it.
Prev: CB81 Up: Map Next: CBAB