Prev: 52097 Up: Map Next: 52139
52105: 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 112 to 120 or 128 to 135, 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 52105 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.
52108 LD C,112 Set the first of the types to look for, 112.
CheckSpecialObjects_Loop 52110 LD A,(IY+0) Fetch the type of the object.
52113 CP 120 Jump to CheckSpecialObjects_FoundSpecialObject if it is type 120.
52115 JR Z,CheckSpecialObjects_FoundSpecialObject
52117 AND %11111000 Keep the type without its lowest three bits.
52119 CP C Jump to CheckSpecialObjects_FoundSpecialObject if it is one of the types 112 to 119.
52120 JR Z,CheckSpecialObjects_FoundSpecialObject
52122 CP 128 Jump to CheckSpecialObjects_FoundSpecialObject if it is one of the types 128 to 135.
52124 JR Z,CheckSpecialObjects_FoundSpecialObject
52126 ADD IY,DE Move on to the next object.
52128 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.
52130 XOR A Set the flag value to zero, as there is not a special object.
CheckSpecialObjects_SetSpecialObjectFlag 52131 LD (42818),A Store the flag.
52134 RET Return.
CheckSpecialObjects_FoundSpecialObject 52135 LD A,1 Set the flag value to one.
52137 JR CheckSpecialObjects_SetSpecialObjectFlag Jump to CheckSpecialObjects_SetSpecialObjectFlag to store it.
Prev: 52097 Up: Map Next: 52139