diff options
author | johndoe123 | 2015-12-05 00:27:30 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | 823ba2f462ff75370d1091b5c59dc950b815eed9 (patch) | |
tree | c0390e91b5034869de304423b906d8633e5f5945 /engines/illusions/menusystem.cpp | |
parent | 2de38e3469e85e56b6401a9c3cd97ead2249f67e (diff) | |
download | scummvm-rg350-823ba2f462ff75370d1091b5c59dc950b815eed9.tar.gz scummvm-rg350-823ba2f462ff75370d1091b5c59dc950b815eed9.tar.bz2 scummvm-rg350-823ba2f462ff75370d1091b5c59dc950b815eed9.zip |
ILLUSIONS: DUCKMAN: Implement load game from the game's menu system
- Fix pause/unpause opcodes
- Reduce debug output
Diffstat (limited to 'engines/illusions/menusystem.cpp')
-rw-r--r-- | engines/illusions/menusystem.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp index 01b92208d8..cb82e3343d 100644 --- a/engines/illusions/menusystem.cpp +++ b/engines/illusions/menusystem.cpp @@ -28,6 +28,9 @@ #include "illusions/screentext.h" #include "illusions/thread.h" #include "illusions/time.h" +#include "common/config-manager.h" +#include "common/translation.h" +#include "gui/saveload.h" namespace Illusions { @@ -105,11 +108,11 @@ void BaseMenuSystem::playSoundEffect14() { } void BaseMenuSystem::selectMenuChoiceIndex(uint choiceIndex) { - debug("choiceIndex: %d", choiceIndex); - debug("_menuChoiceOffset: %p", (void*)_menuChoiceOffset); + debug(0, "choiceIndex: %d", choiceIndex); + debug(0, "_menuChoiceOffset: %p", (void*)_menuChoiceOffset); if (choiceIndex > 0 && _menuChoiceOffset) { *_menuChoiceOffset = _menuChoiceOffsets[choiceIndex - 1]; - debug(0, "*_menuChoiceOffset: %04X", *_menuChoiceOffset); + debug(0, "*_menuChoiceOffset: %04X", *_menuChoiceOffset); } _vm->_threads->notifyId(_menuCallerThreadId); _menuCallerThreadId = 0; @@ -374,7 +377,7 @@ void BaseMenuSystem::closeMenu() { } void BaseMenuSystem::handleClick(uint menuItemIndex, const Common::Point &mousePos) { - debug("BaseMenuSystem::handleClick() menuItemIndex: %d", menuItemIndex); + debug(0, "BaseMenuSystem::handleClick() menuItemIndex: %d", menuItemIndex); if (menuItemIndex == 0) { playSoundEffect14(); @@ -497,6 +500,10 @@ void BaseMenuSystem::setMenuChoiceOffsets(MenuChoiceOffsets menuChoiceOffsets, i _menuChoiceOffset = menuChoiceOffset; } +void BaseMenuSystem::setSavegameSlotNum(int slotNum) { + _vm->_savegameSlotNum = slotNum; +} + void BaseMenuSystem::updateTimeOut(bool resetTimeOut) { if (!_isTimeOutEnabled) @@ -516,7 +523,6 @@ void BaseMenuSystem::updateTimeOut(bool resetTimeOut) { _timeOutStartTime = getCurrentTime(); _timeOutEndTime = _timeOutDuration + _timeOutStartTime; } else if (isTimerExpired(_timeOutStartTime, _timeOutEndTime)) { - debug("timeout reached"); _isTimeOutEnabled = false; selectMenuChoiceIndex(_timeOutMenuChoiceIndex); } @@ -590,4 +596,29 @@ void MenuActionEnterQueryMenu::execute() { _menuSystem->enterSubMenuById(_menuId); } +// MenuActionLoadGame + +MenuActionLoadGame::MenuActionLoadGame(BaseMenuSystem *menuSystem, uint choiceIndex) + : BaseMenuAction(menuSystem), _choiceIndex(choiceIndex) { +} + +void MenuActionLoadGame::execute() { + const EnginePlugin *plugin = NULL; + EngineMan.findGame(ConfMan.get("gameid"), &plugin); + GUI::SaveLoadChooser *dialog; + Common::String desc; + int slot; + + dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); + slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + + delete dialog; + + if (slot >= 0) { + _menuSystem->setSavegameSlotNum(slot); + _menuSystem->selectMenuChoiceIndex(_choiceIndex); + } + +} + } // End of namespace Illusions |