mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 03:40:25 +00:00
Work on save support
This commit is contained in:
parent
95d6171b56
commit
783fd02893
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
*/
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user