Prev: 51110 Up: Map Next: 51299
51233: Check Object Location Match
Looks the object up and clears the zero flag when its location matches the current character.
Input
A Object ID
Output
F Zero flag clear when the location matches
CheckObjectLocationMatch 51233 PUSH IX Call FetchObjectDataPointer to look up that object.
51235 PUSH BC
51236 CALL FetchObjectDataPointer
51239 LD B,A Keep A in B and call GetObjectLocation to read the current character's room.
51240 LD A,(41014)
51243 CALL GetObjectLocation
51246 CP B Go to CheckObjectLocationMatch_TestStepSucceedsScript if the character's room is this object.
51247 JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
51249 BIT 7,(IX+5) Jump ahead to CheckObjectLocationMatch_Next if the object-attribute flag is clear.
51253 JR Z,CheckObjectLocationMatch_Next
51255 LD C,A Exchange A with B and call GetObjectLocation to read that object's room.
51256 LD A,B
51257 LD B,C
51258 CALL GetObjectLocation
51261 LD C,A Go to CheckObjectLocationMatch_TestStepSucceedsScript if this object's room is the character being processed.
51262 LD A,(41014)
51265 CP C
51266 JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
51268 LD A,C Go to CheckObjectLocationMatch_Next if the two locations differ.
51269 CP B
51270 JR NZ,CheckObjectLocationMatch_Next
51272 INC A Report a match at CheckObjectLocationMatch_TestStepSucceedsScript unless both locations are 255.
51273 JR NZ,CheckObjectLocationMatch_TestStepSucceedsScript
51275 LD B,(IX+0) Read the record's flag byte.
51278 LD A,(40970) Read the character attribute.
CheckObjectLocationMatch_0 51281 CP (IX+15) Jump ahead to CheckObjectLocationMatch_TestStepSucceedsScript if it matches the character attribute.
51284 JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
51286 INC IX Step to the next byte of the object.
51288 DJNZ CheckObjectLocationMatch_0 Count the next object and repeat from CheckObjectLocationMatch_0.
CheckObjectLocationMatch_Next 51290 XOR A Set the zero flag and jump ahead to CheckObjectLocationMatch_BringSavedCount.
51291 JR CheckObjectLocationMatch_BringSavedCount
CheckObjectLocationMatch_TestStepSucceedsScript 51293 OR 1 Clear the zero flag to report that the character attribute was found.
CheckObjectLocationMatch_BringSavedCount 51295 POP BC Restore the saved count and the saved character record from the stack.
51296 POP IX
51298 RET Return.
View the equivalent code in;
Prev: 51110 Up: Map Next: 51299