diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index c1a8fa82f12..c14ec356556 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -68,7 +68,7 @@ struct AnimRecordTemp { void Resources::reloadData() { Disk &d = Disk::getReference(); - MemoryBlock *mb; + MemoryBlock *mb, *paths; uint16 *offset, offsetVal; uint16 recordId; int ctr; @@ -78,13 +78,17 @@ void Resources::reloadData() { // Load room data mb = d.getEntry(ROOM_DATA_RESOURCE_ID); + paths = d.getEntry(ROOM_PATHS_RESOURCE_ID); + offset = (uint16 *) mb->data(); for (ctr = 0; READ_LE_UINT16(offset) != 0xffff; ++ctr, ++offset) { offsetVal = READ_LE_UINT16(offset); + if (offsetVal != 0) { // Get room resource RoomResource *rec = (RoomResource *) (mb->data() + offsetVal); - RoomData *newEntry = new RoomData(rec); + + RoomData *newEntry = new RoomData(rec, paths); _roomData.push_back(newEntry); if (rec->numExits > 0) { @@ -99,6 +103,7 @@ void Resources::reloadData() { } } delete mb; + delete paths; // Load room exits mb = d.getEntry(ROOM_EXITS_RESOURCE_ID); @@ -249,6 +254,27 @@ void Resources::reloadData() { } delete mb; + // Load a list of hotspot proximities + mb = d.getEntry(HOTSPOT_PROXIMITY_RESOURCE_ID); + HotspotProximityResource *proxRec = (HotspotProximityResource *) mb->data(); + while (FROM_LE_16(proxRec->hotspotId) != 0xffff) { + HotspotProximityData *newEntry = new HotspotProximityData(proxRec); + _proximityList.push_back(newEntry); + ++joinRec; + ++proxRec; + } + delete mb; + + // Load in the list of room exit coordinates + mb = d.getEntry(EXIT_COORDINATES_RESOURCE_ID); + RoomExitCoordinateEntryResource *coordRec = (RoomExitCoordinateEntryResource *) mb->data(); + while (*((uint16 *) coordRec) != 0xffff) { + RoomExitCoordinates *newEntry = new RoomExitCoordinates(coordRec); + _coordinateList.push_back(newEntry); + ++coordRec; + } + delete mb; + // Initialise delay list _delayList.clear(); diff --git a/engines/lure/res.h b/engines/lure/res.h index 2a74d94dcff..3d5a2abba42 100644 --- a/engines/lure/res.h +++ b/engines/lure/res.h @@ -60,6 +60,8 @@ private: SequenceDelayList _delayList; Action _currentAction; MemoryBlock *_talkDialogData; + HotspotProximityList _proximityList; + RoomExitCoordinatesList _coordinateList; TalkData *_activeTalkData; TalkState _talkState; @@ -105,6 +107,11 @@ public: ValueTableData &fieldList() { return _fieldList; } SequenceDelayList &delayList() { return _delayList; } MemoryBlock &getTalkDialogData() { return *_talkDialogData; } + HotspotProximityList &proximityList() { return _proximityList; } + HotspotProximityData *getHotspotProximity(uint16 hotspotId) { + return _proximityList.getHotspot(hotspotId); + } + RoomExitCoordinatesList &coordinateList() { return _coordinateList; } void copyCursorTo(Surface *s, uint8 cursorNum, int16 x, int16 y); uint16 numInventoryItems();