Prev: 53348 Up: Map Next: 53456
53368: Check Object Visibility
Sets the carry when the current character is visible and a matching object is found. Returns with the carry clear when the character is not visible.
Output
F Carry flag set if object is visible
CheckObjectVisibility 53368 PUSH IX Save the character record, the schedule entry and the count.
53370 PUSH IY
53372 PUSH BC
53373 LD IX,(40983) Read the current character record.
53377 LD A,(IX+4) Read the attribute type.
53380 AND %10000000 Keep only bit 7.
53382 JR Z,CheckObjectVisibility_TestObjectVisibility Skip the object when bit 7 is clear, so it is not visible.
53384 CALL CheckObjectMother Go to CheckObjectVisibility_Next unless CheckObjectMother returned 255.
53387 INC A
53388 JR NZ,CheckObjectVisibility_Next
Fetch current character location.
53390 CALL FetchCurrentCharacterLocation Call FetchCurrentCharacterLocation to read where the current character is.
53393 BIT 7,(IX+0) Jump to CheckObjectVisibility_TestObjectVisibility if a marker on the record's flag byte is set.
53397 JR NZ,CheckObjectVisibility_TestObjectVisibility
53399 CALL GetTimePeriod Go to CheckObjectVisibility_TestObjectVisibility if it is not 1.
53402 CP 1
53404 JR NZ,CheckObjectVisibility_TestObjectVisibility
It's late night/ evening (8 PM - 5 AM).
CheckObjectVisibility_Next 53406 LD IX,35695 Use the objects at Table_Objects.
CheckObjectVisibility_Loop 53410 CALL FetchNextObject Go to CheckObjectVisibility_ConditionHoldsCaller if the next object id is 255.
53413 JR Z,CheckObjectVisibility_ConditionHoldsCaller
53415 LD A,(IY+0) Jump to CheckObjectVisibility_Loop if the character id is not 1.
53418 CP 1
53420 JR NZ,CheckObjectVisibility_Loop
53422 LD A,(IY+5) Read the schedule entry.
53425 XOR %10110111 Jump back to CheckObjectVisibility_Loop unless bits 2 and 4 of the schedule entry are set and bits 3 and 6 are clear.
53427 AND %01011100
53429 JR NZ,CheckObjectVisibility_Loop
53431 LD A,(IY+4) Read the schedule entry.
53434 AND %10000000 Keep only bit 7.
53436 JR Z,CheckObjectVisibility_Loop Go back and test the next object when bit 7 is clear.
53438 LD A,(IX+0) Jump back to CheckObjectVisibility_Loop while the object is not in this location.
53441 CALL CheckObjectLocationMatch
53444 JR Z,CheckObjectVisibility_Loop
CheckObjectVisibility_TestObjectVisibility 53446 AND A Clear the carry and jump ahead to CheckObjectVisibility_BringSavedCount.
53447 JR CheckObjectVisibility_BringSavedCount
The condition holds, so the caller continues.
CheckObjectVisibility_ConditionHoldsCaller 53449 SCF Set the carry.
CheckObjectVisibility_BringSavedCount 53450 POP BC Restore the saved count, the saved schedule entry and the saved character record from the stack.
53451 POP IY
53453 POP IX
53455 RET Return.
Prev: 53348 Up: Map Next: 53456