Prev: 26788 Up: Map Next: 26880
26848: Is Object In The Current Room?
Input
A Object number
Output
F Zero flag set when the object is in the current room
IsObjectInCurrentRoom 26848 PUSH HL Keep the caller's registers while the location is tested.
26849 PUSH DE
26850 LD E,A Index the location tables by this object.
26851 LD D,0
26853 BIT 7,E Bit 7 selects a scenic slot rather than an ordinary object.
26855 JR NZ,IsObjectInCurrentRoom_Step1
26857 LD HL,25003 Continue at IsObjectInCurrentRoom_Step2 to compare an ordinary object's location.
26860 JR IsObjectInCurrentRoom_Step2
IsObjectInCurrentRoom_Step1 26862 RES 7,E The scenic marker is not part of the object number.
26864 LD HL,25124 A scenic object is kept with the scenic rooms.
IsObjectInCurrentRoom_Step2 26867 ADD HL,DE Index this object's byte in the location table.
26868 LD A,(25123) Fetch the current room.
26871 CP (HL) The object is here when its location is the current room.
26872 JR Z,IsObjectInCurrentRoom_Step3
26874 LD A,1 A carried object counts as present too.
26876 CP (HL)
IsObjectInCurrentRoom_Step3 26877 POP DE Restore the registers the caller needs from the stack.
26878 POP HL
26879 RET Return.
Prev: 26788 Up: Map Next: 26880