Resource loader enhanced to load hotspot proximity data and room walkable areas

svn-id: r21780
This commit is contained in:
Paul Gilbert 2006-04-11 10:45:22 +00:00
parent f6b2cf2c6d
commit 9b87224036
2 changed files with 35 additions and 2 deletions

View File

@ -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();

View File

@ -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();