aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2011-05-14 19:26:33 +0200
committerBastien Bouclet2011-05-14 19:54:32 +0200
commitc7f3a4f578b86b54572500322cc55cf0893634c9 (patch)
treee7134eaa9149c81e0b750923950306048de54f3b
parent0127a888fb821a6d9ef761b460cbb541bbfc2650 (diff)
downloadscummvm-rg350-c7f3a4f578b86b54572500322cc55cf0893634c9.tar.gz
scummvm-rg350-c7f3a4f578b86b54572500322cc55cf0893634c9.tar.bz2
scummvm-rg350-c7f3a4f578b86b54572500322cc55cf0893634c9.zip
MOHAWK: Implement page drop button for Myst
-rw-r--r--engines/mohawk/dialogs.cpp10
-rw-r--r--engines/mohawk/dialogs.h1
-rw-r--r--engines/mohawk/myst.cpp41
-rw-r--r--engines/mohawk/myst.h3
4 files changed, 54 insertions, 1 deletions
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index eee5b152ee..22a9d2d6c6 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -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;
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index 5cadf95574..8aa9d0fbee 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -81,6 +81,7 @@ private:
MohawkEngine_Myst *_vm;
GUI::CheckboxWidget *_zipModeCheckbox;
GUI::CheckboxWidget *_transitionsCheckbox;
+ GUI::ButtonWidget *_dropPageButton;
};
#endif
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 44bfd16e12..4ee078cfc1 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -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
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index aeb0d4c83e..e12388373e 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -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();