Implemented GMM loading (and, once the GMM supports it, saving) for SCUMM
svn-id: r34913
This commit is contained in:
parent
edf9f24926
commit
8f33d4a40a
11 changed files with 52 additions and 18 deletions
|
@ -59,7 +59,7 @@ using GUI::WIDGET_ENABLED;
|
||||||
typedef GUI::OptionsDialog GUI_OptionsDialog;
|
typedef GUI::OptionsDialog GUI_OptionsDialog;
|
||||||
typedef GUI::Dialog GUI_Dialog;
|
typedef GUI::Dialog GUI_Dialog;
|
||||||
|
|
||||||
GlobalDialog::GlobalDialog(String name) : GUI::Dialog(name) {}
|
GlobalDialog::GlobalDialog(Common::String name) : GUI::Dialog(name) {}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kSaveCmd = 'SAVE',
|
kSaveCmd = 'SAVE',
|
||||||
|
@ -134,7 +134,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
break;
|
break;
|
||||||
case kLoadCmd:
|
case kLoadCmd:
|
||||||
{
|
{
|
||||||
String gameId = ConfMan.get("gameid");
|
Common::String gameId = ConfMan.get("gameid");
|
||||||
|
|
||||||
const EnginePlugin *plugin = 0;
|
const EnginePlugin *plugin = 0;
|
||||||
EngineMan.findGame(gameId, &plugin);
|
EngineMan.findGame(gameId, &plugin);
|
||||||
|
@ -154,15 +154,16 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
break;
|
break;
|
||||||
case kSaveCmd:
|
case kSaveCmd:
|
||||||
/*
|
/*
|
||||||
String gameId = ConfMan.get("gameid");
|
Common::String gameId = ConfMan.get("gameid");
|
||||||
|
|
||||||
const EnginePlugin *plugin = 0;
|
const EnginePlugin *plugin = 0;
|
||||||
EngineMan.findGame(gameId, &plugin);
|
EngineMan.findGame(gameId, &plugin);
|
||||||
|
|
||||||
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
|
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
|
||||||
|
Common::String desc = ... get desired description from _saveDialog ...
|
||||||
|
|
||||||
if (slot >= 0) {
|
if (slot >= 0) {
|
||||||
_engine->saveGameState(slot);
|
_engine->saveGameState(slot, desc.c_str());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
class GlobalDialog : public GUI::Dialog {
|
class GlobalDialog : public GUI::Dialog {
|
||||||
public:
|
public:
|
||||||
GlobalDialog(Common::String name);
|
GlobalDialog(Common::String name);
|
||||||
|
|
||||||
protected:
|
|
||||||
typedef Common::String String;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ bool Engine::canLoadGameStateCurrently() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Engine::saveGameState(int slot) {
|
int Engine::saveGameState(int slot, const char *desc) {
|
||||||
// Do nothing by default
|
// Do nothing by default
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a game state.
|
* Load a game state.
|
||||||
|
* @param slot the slot from which a savestate should be loaded
|
||||||
* @return returns 0 on success, anything else indicates failure
|
* @return returns 0 on success, anything else indicates failure
|
||||||
|
*
|
||||||
* @todo define proper error values
|
* @todo define proper error values
|
||||||
*/
|
*/
|
||||||
virtual int loadGameState(int slot);
|
virtual int loadGameState(int slot);
|
||||||
|
@ -179,12 +181,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a game state.
|
* Save a game state.
|
||||||
|
* @param slot the slot into which the savestate should be stored
|
||||||
|
* @param desc a description for the savestate, entered by the user
|
||||||
* @return returns 0 on success, anything else indicates failure
|
* @return returns 0 on success, anything else indicates failure
|
||||||
*
|
*
|
||||||
* @todo define proper error values
|
* @todo define proper error values
|
||||||
* @todo actually we need to pass the user entered name to the engine
|
|
||||||
*/
|
*/
|
||||||
virtual int saveGameState(int slot);
|
virtual int saveGameState(int slot, const char *desc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether a game state can be saved.
|
* Indicates whether a game state can be saved.
|
||||||
|
|
|
@ -312,7 +312,7 @@ bool QueenEngine::canLoadOrSave() const {
|
||||||
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueenEngine::saveGameState(int slot, const char *desc) {
|
int QueenEngine::saveGameState(int slot, const char *desc) {
|
||||||
debug(3, "Saving game to slot %d", slot);
|
debug(3, "Saving game to slot %d", slot);
|
||||||
char name[20];
|
char name[20];
|
||||||
makeGameStateName(slot, name);
|
makeGameStateName(slot, name);
|
||||||
|
@ -351,6 +351,8 @@ void QueenEngine::saveGameState(int slot, const char *desc) {
|
||||||
} else {
|
} else {
|
||||||
warning("Can't create file '%s', game not saved", name);
|
warning("Can't create file '%s', game not saved", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QueenEngine::loadGameState(int slot) {
|
int QueenEngine::loadGameState(int slot) {
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
void update(bool checkPlayerInput = false);
|
void update(bool checkPlayerInput = false);
|
||||||
|
|
||||||
bool canLoadOrSave() const;
|
bool canLoadOrSave() const;
|
||||||
void saveGameState(int slot, const char *desc);
|
int saveGameState(int slot, const char *desc);
|
||||||
int loadGameState(int slot);
|
int loadGameState(int slot);
|
||||||
void makeGameStateName(int slot, char *buf) const;
|
void makeGameStateName(int slot, char *buf) const;
|
||||||
int getGameStateSlot(const char *filename) const;
|
int getGameStateSlot(const char *filename) const;
|
||||||
|
|
|
@ -701,7 +701,10 @@ bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScummEngine::hasFeature(EngineFeature f) const {
|
bool ScummEngine::hasFeature(EngineFeature f) const {
|
||||||
return (f == kSupportsRTL);
|
return
|
||||||
|
(f == kSupportsRTL) ||
|
||||||
|
(f == kSupportsLoadingDuringRuntime) ||
|
||||||
|
(f == kSupportsSavingDuringRuntime);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameList ScummMetaEngine::getSupportedGames() const {
|
GameList ScummMetaEngine::getSupportedGames() const {
|
||||||
|
|
|
@ -75,9 +75,31 @@ struct SaveInfoSection {
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
void ScummEngine::requestSave(int slot, const char *name, bool temporary) {
|
int ScummEngine::loadGameState(int slot) {
|
||||||
|
requestLoad(slot);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScummEngine::canLoadGameStateCurrently() {
|
||||||
|
// FIXME: For now always allow loading
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScummEngine::saveGameState(int slot, const char *desc) {
|
||||||
|
requestSave(slot, desc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScummEngine::canSaveGameStateCurrently() {
|
||||||
|
// FIXME: For now always allow saving
|
||||||
|
return true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScummEngine::requestSave(int slot, const char *name) {
|
||||||
_saveLoadSlot = slot;
|
_saveLoadSlot = slot;
|
||||||
_saveTemporaryState = temporary;
|
_saveTemporaryState = false;
|
||||||
_saveLoadFlag = 1; // 1 for save
|
_saveLoadFlag = 1; // 1 for save
|
||||||
assert(name);
|
assert(name);
|
||||||
strncpy(_saveLoadName, name, sizeof(_saveLoadName));
|
strncpy(_saveLoadName, name, sizeof(_saveLoadName));
|
||||||
|
|
|
@ -449,6 +449,12 @@ public:
|
||||||
virtual GUI::Debugger *getDebugger();
|
virtual GUI::Debugger *getDebugger();
|
||||||
virtual bool hasFeature(EngineFeature f) const;
|
virtual bool hasFeature(EngineFeature f) const;
|
||||||
virtual void syncSoundSettings();
|
virtual void syncSoundSettings();
|
||||||
|
|
||||||
|
virtual int loadGameState(int slot);
|
||||||
|
virtual bool canLoadGameStateCurrently();
|
||||||
|
virtual int saveGameState(int slot, const char *desc);
|
||||||
|
virtual bool canSaveGameStateCurrently();
|
||||||
|
|
||||||
virtual void pauseEngineIntern(bool pause);
|
virtual void pauseEngineIntern(bool pause);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -628,7 +634,7 @@ public:
|
||||||
bool getSavegameName(int slot, Common::String &desc);
|
bool getSavegameName(int slot, Common::String &desc);
|
||||||
void listSavegames(bool *marks, int num);
|
void listSavegames(bool *marks, int num);
|
||||||
|
|
||||||
void requestSave(int slot, const char *name, bool temporary = false);
|
void requestSave(int slot, const char *name);
|
||||||
void requestLoad(int slot);
|
void requestLoad(int slot);
|
||||||
|
|
||||||
// thumbnail + info stuff
|
// thumbnail + info stuff
|
||||||
|
|
|
@ -316,7 +316,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
||||||
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToucheEngine::saveGameState(int num, const char *description) {
|
int ToucheEngine::saveGameState(int num, const char *description) {
|
||||||
bool saveOk = false;
|
bool saveOk = false;
|
||||||
char gameStateFileName[64];
|
char gameStateFileName[64];
|
||||||
generateGameStateFileName(num, gameStateFileName, 63);
|
generateGameStateFileName(num, gameStateFileName, 63);
|
||||||
|
|
|
@ -497,7 +497,7 @@ protected:
|
||||||
|
|
||||||
void saveGameStateData(Common::WriteStream *stream);
|
void saveGameStateData(Common::WriteStream *stream);
|
||||||
void loadGameStateData(Common::ReadStream *stream);
|
void loadGameStateData(Common::ReadStream *stream);
|
||||||
bool saveGameState(int num, const char *description);
|
int saveGameState(int num, const char *description);
|
||||||
int loadGameState(int num);
|
int loadGameState(int num);
|
||||||
void readGameStateDescription(int num, char *description, int len);
|
void readGameStateDescription(int num, char *description, int len);
|
||||||
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
|
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue