Prev: 54476 Up: Map Next: 54554
54511: Check Object Match Criteria
Used by the routines at CountObjectsInLocation and FindNextMatchingObject.
Input
A Object ID
B Location ID
Output
F Carry flag set if object matches all criteria (location, visibility, type, etc.)
Check if the object is in the specified location.
CheckObjectMatchCriteria 54511 CP (IY+1) Jump to CheckObjectMatchCriteria_NoMatch if the object's location (from *IY+1) doesn't match the requested location ID.
54514 JR NZ,CheckObjectMatchCriteria_NoMatch
Check if the object belongs to the current character.
54516 LD A,(41014) Jump to CheckObjectMatchCriteria_NoMatch if the object belongs to the current character (compare CurrentCharacter_ID with the object's character ID from *IX+0).
54519 CP (IX+0)
54522 JR Z,CheckObjectMatchCriteria_NoMatch
Check if the object is visible to the current character.
54524 LD A,(IX+0) Load the object's character ID into A.
54527 CALL CheckObjectLocationMatch Call CheckObjectLocationMatch.
54530 JR Z,CheckObjectMatchCriteria_NoMatch Jump to CheckObjectMatchCriteria_NoMatch if the object is not visible (doesn't match criteria).
Check the object type.
54532 LD A,(IY+0) Jump to CheckObjectMatchCriteria_NoMatch if the object type (from *IY+0) is 2 or greater (doesn't match criteria).
54535 CP 2
54537 JR NC,CheckObjectMatchCriteria_NoMatch
Perform final validation check.
54539 LD A,(41014) A=*CurrentCharacter_ID.
54542 PUSH IX Copy IX into HL using the stack.
54544 POP HL
54545 CALL CheckCharacterIDRange_0 Call CheckCharacterIDRange_0 to perform an additional validation check.
54548 JR C,CheckObjectMatchCriteria_NoMatch Jump to CheckObjectMatchCriteria_NoMatch if the validation check fails (A is less than 2).
All checks passed - object matches the criteria.
54550 SCF Set the carry flag to indicate the object matches.
54551 RET Return with carry flag set.
Object doesn't match any criteria.
CheckObjectMatchCriteria_NoMatch 54552 AND A Clear the carry flag (object doesn't match criteria).
54553 RET Return with carry flag clear.
Prev: 54476 Up: Map Next: 54554