aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fry2018-04-18 07:04:47 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit783fd028937d1b5c16d945db4dbed3ba8ca307b2 (patch)
treed26b94691b2ebf7ccb23d55e4c38d6befb8bcd9e
parent95d6171b56eba42a86dad2a7e65341760cf10001 (diff)
downloadscummvm-rg350-783fd028937d1b5c16d945db4dbed3ba8ca307b2.tar.gz
scummvm-rg350-783fd028937d1b5c16d945db4dbed3ba8ca307b2.tar.bz2
scummvm-rg350-783fd028937d1b5c16d945db4dbed3ba8ca307b2.zip
Work on save support
-rw-r--r--engines/illusions/duckman/illusions_duckman.cpp5
-rw-r--r--engines/illusions/duckman/menusystem_duckman.cpp15
-rw-r--r--engines/illusions/duckman/menusystem_duckman.h4
-rw-r--r--engines/illusions/menusystem.cpp24
-rw-r--r--engines/illusions/menusystem.h8
5 files changed, 50 insertions, 6 deletions
diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp
index 2cd338b1db..199bae7eb3 100644
--- a/engines/illusions/duckman/illusions_duckman.cpp
+++ b/engines/illusions/duckman/illusions_duckman.cpp
@@ -1179,9 +1179,8 @@ bool IllusionsEngine_Duckman::loadSavegameFromScript(int16 slotNum, uint32 calli
}
bool IllusionsEngine_Duckman::saveSavegameFromScript(int16 slotNum, uint32 callingThreadId) {
- // TODO
- // const char *fileName = getSavegameFilename(slotNum);
- bool success = false;//savegame(fileName, _savegameDescription.c_str());
+ const char *fileName = getSavegameFilename(_savegameSlotNum);
+ bool success = savegame(fileName, "");//_savegameDescription.c_str()); //TODO
return success;
}
diff --git a/engines/illusions/duckman/menusystem_duckman.cpp b/engines/illusions/duckman/menusystem_duckman.cpp
index 7b1191612f..a1e500b1ff 100644
--- a/engines/illusions/duckman/menusystem_duckman.cpp
+++ b/engines/illusions/duckman/menusystem_duckman.cpp
@@ -79,6 +79,8 @@ BaseMenu *DuckmanMenuSystem::createMenuById(int menuId) {
return createQueryRestartMenu();
case kDuckmanQueryQuitMenu:
return createQueryQuitMenu();
+ case kDuckmanSaveCompleteMenu:
+ return createSaveCompleteMenu();
default:
error("DuckmanMenuSystem::createMenuById() Invalid menu id %d", menuId);
}
@@ -107,7 +109,7 @@ BaseMenu *DuckmanMenuSystem::createPauseMenu() {
menu->addText("-------------------");
menu->addMenuItem(new MenuItem("Resume", new MenuActionReturnChoice(this, 21)));
menu->addMenuItem(new MenuItem("Load Game", new MenuActionLoadGame(this, 1)));
- // TODO menu->addMenuItem(new MenuItem("Save Game", new MenuActionSaveGame(this, 11)));
+ menu->addMenuItem(new MenuItem("Save Game", new MenuActionSaveGame(this, 11)));
// TODO menu->addMenuItem(new MenuItem("Restart Game", new MenuActionEnterQueryMenu(this, kDuckmanQueryRestartMenu, 2)));
// TODO menu->addMenuItem(new MenuItem("Options", new MenuActionEnterMenu(this, kDuckmanOptionsMenu)));
menu->addMenuItem(new MenuItem("Quit Game", new MenuActionEnterQueryMenu(this, kDuckmanQueryQuitMenu, 23)));
@@ -127,14 +129,23 @@ BaseMenu *DuckmanMenuSystem::createQueryQuitMenu() {
return menu;
}
+BaseMenu *DuckmanMenuSystem::createSaveCompleteMenu() {
+ BaseMenu *menu = new BaseMenu(this, 0x00120003, 12, 17, 11, 27, 1);
+ menu->addText("Game Saved");
+ menu->addText("-------------");
+ menu->addMenuItem(new MenuItem("Continue", new MenuActionLeaveMenu(this)));
+ return menu;
+}
+
int DuckmanMenuSystem::convertRootMenuId(uint32 menuId) {
switch (menuId) {
case 0x180001:
return kDuckmanMainMenu;
case 0x180002:
return kDuckmanPauseMenu;
- /* Debug menus, not implemented
case 0x180005:
+ return kDuckmanSaveCompleteMenu;
+ /* Debug menus, not implemented
case 0x180006:
case 0x180007:
*/
diff --git a/engines/illusions/duckman/menusystem_duckman.h b/engines/illusions/duckman/menusystem_duckman.h
index bb43619acd..10a8a6eb0b 100644
--- a/engines/illusions/duckman/menusystem_duckman.h
+++ b/engines/illusions/duckman/menusystem_duckman.h
@@ -34,6 +34,7 @@ enum {
kDuckmanPauseMenu,
kDuckmanQueryQuitMenu,
kDuckmanQueryRestartMenu,
+ kDuckmanSaveCompleteMenu,
kDuckmanLastMenuIndex
};
@@ -56,8 +57,9 @@ public://protected:
BaseMenu *createLoadGameMenu();
BaseMenu *createOptionsMenu();
BaseMenu *createPauseMenu();
- BaseMenu *createQueryRestartMenu();
+ BaseMenu *createQueryRestartMenu();
BaseMenu *createQueryQuitMenu();
+ BaseMenu *createSaveCompleteMenu();
int convertRootMenuId(uint32 menuId);
virtual bool initMenuCursor();
virtual int getGameState();
diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp
index 829756cf2f..4fb0f18834 100644
--- a/engines/illusions/menusystem.cpp
+++ b/engines/illusions/menusystem.cpp
@@ -621,4 +621,28 @@ void MenuActionLoadGame::execute() {
}
+// MenuActionSaveGame
+
+ MenuActionSaveGame::MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIndex)
+ : BaseMenuAction(menuSystem), _choiceIndex(choiceIndex) {
+ }
+
+ void MenuActionSaveGame::execute() {
+ const Plugin *plugin = NULL;
+ EngineMan.findGame(ConfMan.get("gameid"), &plugin);
+ GUI::SaveLoadChooser *dialog;
+ Common::String desc;
+ int slot;
+
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
+ slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+
+ delete dialog;
+
+ if (slot >= 0) {
+ _menuSystem->setSavegameSlotNum(slot);
+ _menuSystem->selectMenuChoiceIndex(_choiceIndex);
+ }
+ _menuSystem->closeMenu();
+ }
} // End of namespace Illusions
diff --git a/engines/illusions/menusystem.h b/engines/illusions/menusystem.h
index 26a5931d18..26324c6786 100644
--- a/engines/illusions/menusystem.h
+++ b/engines/illusions/menusystem.h
@@ -239,6 +239,14 @@ protected:
uint _choiceIndex;
};
+class MenuActionSaveGame : public BaseMenuAction {
+public:
+ MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIndex);
+ virtual void execute();
+protected:
+ uint _choiceIndex;
+};
+
} // End of namespace Illusions
#endif // ILLUSIONS_MENUSYSTEM_H