MOHAWK: Implement "Show Map" feature for Myst ME

This commit is contained in:
Bastien Bouclet 2011-05-15 14:53:05 +02:00
parent d72037fb72
commit e0e28aaeb2
11 changed files with 52 additions and 1 deletions

View File

@ -80,7 +80,8 @@ enum {
kZipCmd = 'ZIPM',
kTransCmd = 'TRAN',
kWaterCmd = 'WATR',
kDropCmd = 'DROP'
kDropCmd = 'DROP',
kMapCmd = 'SMAP'
};
#ifdef ENABLE_MYST
@ -90,6 +91,12 @@ MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog
_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);
// Myst ME only has maps
if (_vm->getFeatures() & GF_ME)
_showMapButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("~S~how Map"), 0, kMapCmd);
else
_showMapButton = 0;
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);
}
@ -102,6 +109,10 @@ void MystOptionsDialog::open() {
_dropPageButton->setEnabled(_vm->_gameState->_globals.heldPage != 0);
if (_showMapButton)
_showMapButton->setEnabled(_vm->_scriptParser &&
_vm->_scriptParser->getMap());
_zipModeCheckbox->setState(_vm->_gameState->_globals.zipMode);
_transitionsCheckbox->setState(_vm->_gameState->_globals.transitions);
}
@ -118,6 +129,10 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
_vm->_needsPageDrop = true;
close();
break;
case kMapCmd:
_vm->_needsShowMap = true;
close();
break;
case GUI::kCloseCmd:
close();
break;

View File

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

View File

@ -341,12 +341,19 @@ Common::Error MohawkEngine_Myst::run() {
break;
case Common::KEYCODE_F5:
_needsPageDrop = false;
_needsShowMap = false;
runDialog(*_optionsDialog);
if (_needsPageDrop) {
dropPage();
_needsPageDrop = false;
}
if (_needsShowMap) {
_scriptParser->showMap();
_needsShowMap = false;
}
break;
default:
break;

View File

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

View File

@ -145,6 +145,7 @@ void MystScriptParser::setupCommonOpcodes() {
OPCODE(44, o_restoreMainCursor);
// Opcode 45 Not Present
OPCODE(46, o_soundWaitStop);
OPCODE(51, o_exitMap);
// Opcodes 47 to 99 Not Present
OPCODE(0xFFFF, NOP);
@ -922,4 +923,15 @@ void MystScriptParser::o_quit(uint16 op, uint16 var, uint16 argc, uint16 *argv)
_vm->quitGame();
}
void MystScriptParser::showMap() {
if (_vm->getCurCard() != getMap()) {
_savedMapCardId = _vm->getCurCard();
_vm->changeToCard(getMap(), true);
}
}
void MystScriptParser::o_exitMap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
_vm->changeToCard(_savedMapCardId, true);
}
} // End of namespace Mohawk

View File

@ -76,6 +76,9 @@ public:
virtual void toggleVar(uint16 var);
virtual bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 0; }
void showMap();
void animatedUpdate(uint16 argc, uint16 *argv, uint16 delay);
DECLARE_OPCODE(unknown);
@ -119,6 +122,7 @@ public:
DECLARE_OPCODE(o_saveMainCursor);
DECLARE_OPCODE(o_restoreMainCursor);
DECLARE_OPCODE(o_soundWaitStop);
DECLARE_OPCODE(o_exitMap);
// Used in multiple stacks
DECLARE_OPCODE(o_quit);
@ -144,6 +148,7 @@ protected:
MystResource *_invokingResource;
uint16 _savedCardId;
uint16 _savedMapCardId;
uint16 _savedCursorId;
int16 _tempVar; // Generic temp var used by the scripts
uint32 _startTime; // Generic start time used by the scripts

View File

@ -49,6 +49,8 @@ private:
void toggleVar(uint16 var);
bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 9932; }
DECLARE_OPCODE(o_bridgeToggle);
DECLARE_OPCODE(o_pipeExtend);
DECLARE_OPCODE(o_drawImageChangeCardAndVolume);

View File

@ -49,6 +49,8 @@ private:
void toggleVar(uint16 var);
bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 9931; }
void birdSing_run();
void elevatorRotation_run();
void elevatorGoMiddle_run();

View File

@ -49,6 +49,8 @@ private:
void toggleVar(uint16 var);
bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 9934; }
void towerRotationMap_run();
void libraryBookcaseTransform_run();
void generatorControlRoom_run();

View File

@ -50,6 +50,8 @@ private:
void toggleVar(uint16 var);
bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 9930; }
DECLARE_OPCODE(o_mazeRunnerMove);
DECLARE_OPCODE(o_mazeRunnerSoundRepeat);
DECLARE_OPCODE(o_soundReceiverSigma);

View File

@ -49,6 +49,8 @@ private:
void toggleVar(uint16 var);
bool setVarValue(uint16 var, uint16 value);
virtual uint16 getMap() { return 9933; }
DECLARE_OPCODE(o_pumpTurnOff);
DECLARE_OPCODE(o_brotherDoorOpen);
DECLARE_OPCODE(o_cabinBookMovie);