MOHAWK: Add a return to menu button to the dialog for the demo

This commit is contained in:
Bastien Bouclet 2011-08-14 09:17:14 +02:00
parent ef1f5d48fa
commit 72a9f06f93
4 changed files with 25 additions and 1 deletions

View file

@ -81,7 +81,8 @@ enum {
kTransCmd = 'TRAN', kTransCmd = 'TRAN',
kWaterCmd = 'WATR', kWaterCmd = 'WATR',
kDropCmd = 'DROP', kDropCmd = 'DROP',
kMapCmd = 'SMAP' kMapCmd = 'SMAP',
kMenuCmd = 'MENU'
}; };
#ifdef ENABLE_MYST #ifdef ENABLE_MYST
@ -97,6 +98,12 @@ MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog
else else
_showMapButton = 0; _showMapButton = 0;
// Myst demo only has a menu
if (_vm->getFeatures() & GF_DEMO)
_returnToMenuButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("~M~ain Menu"), 0, kMenuCmd);
else
_returnToMenuButton = 0;
new GUI::ButtonWidget(this, 95, 160, 120, 25, _("~O~K"), 0, GUI::kOKCmd); new GUI::ButtonWidget(this, 95, 160, 120, 25, _("~O~K"), 0, GUI::kOKCmd);
new GUI::ButtonWidget(this, 225, 160, 120, 25, _("~C~ancel"), 0, GUI::kCloseCmd); new GUI::ButtonWidget(this, 225, 160, 120, 25, _("~C~ancel"), 0, GUI::kCloseCmd);
} }
@ -113,6 +120,11 @@ void MystOptionsDialog::open() {
_showMapButton->setEnabled(_vm->_scriptParser && _showMapButton->setEnabled(_vm->_scriptParser &&
_vm->_scriptParser->getMap()); _vm->_scriptParser->getMap());
// Return to menu button is not enabled on the menu
if (_returnToMenuButton)
_returnToMenuButton->setEnabled(_vm->_scriptParser &&
_vm->getCurStack() != kDemoStack);
// Zip mode is disabled in the demo // Zip mode is disabled in the demo
if (_vm->getFeatures() & GF_DEMO) if (_vm->getFeatures() & GF_DEMO)
_zipModeCheckbox->setEnabled(false); _zipModeCheckbox->setEnabled(false);
@ -137,6 +149,10 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
_vm->_needsShowMap = true; _vm->_needsShowMap = true;
close(); close();
break; break;
case kMenuCmd:
_vm->_needsShowDemoMenu = true;
close();
break;
case GUI::kCloseCmd: case GUI::kCloseCmd:
close(); close();
break; break;

View file

@ -83,6 +83,7 @@ private:
GUI::CheckboxWidget *_transitionsCheckbox; GUI::CheckboxWidget *_transitionsCheckbox;
GUI::ButtonWidget *_dropPageButton; GUI::ButtonWidget *_dropPageButton;
GUI::ButtonWidget *_showMapButton; GUI::ButtonWidget *_showMapButton;
GUI::ButtonWidget *_returnToMenuButton;
}; };
#endif #endif

View file

@ -343,6 +343,7 @@ Common::Error MohawkEngine_Myst::run() {
case Common::KEYCODE_F5: case Common::KEYCODE_F5:
_needsPageDrop = false; _needsPageDrop = false;
_needsShowMap = false; _needsShowMap = false;
_needsShowDemoMenu = false;
runDialog(*_optionsDialog); runDialog(*_optionsDialog);
@ -355,6 +356,11 @@ Common::Error MohawkEngine_Myst::run() {
_scriptParser->showMap(); _scriptParser->showMap();
_needsShowMap = false; _needsShowMap = false;
} }
if (_needsShowDemoMenu) {
changeToStack(kDemoStack, 2002, 0, 0);
_needsShowDemoMenu = false;
}
break; break;
default: default:
break; break;

View file

@ -167,6 +167,7 @@ public:
bool _needsUpdate; bool _needsUpdate;
bool _needsPageDrop; bool _needsPageDrop;
bool _needsShowMap; bool _needsShowMap;
bool _needsShowDemoMenu;
MystView _view; MystView _view;
MystGraphics *_gfx; MystGraphics *_gfx;