aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFabio Battaglia2009-03-03 20:05:00 +0000
committerFabio Battaglia2009-03-03 20:05:00 +0000
commit7fc8bb81a74f58d46b82b7d555ef3da4c0076ee9 (patch)
tree69ec8806229571f7bb3f0ff1f01c23cbe9b1ed07 /engines
parentea4f25fd308b243a322836d6546f70963363ddf6 (diff)
downloadscummvm-rg350-7fc8bb81a74f58d46b82b7d555ef3da4c0076ee9.tar.gz
scummvm-rg350-7fc8bb81a74f58d46b82b7d555ef3da4c0076ee9.tar.bz2
scummvm-rg350-7fc8bb81a74f58d46b82b7d555ef3da4c0076ee9.zip
Enabled and hopefully fixed GMM saving/loading for sword1
svn-id: r39095
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/detection.cpp16
-rw-r--r--engines/sword1/sword1.cpp11
-rw-r--r--engines/sword1/sword1.h10
3 files changed, 24 insertions, 13 deletions
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index b086f2eb0b..246bf95b8e 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -108,7 +108,9 @@ bool SwordMetaEngine::hasFeature(MetaEngineFeature f) const {
bool Sword1::SwordEngine::hasFeature(EngineFeature f) const {
return
- (f == kSupportsRTL);
+ (f == kSupportsRTL) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsLoadingDuringRuntime);
}
GameList SwordMetaEngine::getSupportedGames() const {
@@ -313,30 +315,28 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
namespace Sword1 {
-// FIXME: Loading a game through the GMM crashes the game
-#if 0
Common::Error SwordEngine::loadGameState(int slot) {
_systemVars.forceRestart = false;
_systemVars.controlPanelMode = CP_NORMAL;
_control->restoreGameFromFile(slot);
reinitialize();
_control->doRestore();
+ reinitRes();
return Common::kNoError; // TODO: return success/failure
}
+bool SwordEngine::canLoadGameStateCurrently() {
+ return mouseIsActive();
+}
+
Common::Error SwordEngine::saveGameState(int slot, const char *desc) {
_control->setSaveDescription(slot, desc);
_control->saveGameToFile(slot);
return Common::kNoError; // TODO: return success/failure
}
-bool SwordEngine::canLoadGameStateCurrently() {
- return mouseIsActive();
-}
-
bool SwordEngine::canSaveGameStateCurrently() {
return mouseIsActive();
}
-#endif
} // End of namespace Sword1
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 28cc1a51d2..d42d90af70 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -149,6 +149,7 @@ Common::Error SwordEngine::init() {
}
void SwordEngine::reinitialize(void) {
+ _sound->quitScreen();
_resMan->flush(); // free everything that's currently alloced and opened. (*evil*)
_logic->initialize(); // now reinitialize these objects as they (may) have locked
@@ -729,4 +730,14 @@ bool SwordEngine::mouseIsActive() {
return Logic::_scriptVars[MOUSE_STATUS] & 1;
}
+// The following function is needed to restore proper status after GMM load game
+void SwordEngine::reinitRes(void) {
+ _screen->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ _logic->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ _sound->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ Logic::_scriptVars[SCREEN] = Logic::_scriptVars[NEW_SCREEN];
+ _screen->fullRefresh();
+ _screen->draw();
+}
+
} // End of namespace Sword1
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 8563946196..1aaa5da5e0 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -76,7 +76,7 @@ public:
virtual ~SwordEngine();
static SystemVars _systemVars;
void reinitialize(void);
-
+
uint32 _features;
bool mouseIsActive();
@@ -98,13 +98,10 @@ protected:
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
- // FIXME: Loading a game through the GMM crashes the game
-#if 0
Common::Error loadGameState(int slot);
- Common::Error saveGameState(int slot, const char *desc);
bool canLoadGameStateCurrently();
+ Common::Error saveGameState(int slot, const char *desc);
bool canSaveGameStateCurrently();
-#endif
private:
void delay(int32 amount);
@@ -113,6 +110,9 @@ private:
void checkCd(void);
void showFileErrorMsg(uint8 type, bool *fileExists);
void flagsToBool(bool *dest, uint8 flags);
+
+ void reinitRes(void); //Reinits the resources after a GMM load
+
uint8 mainLoop(void);
Common::Point _mouseCoord;