Prev: AF31 Up: Map Next: AF56
AF39: Check Room Objects
Used by the routine at Handler_RoomExits.
Input
A Room number
Output
A 00 when a visible object is here; otherwise non-zero (01, or the room number when nothing is in the room)
F Z is set when a visible object was found
CheckRoomObjects AF39 LD HL,$A66C HL=Table_ItemEventLocations.
AF3C LD BC,($A7E6) BC=*Count_Objects.
CheckRoomObjects_Loop AF40 CPIR Search for the room number in the table.
AF42 RET NZ Return if the room number is not in the table.
AF43 PUSH HL Stash the object location table pointer on the stack.
AF44 CALL ValidateObject Call ValidateObject.
AF47 POP HL Restore the object location table pointer from the stack.
AF48 JR NZ,CheckRoomObjects_Found Jump to CheckRoomObjects_Found if a visible object is here.
AF4A LD E,A Temporarily store A in E.
AF4B LD A,B Are there more objects to check?
AF4C OR C
AF4D LD A,E Restore the A register.
AF4E JR NZ,CheckRoomObjects_Loop Jump to CheckRoomObjects_Loop if there are more objects to check.
No visible object was found.
AF50 LD A,$01 Set A to 01 (NZ): no visible objects.
AF52 AND A Set the flags from A.
AF53 RET Return.
A visible object was found.
CheckRoomObjects_Found AF54 XOR A Set A to 00 (Z): a visible object was found.
AF55 RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: AF31 Up: Map Next: AF56