aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-11-01 15:58:33 +0000
committerNicola Mettifogo2007-11-01 15:58:33 +0000
commit06f38474a587104f8aac0a3f0c55a19c05b03005 (patch)
tree4712dfd135f033a16508c72b33a15d15a415db33
parentc7f315b32c27f3956707e21e66dde9c7b12b7e23 (diff)
downloadscummvm-rg350-06f38474a587104f8aac0a3f0c55a19c05b03005.tar.gz
scummvm-rg350-06f38474a587104f8aac0a3f0c55a19c05b03005.tar.bz2
scummvm-rg350-06f38474a587104f8aac0a3f0c55a19c05b03005.zip
Consolidated game data cleanup in a single routine to location switches more reliable, especially on savegames and on game start.
svn-id: r29357
-rw-r--r--engines/parallaction/callables_ns.cpp22
-rw-r--r--engines/parallaction/parallaction.h3
-rw-r--r--engines/parallaction/parallaction_ns.cpp26
-rw-r--r--engines/parallaction/saveload.cpp4
4 files changed, 33 insertions, 22 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index f35c986671..d258276838 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -438,24 +438,7 @@ void Parallaction_ns::_c_finito(void *parm) {
_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;
-
- // 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;
+ cleanupGame();
return;
}
@@ -550,6 +533,9 @@ void Parallaction_ns::_c_endIntro(void *parm) {
_engineFlags &= ~kEngineBlockInput;
selectCharacterForNewLocation();
_engineFlags |= kEngineChangeLocation;
+
+ cleanupGame();
+
} else {
waitUntilLeftClick();
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 5b56296fd6..77f70f838f 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -672,6 +672,7 @@ private:
private:
void changeLocation(char *location);
void changeCharacter(const char *name);
+ void cleanupGame();
void setArrowCursor();
void setInventoryCursor(int pos);
@@ -911,8 +912,6 @@ protected:
uint16 guiChooseLanguage();
uint16 guiSelectGame();
int guiGetSelectedBlock(const Common::Point &p, Common::Rect& r);
-
-
};
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 0e73c1fc2e..8d4e72475d 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -453,4 +453,30 @@ JobOpcode* Parallaction_ns::createJobOpcode(uint functionId, Job *job) {
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
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 562d4119ea..02be4c6ee8 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -82,6 +82,8 @@ void Parallaction_ns::doLoadGame(uint16 slot) {
_soundMan->stopMusic();
+ cleanupGame();
+
_introSarcData3 = 200;
_introSarcData2 = 1;
@@ -125,8 +127,6 @@ void Parallaction_ns::doLoadGame(uint16 slot) {
_engineFlags &= ~kEngineQuit;
_numLocations = atoi(s);
- memset(_localFlags, 0, sizeof(_localFlags));
- memset(_locationNames, 0, sizeof(_locationNames));
uint16 _si;
for (_si = 0; _si < _numLocations; _si++) {