Prev: 54197 Up: Map Next: 54242
54214: Retrieve Room
Used by the routine at BuildRoomObjects.
Builds the objects of the room that the player is in from the room data. It looks for the room in the table of rooms at RoomTable, which has a variable length entry for each room. The entry has the number of the room, the length of the rest of the entry, the colour and size of the room, the types of background object that it has (which end with a 255 if there are groups of foreground objects after them) and the groups of foreground objects. The objects are put in the objects table from ObjectsTable_RoomObjects, which is the first one after the player and the special objects. If the room is not in the table, none are made.
Input
IX Address of the player
Point at the room data, then find the entry for this room.
RetrieveRoom 54214 LD DE,23688 Point DE at the first object of the room in the objects table, ObjectsTable_RoomObjects.
54217 LD BC,27601 Point BC at the end of the table of rooms, BlockTypeTable.
54220 LD HL,25169 Point HL at RoomTable.
RetrieveRoom_Find 54223 LD A,(HL) Test whether the entry is the room of the player.
54224 INC HL
54225 CP (IX+8)
54228 JR Z,MakeRoomObjects Jump to MakeRoomObjects if they match.
54230 LD A,(HL) Fetch the length of the entry.
54231 CALL AddAToHL Call AddAToHL.
54234 AND A Jump to ClearRemainingObjects if HL has reached BC.
54235 SBC HL,BC
54237 JR NC,ClearRemainingObjects
54239 ADD HL,BC Add BC to HL.
54240 JR RetrieveRoom_Find Jump to RetrieveRoom_Find.
View the equivalent code in;
Prev: 54197 Up: Map Next: 54242