[Scummvm-cvs-logs] scummvm master -> 8570f052a39eb6ba4efe3764eb152076fbcd2f76

dreammaster dreammaster at scummvm.org
Mon Jul 6 01:18:02 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8570f052a3 SHERLOCK: RT: Cleanup and fleshing out of saving


Commit: 8570f052a39eb6ba4efe3764eb152076fbcd2f76
    https://github.com/scummvm/scummvm/commit/8570f052a39eb6ba4efe3764eb152076fbcd2f76
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-05T19:16:54-04:00

Commit Message:
SHERLOCK: RT: Cleanup and fleshing out of saving

Changed paths:
    engines/sherlock/journal.cpp
    engines/sherlock/journal.h
    engines/sherlock/objects.cpp
    engines/sherlock/objects.h
    engines/sherlock/scalpel/scalpel_journal.cpp
    engines/sherlock/scalpel/scalpel_journal.h
    engines/sherlock/tattoo/tattoo_journal.cpp
    engines/sherlock/tattoo/tattoo_journal.h
    engines/sherlock/tattoo/tattoo_people.cpp
    engines/sherlock/tattoo/tattoo_people.h



diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index 6a4347a..9441d66 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -683,4 +683,24 @@ void Journal::loadJournalFile(bool alreadyLoaded) {
 	}
 }
 
+void Journal::synchronize(Serializer &s) {
+	s.syncAsSint16LE(_index);
+	s.syncAsSint16LE(_sub);
+	s.syncAsSint16LE(_page);
+	s.syncAsSint16LE(_maxPage);
+
+	int journalCount = _journal.size();
+	s.syncAsUint16LE(journalCount);
+	if (s.isLoading())
+		_journal.resize(journalCount);
+
+	for (uint idx = 0; idx < _journal.size(); ++idx) {
+		JournalEntry &je = _journal[idx];
+
+		s.syncAsSint16LE(je._converseNum);
+		s.syncAsByte(je._replyOnly);
+		s.syncAsSint16LE(je._statementNum);
+	}
+}
+
 } // End of namespace Sherlock
diff --git a/engines/sherlock/journal.h b/engines/sherlock/journal.h
index 93fdf25..d2baae1 100644
--- a/engines/sherlock/journal.h
+++ b/engines/sherlock/journal.h
@@ -77,6 +77,11 @@ public:
 	* Displays a page of the journal at the current index
 	*/
 	bool drawJournal(int direction, int howFar);
+
+	/**
+	 * Synchronize the data for a savegame
+	 */
+	void synchronize(Serializer &s);
 public:
 	/**
 	 * Draw the journal background, frame, and interface buttons
@@ -93,11 +98,6 @@ public:
 	 * Reset viewing position to the start of the journal
 	 */
 	virtual void resetPosition() {}
-
-	/**
-	 * Synchronize the data for a savegame
-	 */
-	virtual void synchronize(Serializer &s) = 0;
 };
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 24c91cb..6471710 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -918,6 +918,17 @@ void UseType::load3DO(Common::SeekableReadStream &s) {
 	_target = Common::String(buffer);
 }
 
+void UseType::synchronize(Serializer &s) {
+	s.syncString(_verb);
+	s.syncAsSint16LE(_cAnimNum);
+	s.syncAsSint16LE(_cAnimSpeed);
+	s.syncAsSint16LE(_useFlag);
+
+	for (int idx = 0; idx < 4; ++idx)
+		s.syncString(_names[idx]);
+	s.syncString(_target);
+}
+
 /*----------------------------------------------------------------*/
 
 Object::Object(): BaseObject() {
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 7b42445..ef62ff9 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -29,6 +29,7 @@
 #include "common/str.h"
 #include "sherlock/image_file.h"
 #include "sherlock/fixed_text.h"
+#include "sherlock/saveload.h"
 
 namespace Sherlock {
 
@@ -176,6 +177,11 @@ struct UseType: public ActionType {
 	 */
 	void load(Common::SeekableReadStream &s, bool isRoseTattoo);
 	void load3DO(Common::SeekableReadStream &s);
+
+	/**
+	 * Synchronize the data for a savegame
+	 */
+	void synchronize(Serializer &s);
 };
 
 class BaseObject {
diff --git a/engines/sherlock/scalpel/scalpel_journal.cpp b/engines/sherlock/scalpel/scalpel_journal.cpp
index e3421cd..8e356c0 100644
--- a/engines/sherlock/scalpel/scalpel_journal.cpp
+++ b/engines/sherlock/scalpel/scalpel_journal.cpp
@@ -662,26 +662,6 @@ void ScalpelJournal::resetPosition() {
 	_page = 1;
 }
 
-void ScalpelJournal::synchronize(Serializer &s) {
-	s.syncAsSint16LE(_index);
-	s.syncAsSint16LE(_sub);
-	s.syncAsSint16LE(_page);
-	s.syncAsSint16LE(_maxPage);
-
-	int journalCount = _journal.size();
-	s.syncAsUint16LE(journalCount);
-	if (s.isLoading())
-		_journal.resize(journalCount);
-
-	for (uint idx = 0; idx < _journal.size(); ++idx) {
-		JournalEntry &je = _journal[idx];
-
-		s.syncAsSint16LE(je._converseNum);
-		s.syncAsByte(je._replyOnly);
-		s.syncAsSint16LE(je._statementNum);
-	}
-}
-
 } // End of namespace Scalpel
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel_journal.h b/engines/sherlock/scalpel/scalpel_journal.h
index 9790461..6bc0aa0 100644
--- a/engines/sherlock/scalpel/scalpel_journal.h
+++ b/engines/sherlock/scalpel/scalpel_journal.h
@@ -93,11 +93,6 @@ public:
 	 * Reset viewing position to the start of the journal
 	 */
 	virtual void resetPosition();
-
-	/**
-	 * Synchronize the data for a savegame
-	 */
-	virtual void synchronize(Serializer &s);
 };
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp
index 7fdb80e..6df5ee7 100644
--- a/engines/sherlock/tattoo/tattoo_journal.cpp
+++ b/engines/sherlock/tattoo/tattoo_journal.cpp
@@ -428,10 +428,6 @@ void TattooJournal::drawFrame() {
 
 }
 
-void TattooJournal::synchronize(Serializer &s) {
-	// TODO
-}
-
 void TattooJournal::drawControls(int mode) {
 	TattooEngine &vm = *(TattooEngine *)_vm;
 	Screen &screen = *_vm->_screen;
diff --git a/engines/sherlock/tattoo/tattoo_journal.h b/engines/sherlock/tattoo/tattoo_journal.h
index 7169e60..5e5cfda 100644
--- a/engines/sherlock/tattoo/tattoo_journal.h
+++ b/engines/sherlock/tattoo/tattoo_journal.h
@@ -94,11 +94,6 @@ public:
 	 * Draw the journal background, frame, and interface buttons
 	 */
 	virtual void drawFrame();
-
-	/**
-	 * Synchronize the data for a savegame
-	 */
-	virtual void synchronize(Serializer &s);
 };
 
 } // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index 5956d98..a7d7d24 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -967,6 +967,55 @@ void TattooPerson::checkWalkGraphics() {
 	setImageFrame();
 }
 
+void TattooPerson::synchronize(Serializer &s) {
+	s.syncAsSint32LE(_position.x);
+	s.syncAsSint32LE(_position.y);
+	s.syncAsSint16LE(_sequenceNumber);
+	s.syncAsSint16LE(_type);
+	s.syncString(_walkVGSName);
+	s.syncString(_description);
+	s.syncString(_examine);
+
+	// NPC specific properties
+	s.syncBytes(&_npcPath[0], MAX_NPC_PATH);
+	s.syncString(_npcName);
+	s.syncAsSint32LE(_npcPause);
+	s.syncAsByte(_lookHolmes);
+	s.syncAsByte(_updateNPCPath);
+	
+	// Walk to list
+	uint count = _walkTo.size();
+	s.syncAsUint16LE(count);
+	if (s.isLoading()) {
+		// Load path
+		for (uint idx = 0; idx < count; ++count) {
+			int xp = 0, yp = 0;
+			s.syncAsSint16LE(xp);
+			s.syncAsSint16LE(yp);
+			_walkTo.push(Common::Point(xp, yp));
+		}
+	} else {
+		// Save path
+		Common::Array<Common::Point> path;
+
+		// Save the points of the path
+		for (uint idx = 0; idx < count; ++idx) {
+			Common::Point pt = _walkTo.pop();
+			s.syncAsSint16LE(pt.x);
+			s.syncAsSint16LE(pt.y);
+			path.push_back(pt);
+		}
+
+		// Re-add the pending points back to the _walkTo queue
+		for (uint idx = 0; idx < count; ++idx)
+			_walkTo.push(path[idx]);
+	}
+
+	// Verbs
+	for (int idx = 0; idx < 2; ++idx)
+		_use[idx].synchronize(s);
+}
+
 /*----------------------------------------------------------------*/
 
 TattooPeople::TattooPeople(SherlockEngine *vm) : People(vm) {
@@ -1176,16 +1225,8 @@ int TattooPeople::findSpeaker(int speaker) {
 void TattooPeople::synchronize(Serializer &s) {
 	s.syncAsByte(_holmesOn);
 
-	for (uint idx = 0; idx < _data.size(); ++idx) {
-		Person &p = *_data[idx];
-		s.syncAsSint32LE(p._position.x);
-		s.syncAsSint32LE(p._position.y);
-		s.syncAsSint16LE(p._sequenceNumber);
-		s.syncAsSint16LE(p._type);
-		s.syncString(p._walkVGSName);
-		s.syncString(p._description);
-		s.syncString(p._examine);
-	}
+	for (uint idx = 0; idx < _data.size(); ++idx)
+		(*this)[idx].synchronize(s);
 
 	s.syncAsSint16LE(_holmesQuotient);
 
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index 79794c2..4b35998 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -173,6 +173,11 @@ public:
 	void checkWalkGraphics();
 
 	/**
+	 * Synchronize the data for a savegame
+	 */
+	void synchronize(Serializer &s);
+
+	/**
 	 * This adjusts the sprites position, as well as it's animation sequence:
 	 */
 	virtual void adjustSprite();






More information about the Scummvm-git-logs mailing list