[Scummvm-cvs-logs] SF.net SVN: scummvm: [29357] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Nov 1 16:58:34 CET 2007


Revision: 29357
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29357&view=rev
Author:   peres001
Date:     2007-11-01 08:58:33 -0700 (Thu, 01 Nov 2007)

Log Message:
-----------
Consolidated game data cleanup in a single routine to location switches more reliable, especially on savegames and on game start.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/saveload.cpp

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2007-11-01 15:15:43 UTC (rev 29356)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2007-11-01 15:58:33 UTC (rev 29357)
@@ -438,25 +438,8 @@
 		_engineFlags |= kEngineChangeLocation;
 	}
 
-	// this code saves main character animation from being removed from the following code
-	_animations.remove(&_char._ani);
-	_locationNames[0][0] = '\0';
-	_numLocations = 0;
-	_commandFlags = 0;
+	cleanupGame();
 
-	// this flag tells freeZones to unconditionally remove *all* Zones
-	_engineFlags |= kEngineQuit;
-
-	freeZones();
-	freeAnimations();
-
-	// this dangerous flag can now be cleared
-	_engineFlags &= ~kEngineQuit;
-
-	// main character animation is restored
-	_animations.push_front(&_char._ani);
-	_score = 0;
-
 	return;
 }
 
@@ -550,6 +533,9 @@
 		_engineFlags &= ~kEngineBlockInput;
 		selectCharacterForNewLocation();
 		_engineFlags |= kEngineChangeLocation;
+
+		cleanupGame();
+
 	} else {
 		waitUntilLeftClick();
 	}

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-11-01 15:15:43 UTC (rev 29356)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-11-01 15:58:33 UTC (rev 29357)
@@ -672,6 +672,7 @@
 private:
 	void changeLocation(char *location);
 	void changeCharacter(const char *name);
+	void cleanupGame();
 
 	void setArrowCursor();
 	void setInventoryCursor(int pos);
@@ -911,8 +912,6 @@
 	uint16		guiChooseLanguage();
 	uint16		guiSelectGame();
 	int			guiGetSelectedBlock(const Common::Point &p, Common::Rect& r);
-
-
 };
 
 

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-11-01 15:15:43 UTC (rev 29356)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-11-01 15:58:33 UTC (rev 29357)
@@ -453,4 +453,30 @@
 	return new OpcodeImpl2<Parallaction_ns>(this, _jobsFn[functionId], job);
 }
 
+void Parallaction_ns::cleanupGame() {
+
+	// this code saves main character animation from being removed from the following code
+	_animations.remove(&_char._ani);
+	_numLocations = 0;
+	_commandFlags = 0;
+
+	memset(_localFlags, 0, sizeof(_localFlags));
+	memset(_locationNames, 0, sizeof(_locationNames));
+
+	// this flag tells freeZones to unconditionally remove *all* Zones
+	_engineFlags |= kEngineQuit;
+
+	freeZones();
+	freeAnimations();
+
+	// this dangerous flag can now be cleared
+	_engineFlags &= ~kEngineQuit;
+
+	// main character animation is restored
+	_animations.push_front(&_char._ani);
+	_score = 0;
+
+	return;
+}
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp	2007-11-01 15:15:43 UTC (rev 29356)
+++ scummvm/trunk/engines/parallaction/saveload.cpp	2007-11-01 15:58:33 UTC (rev 29357)
@@ -82,6 +82,8 @@
 
 	_soundMan->stopMusic();
 
+	cleanupGame();
+
 	_introSarcData3 = 200;
 	_introSarcData2 = 1;
 
@@ -125,8 +127,6 @@
 	_engineFlags &= ~kEngineQuit;
 
 	_numLocations = atoi(s);
-	memset(_localFlags, 0, sizeof(_localFlags));
-	memset(_locationNames, 0, sizeof(_locationNames));
 
 	uint16 _si;
 	for (_si = 0; _si < _numLocations; _si++) {


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