Prev: D3B5 Up: Map Next: D3E2
D3C6: 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 FF 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 D3C6 LD DE,$5C88 Point DE at the first object of the room in the objects table, ObjectsTable_RoomObjects.
D3C9 LD BC,$6BD1 Point BC at the end of the table of rooms, BlockTypeTable.
D3CC LD HL,$6251 Point HL at RoomTable.
RetrieveRoom_Find D3CF LD A,(HL) Test whether the entry is the room of the player.
D3D0 INC HL
D3D1 CP (IX+$08)
D3D4 JR Z,MakeRoomObjects Jump to MakeRoomObjects if they match.
D3D6 LD A,(HL) Fetch the length of the entry.
D3D7 CALL AddAToHL Call AddAToHL.
D3DA AND A Jump to ClearRemainingObjects if HL has reached BC.
D3DB SBC HL,BC
D3DD JR NC,ClearRemainingObjects
D3DF ADD HL,BC Add BC to HL.
D3E0 JR RetrieveRoom_Find Jump to RetrieveRoom_Find.
View the equivalent code in;
Prev: D3B5 Up: Map Next: D3E2