[Scummvm-cvs-logs] SF.net SVN: scummvm: [30583] scummvm/branches/branch-0-11-0/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Jan 20 04:39:27 CET 2008


Revision: 30583
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30583&view=rev
Author:   dreammaster
Date:     2008-01-19 19:39:27 -0800 (Sat, 19 Jan 2008)

Log Message:
-----------
Backport of r30582 - Added saving of talk data flags

Modified Paths:
--------------
    scummvm/branches/branch-0-11-0/engines/lure/luredefs.h
    scummvm/branches/branch-0-11-0/engines/lure/res.cpp
    scummvm/branches/branch-0-11-0/engines/lure/res_struct.cpp
    scummvm/branches/branch-0-11-0/engines/lure/res_struct.h

Modified: scummvm/branches/branch-0-11-0/engines/lure/luredefs.h
===================================================================
--- scummvm/branches/branch-0-11-0/engines/lure/luredefs.h	2008-01-20 03:38:16 UTC (rev 30582)
+++ scummvm/branches/branch-0-11-0/engines/lure/luredefs.h	2008-01-20 03:39:27 UTC (rev 30583)
@@ -36,7 +36,7 @@
 #define LURE_DAT_MAJOR 1
 #define LURE_DAT_MINOR 29
 #define LURE_MIN_SAVEGAME_MINOR 25 
-#define LURE_SAVEGAME_MINOR 30
+#define LURE_SAVEGAME_MINOR 32
 
 #define LURE_DEBUG 1
 

Modified: scummvm/branches/branch-0-11-0/engines/lure/res.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/engines/lure/res.cpp	2008-01-20 03:38:16 UTC (rev 30582)
+++ scummvm/branches/branch-0-11-0/engines/lure/res.cpp	2008-01-20 03:39:27 UTC (rev 30583)
@@ -695,6 +695,9 @@
 	// Save basic fields
 	stream->writeUint16LE(_talkingCharacter);
 
+	// Dummy save of empty hotspot schedules list
+	stream->writeUint16LE(0xffff);
+
 	// Save sublist data
 	_hotspotData.saveToStream(stream);
 	_activeHotspots.saveToStream(stream);
@@ -704,6 +707,7 @@
 	_exitJoins.saveToStream(stream);
 	_roomData.saveToStream(stream);
 	_delayList.saveToStream(stream);
+	_talkData.saveToStream(stream);
 }
 
 void Resources::loadFromStream(Common::ReadStream *stream) {
@@ -719,6 +723,15 @@
 	_talkState = TALK_NONE;
 	_activeTalkData = NULL;
 
+	if (saveVersion >= 31) {
+		// ScummVM 0.11 Lure engine doesn't have the 0.12 saved actor schedules list, so just scan past it
+		CurrentActionEntry *rec;
+		while (stream->readUint16LE() != 0xffff) {
+			while ((rec = CurrentActionEntry::loadFromStream(stream)) != NULL)
+				delete rec;
+		}
+	}
+
 	debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot data");
 	_hotspotData.loadFromStream(stream);
 	debugC(ERROR_DETAILED, kLureDebugScripts, "Loading active hotspots");
@@ -735,6 +748,12 @@
 	_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");
 }
 

Modified: scummvm/branches/branch-0-11-0/engines/lure/res_struct.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/engines/lure/res_struct.cpp	2008-01-20 03:38:16 UTC (rev 30582)
+++ scummvm/branches/branch-0-11-0/engines/lure/res_struct.cpp	2008-01-20 03:39:27 UTC (rev 30583)
@@ -692,6 +692,34 @@
 	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
 

Modified: scummvm/branches/branch-0-11-0/engines/lure/res_struct.h
===================================================================
--- scummvm/branches/branch-0-11-0/engines/lure/res_struct.h	2008-01-20 03:38:16 UTC (rev 30582)
+++ scummvm/branches/branch-0-11-0/engines/lure/res_struct.h	2008-01-20 03:39:27 UTC (rev 30583)
@@ -589,7 +589,11 @@
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list