Prev: 49993 Up: Map Next: 50272
50218: Identify room's interactable objects
Used by the routine at 49965.
Run after setting up room's doors. Checks the room object table at 29551 and copies any objects to the data sets at 31744.
50218 LD A,7 Maximum of 7 interactable objects displayed in a room. More can be in the room, but they won't appear until Maroc takes an object, leaves and subsequently returns to, the room.
50220 LD (60343),A Store as a counter check
50223 LD HL,(56051) Pointer to room item data tables at 29551
50226 LD A,0 Reset (data set) counter for room object table
50228 LD (60292),A
Set up data for objects in room
50231 LD A,(60087) Get room number
50234 LD B,A Used in B register in next CALL
50235 LD C,0 C register used as room counter in next CALL
50237 CALL 56908 Check objects table for what's in the current room
50240 LD A,(60292)
50243 CP 255 If all objects are dealt with - skip next few instructions
50245 JR Z,50272
Found an object to deal with in this room
50247 LD (60282),HL Store the room object table address pointer
50250 CALL 57015 Set up interactable object graphics and copy data into a room item data set at 31744
50253 LD HL,(60228) Retrieve address pointer to start of interactable object's data set (at 29551)
50256 LD (HL),0 Set the item's room number to 0, as Maroc is now in the same room as the item
50258 LD A,(60343) Get maximum object counter (max 7)...
50261 DEC A ...Decrement...
50262 LD (60343),A ...And re-store.
50265 JR Z,50272 If we've reached the maximum number of objects in this room, jump to next routine
50267 LD HL,(60282) Otherwise, retrieve the room object table address pointer
50270 JR 50231 ...and continue checking for objects.
Prev: 49993 Up: Map Next: 50272