[Scummvm-cvs-logs] SF.net SVN: scummvm:[35031] scummvm/trunk/engines/cine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Nov 13 00:21:06 CET 2008
Revision: 35031
http://scummvm.svn.sourceforge.net/scummvm/?rev=35031&view=rev
Author: thebluegr
Date: 2008-11-12 23:21:05 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
Saving and loading from the GMM is now supported in the cine engine
Modified Paths:
--------------
scummvm/trunk/engines/cine/cine.h
scummvm/trunk/engines/cine/detection.cpp
scummvm/trunk/engines/cine/various.cpp
scummvm/trunk/engines/cine/various.h
Modified: scummvm/trunk/engines/cine/cine.h
===================================================================
--- scummvm/trunk/engines/cine/cine.h 2008-11-12 22:25:19 UTC (rev 35030)
+++ scummvm/trunk/engines/cine/cine.h 2008-11-12 23:21:05 UTC (rev 35031)
@@ -92,6 +92,10 @@
void makeSystemMenu(void);
int modifyGameSpeed(int speedChange);
int getTimerDelay() const;
+ Common::Error loadGameState(int slot);
+ Common::Error saveGameState(int slot, const char *desc);
+ bool canLoadGameStateCurrently();
+ bool canSaveGameStateCurrently();
const CINEGameDescription *_gameDescription;
Common::File _partFileHandle;
Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp 2008-11-12 22:25:19 UTC (rev 35030)
+++ scummvm/trunk/engines/cine/detection.cpp 2008-11-12 23:21:05 UTC (rev 35031)
@@ -31,6 +31,7 @@
#include "common/system.h"
#include "cine/cine.h"
+#include "cine/various.h"
namespace Cine {
@@ -547,7 +548,9 @@
bool Cine::CineEngine::hasFeature(EngineFeature f) const {
return
- (f == kSupportsRTL);
+ (f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime);
}
bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
@@ -609,3 +612,53 @@
#else
REGISTER_PLUGIN_STATIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine);
#endif
+
+namespace Cine {
+
+Common::Error CineEngine::loadGameState(int slot) {
+ char saveNameBuffer[256];
+ sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), slot);
+ bool gameLoaded = makeLoad(saveNameBuffer);
+
+ return gameLoaded ? Common::kNoError : Common::kUnknownError;
+}
+
+Common::Error CineEngine::saveGameState(int slot, const char *desc) {
+ // Load savegame descriptions from index file
+ loadSaveDirectory();
+
+ // Set description for selected slot
+ strncpy(currentSaveName[slot], desc, 20);
+
+ // Update savegame descriptions
+ char indexFile[80];
+ snprintf(indexFile, 80, "%s.dir", _targetName.c_str());
+
+ Common::OutSaveFile *fHandle = g_saveFileMan->openForSaving(indexFile);
+ if (!fHandle) {
+ warning("Unable to open file %s for saving", indexFile);
+ return Common::kUnknownError;
+ }
+
+ fHandle->write(currentSaveName, 10 * 20);
+ delete fHandle;
+
+ // Save game
+ char saveFileName[256];
+ sprintf(saveFileName, "%s.%1d", _targetName.c_str(), slot);
+ makeSave(saveFileName);
+
+ checkDataDisk(-1);
+
+ return Common::kNoError;
+}
+
+bool CineEngine::canLoadGameStateCurrently() {
+ return (!disableSystemMenu && !inMenu);
+}
+
+bool CineEngine::canSaveGameStateCurrently() {
+ return (allowPlayerInput && !disableSystemMenu && !inMenu);
+}
+
+} // End of namespace Cine
Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp 2008-11-12 22:25:19 UTC (rev 35030)
+++ scummvm/trunk/engines/cine/various.cpp 2008-11-12 23:21:05 UTC (rev 35031)
@@ -115,7 +115,7 @@
SelectedObjStruct currentSelectedObject;
-static CommandeType currentSaveName[10];
+CommandeType currentSaveName[10];
int16 currentDisk;
static const int16 choiceResultTable[] = { 1, 1, 1, 2, 1, 1, 1 };
Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h 2008-11-12 22:25:19 UTC (rev 35030)
+++ scummvm/trunk/engines/cine/various.h 2008-11-12 23:21:05 UTC (rev 35031)
@@ -45,6 +45,8 @@
extern bool disableSystemMenu;
extern bool inMenu;
+extern CommandeType currentSaveName[10];
+
struct SeqListElement {
int16 var4;
uint16 objIdx; ///< Is this really unsigned?
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