diff options
author | Paul Gilbert | 2008-01-20 03:38:16 +0000 |
---|---|---|
committer | Paul Gilbert | 2008-01-20 03:38:16 +0000 |
commit | 99e2c7c1d65251a188b986685bd7986dda82edb9 (patch) | |
tree | 9a6a648024104ab5f6628311512285b3c194eb77 /engines/lure | |
parent | 08a0caa17fba3308138ef9792254224b99d779cf (diff) | |
download | scummvm-rg350-99e2c7c1d65251a188b986685bd7986dda82edb9.tar.gz scummvm-rg350-99e2c7c1d65251a188b986685bd7986dda82edb9.tar.bz2 scummvm-rg350-99e2c7c1d65251a188b986685bd7986dda82edb9.zip |
Fixed bug with saving of cached actor schedules and added saving of talk data flags
svn-id: r30582
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/luredefs.h | 2 | ||||
-rw-r--r-- | engines/lure/res.cpp | 18 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 28 | ||||
-rw-r--r-- | engines/lure/res_struct.h | 6 |
4 files changed, 46 insertions, 8 deletions
diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index 9d248d6f1a..5940c1ea41 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -36,7 +36,7 @@ namespace Lure { #define LURE_DAT_MAJOR 1 #define LURE_DAT_MINOR 29 #define LURE_MIN_SAVEGAME_MINOR 25 -#define LURE_SAVEGAME_MINOR 31 +#define LURE_SAVEGAME_MINOR 32 #define LURE_DEBUG 1 diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index a3eb33660d..78ae7ec87f 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -731,15 +731,16 @@ void Resources::saveToStream(Common::WriteStream *stream) { stream->writeUint16LE(_talkingCharacter); // Save sublist data + _hotspotSchedules.saveToStream(stream); _hotspotData.saveToStream(stream); _activeHotspots.saveToStream(stream); - _hotspotSchedules.saveToStream(stream); _fieldList.saveToStream(stream); _randomActions.saveToStream(stream); _barmanLists.saveToStream(stream); _exitJoins.saveToStream(stream); _roomData.saveToStream(stream); _delayList.saveToStream(stream); + _talkData.saveToStream(stream); } void Resources::loadFromStream(Common::ReadStream *stream) { @@ -755,17 +756,16 @@ void Resources::loadFromStream(Common::ReadStream *stream) { _talkState = TALK_NONE; _activeTalkData = NULL; - debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot data"); - _hotspotData.loadFromStream(stream); - debugC(ERROR_DETAILED, kLureDebugScripts, "Loading active hotspots"); - _activeHotspots.loadFromStream(stream); - _hotspotSchedules.clear(); if (saveVersion >= 31) { _hotspotSchedules.loadFromStream(stream); debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot schedules"); } + debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot data"); + _hotspotData.loadFromStream(stream); + debugC(ERROR_DETAILED, kLureDebugScripts, "Loading active hotspots"); + _activeHotspots.loadFromStream(stream); debugC(ERROR_DETAILED, kLureDebugScripts, "Loading fields"); _fieldList.loadFromStream(stream); debugC(ERROR_DETAILED, kLureDebugScripts, "Loading random actions"); @@ -778,6 +778,12 @@ void Resources::loadFromStream(Common::ReadStream *stream) { _roomData.loadFromStream(stream); debugC(ERROR_DETAILED, kLureDebugScripts, "Loading delay list"); _delayList.loadFromStream(stream); + + if (saveVersion >= 32) { + debugC(ERROR_DETAILED, kLureDebugScripts, "Loading talk data"); + _talkData.loadFromStream(stream); + } + debugC(ERROR_DETAILED, kLureDebugScripts, "Finished loading"); } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index af13135f61..1123712811 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -692,6 +692,34 @@ TalkEntryData *TalkData::getResponse(int index) { return *i; } +// The following class acts as a container for all the NPC conversations + +void TalkDataList::saveToStream(WriteStream *stream) { + TalkDataList::iterator i; + for (i = begin(); i != end(); ++i) { + TalkData *rec = *i; + TalkEntryList::iterator i; + + for (i = rec->entries.begin(); i != rec->entries.end(); ++i) { + TalkEntryData *entry = *i; + stream->writeUint16LE(entry->descId); + } + } +} + +void TalkDataList::loadFromStream(ReadStream *stream) { + TalkDataList::iterator i; + for (i = begin(); i != end(); ++i) { + TalkData *rec = *i; + TalkEntryList::iterator i; + + for (i = rec->entries.begin(); i != rec->entries.end(); ++i) { + TalkEntryData *entry = *i; + entry->descId = stream->readUint16LE(); + } + } +} + // The following class handles a set of coordinates a character should walk to // if they're to exit a room to a designated secondary room diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index 9469fa939e..b53b254ad4 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -589,7 +589,11 @@ public: TalkEntryData *getResponse(int index); }; -typedef ManagedList<TalkData *> TalkDataList; +class TalkDataList: public ManagedList<TalkData *> { +public: + void saveToStream(WriteStream *stream); + void loadFromStream(ReadStream *stream); +}; struct RoomExitCoordinateData { int16 x; |