Prev: D4CC Up: Map Next: D51A
D4EF: 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 D4EF CP (IY+$01) Jump to CheckObjectMatchCriteria_NoMatch if the object's location (from *IY+01) doesn't match the requested location ID.
D4F2 JR NZ,CheckObjectMatchCriteria_NoMatch
Check if the object belongs to the current character.
D4F4 LD A,($A036) Jump to CheckObjectMatchCriteria_NoMatch if the object belongs to the current character (compare CurrentCharacter_ID with the object's character ID from *IX+00).
D4F7 CP (IX+$00)
D4FA JR Z,CheckObjectMatchCriteria_NoMatch
Check if the object is visible to the current character.
D4FC LD A,(IX+$00) Load the object's character ID into A.
D4FF CALL CheckObjectLocationMatch Call CheckObjectLocationMatch.
D502 JR Z,CheckObjectMatchCriteria_NoMatch Jump to CheckObjectMatchCriteria_NoMatch if the object is not visible (doesn't match criteria).
Check the object type.
D504 LD A,(IY+$00) Jump to CheckObjectMatchCriteria_NoMatch if the object type (from *IY+00) is 02 or greater (doesn't match criteria).
D507 CP $02
D509 JR NC,CheckObjectMatchCriteria_NoMatch
Perform final validation check.
D50B LD A,($A036) A=*CurrentCharacter_ID.
D50E PUSH IX Copy IX into HL using the stack.
D510 POP HL
D511 CALL CheckCharacterIDRange_0 Call CheckCharacterIDRange_0 to perform an additional validation check.
D514 JR C,CheckObjectMatchCriteria_NoMatch Jump to CheckObjectMatchCriteria_NoMatch if the validation check fails (A is less than 02).
All checks passed - object matches the criteria.
D516 SCF Set the carry flag to indicate the object matches.
D517 RET Return with carry flag set.
Object doesn't match any criteria.
CheckObjectMatchCriteria_NoMatch D518 AND A Clear the carry flag (object doesn't match criteria).
D519 RET Return with carry flag clear.
Prev: D4CC Up: Map Next: D51A