MOHAWK: Implement page drop button for Myst

This commit is contained in:
Bastien Bouclet 2011-05-14 19:26:33 +02:00
parent 0127a888fb
commit c7f3a4f578
4 changed files with 54 additions and 1 deletions

View File

@ -79,7 +79,8 @@ void PauseDialog::handleKeyDown(Common::KeyState state) {
enum {
kZipCmd = 'ZIPM',
kTransCmd = 'TRAN',
kWaterCmd = 'WATR'
kWaterCmd = 'WATR',
kDropCmd = 'DROP'
};
#ifdef ENABLE_MYST
@ -87,6 +88,7 @@ enum {
MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) {
_zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, _("~Z~ip Mode Activated"), 0, kZipCmd);
_transitionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, _("~T~ransitions Enabled"), 0, kTransCmd);
_dropPageButton = new GUI::ButtonWidget(this, 15, 60, 100, 25, _("~D~rop Page"), 0, kDropCmd);
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);
@ -98,6 +100,8 @@ MystOptionsDialog::~MystOptionsDialog() {
void MystOptionsDialog::open() {
Dialog::open();
_dropPageButton->setEnabled(_vm->_gameState->_globals.heldPage != 0);
_zipModeCheckbox->setState(_vm->_gameState->_globals.zipMode);
_transitionsCheckbox->setState(_vm->_gameState->_globals.transitions);
}
@ -110,6 +114,10 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
case kTransCmd:
_vm->_gameState->_globals.transitions = _transitionsCheckbox->getState();
break;
case kDropCmd:
_vm->_needsPageDrop = true;
close();
break;
case GUI::kCloseCmd:
close();
break;

View File

@ -81,6 +81,7 @@ private:
MohawkEngine_Myst *_vm;
GUI::CheckboxWidget *_zipModeCheckbox;
GUI::CheckboxWidget *_transitionsCheckbox;
GUI::ButtonWidget *_dropPageButton;
};
#endif

View File

@ -340,7 +340,13 @@ Common::Error MohawkEngine_Myst::run() {
drawResourceRects();
break;
case Common::KEYCODE_F5:
_needsPageDrop = false;
runDialog(*_optionsDialog);
if (_needsPageDrop) {
dropPage();
_needsPageDrop = false;
}
break;
default:
break;
@ -1178,4 +1184,39 @@ bool MohawkEngine_Myst::canSaveGameStateCurrently() {
return false;
}
void MohawkEngine_Myst::dropPage() {
uint16 page = _gameState->_globals.heldPage;
bool whitePage = page == 13;
bool bluePage = page - 1 < 6;
bool redPage = page - 7 < 6;
// Drop page
_gameState->_globals.heldPage = 0;
// Redraw page area
if (whitePage && _gameState->_globals.currentAge == 2) {
redrawArea(41);
} else if (bluePage) {
if (page == 6) {
if (_gameState->_globals.currentAge == 2)
redrawArea(24);
} else {
redrawArea(103);
}
} else if (redPage) {
if (page == 12) {
if (_gameState->_globals.currentAge == 2)
redrawArea(25);
} else if (page == 10) {
if (_gameState->_globals.currentAge == 1)
redrawArea(35);
} else {
redrawArea(102);
}
}
setMainCursor(kDefaultMystCursor);
checkCursorHints();
}
} // End of namespace Mohawk

View File

@ -165,6 +165,7 @@ public:
bool _tweaksEnabled;
bool _needsUpdate;
bool _needsPageDrop;
MystView _view;
MystGraphics *_gfx;
@ -207,6 +208,8 @@ private:
bool _runExitScript;
void dropPage();
void loadCard();
void unloadCard();
void runInitScript();