aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2011-08-14 09:15:58 +0200
committerBastien Bouclet2011-08-14 09:18:20 +0200
commitdf381055c44452baf02a7384d50429d8717c432f (patch)
tree1a82e23ea1d0825a3efe7f9ce8417a3a82a70040 /engines/mohawk
parentff5b85e160424e6bce7a0e8a70f98b2d1e9ce642 (diff)
downloadscummvm-rg350-df381055c44452baf02a7384d50429d8717c432f.tar.gz
scummvm-rg350-df381055c44452baf02a7384d50429d8717c432f.tar.bz2
scummvm-rg350-df381055c44452baf02a7384d50429d8717c432f.zip
MOHAWK: Implement remaining Myst demo menu opcodes
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_stacks/demo.cpp98
-rw-r--r--engines/mohawk/myst_stacks/demo.h14
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp10
3 files changed, 70 insertions, 52 deletions
diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp
index 5788f4b3a3..c9e806655e 100644
--- a/engines/mohawk/myst_stacks/demo.cpp
+++ b/engines/mohawk/myst_stacks/demo.cpp
@@ -20,16 +20,20 @@
*
*/
+#include "mohawk/cursors.h"
+#include "mohawk/graphics.h"
#include "mohawk/myst.h"
#include "mohawk/myst_stacks/demo.h"
-#include "gui/message.h"
+#include "common/system.h"
namespace Mohawk {
namespace MystStacks {
Demo::Demo(MohawkEngine_Myst *vm) : Intro(vm) {
setupOpcodes();
+
+ _returnToMenuStep = 0;
}
Demo::~Demo() {
@@ -47,15 +51,12 @@ Demo::~Demo() {
void Demo::setupOpcodes() {
// "Stack-Specific" Opcodes
- OVERRIDE_OPCODE(100, opcode_100);
- OPCODE(101, opcode_101);
- OPCODE(102, opcode_102);
+ OVERRIDE_OPCODE(100, o_stopIntro);
+ OPCODE(101, o_fadeFromBlack);
+ OPCODE(102, o_fadeToBlack);
// "Init" Opcodes
- OVERRIDE_OPCODE(201, opcode_201);
-
- // "Exit" Opcodes
- OVERRIDE_OPCODE(300, opcode_300);
+ OVERRIDE_OPCODE(201, o_returnToMenu_init);
}
#undef OPCODE
@@ -64,61 +65,66 @@ void Demo::setupOpcodes() {
void Demo::disablePersistentScripts() {
Intro::disablePersistentScripts();
- _enabled201 = false;
+ _returnToMenuRunning = false;
}
void Demo::runPersistentScripts() {
Intro::runPersistentScripts();
- if (_enabled201) {
- // Used on Card 2001, 2002 and 2003
-
- // TODO: Fill in Function...
+ if (_returnToMenuRunning) {
+ returnToMenu_run();
}
}
-void Demo::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // TODO: Fill in Function...
+void Demo::o_stopIntro(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Unk", op);
+ // The original also seems to stop the movies. Not needed with this engine.
+ _vm->_gfx->fadeToBlack();
}
-void Demo::opcode_101(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- // Used on Card 2000, 2002 and 2003
- // Triggered by Click
- if (argc == 0) {
- // TODO: Fill in Logic.. Fade in?
- } else
- unknown(op, var, argc, argv);
+void Demo::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Fade from black", op);
+ _vm->_gfx->fadeFromBlack();
}
-void Demo::opcode_102(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- // Used on Card 2002 and 2003
- // Triggered by Click
- if (argc == 0) {
- // TODO: Fill in Logic.. Fade out?
- } else
- unknown(op, var, argc, argv);
+void Demo::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Fade to black", op);
+ _vm->_gfx->fadeToBlack();
}
-void Demo::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- // Used on Card 2001, 2002 and 2003
- if (argc == 0)
- _enabled201 = true;
- else
- unknown(op, var, argc, argv);
+void Demo::returnToMenu_run() {
+ uint32 time = _vm->_system->getMillis();
+
+ if (time < _returnToMenuNextTime)
+ return;
+
+ switch (_returnToMenuStep){
+ case 0:
+ _vm->_gfx->fadeToBlack();
+ _vm->changeToCard(2003, true);
+ _vm->_gfx->fadeFromBlack();
+
+ _returnToMenuStep++;
+ break;
+ case 1:
+ _vm->_gfx->fadeToBlack();
+ _vm->changeToCard(2001, true);
+ _vm->_gfx->fadeFromBlack();
+ _vm->_cursor->showCursor();
+
+ _returnToMenuStep++;
+ break;
+ default:
+ break;
+ }
}
+void Demo::o_returnToMenu_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Return to menu init", op);
-void Demo::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // Used on Card 2000
- varUnusedCheck(op, var);
-
- // TODO: Fill in Function...
+ // Used on Card 2001, 2002 and 2003
+ _returnToMenuNextTime = _vm->_system->getMillis() + 5000;
+ _returnToMenuRunning = true;
}
} // End of namespace MystStacks
diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h
index 4f8d68759b..c3e57cf7ae 100644
--- a/engines/mohawk/myst_stacks/demo.h
+++ b/engines/mohawk/myst_stacks/demo.h
@@ -46,15 +46,19 @@ public:
private:
void setupOpcodes();
- DECLARE_OPCODE(opcode_100);
- DECLARE_OPCODE(opcode_101);
- DECLARE_OPCODE(opcode_102);
+ DECLARE_OPCODE(o_stopIntro);
+ DECLARE_OPCODE(o_fadeFromBlack);
+ DECLARE_OPCODE(o_fadeToBlack);
- DECLARE_OPCODE(opcode_201);
+ DECLARE_OPCODE(o_returnToMenu_init);
DECLARE_OPCODE(opcode_300);
- bool _enabled201;
+ bool _returnToMenuRunning;
+ uint16 _returnToMenuStep; // 42
+ uint32 _returnToMenuNextTime; // 6
+
+ void returnToMenu_run();
};
} // End of namespace MystStacks
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index e9bb91c84d..943cb90071 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -61,18 +61,26 @@ void Slides::disablePersistentScripts() {
void Slides::runPersistentScripts() {
if (_cardSwapEnabled) {
// Used on Cards...
- if (_vm->_system->getMillis() > _nextCardTime)
+ if (_vm->_system->getMillis() > _nextCardTime) {
+ _vm->_gfx->fadeToBlack();
_vm->changeToCard(_nextCardID, true);
+ _vm->_gfx->fadeFromBlack();
+ }
}
}
void Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Return to menu", op);
+
// Go to the information screens of the menu
_vm->changeToStack(kDemoStack, 2002, 0, 0);
}
void Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
_nextCardID = argv[0];
+
+ debugC(kDebugScript, "Opcode %d: Set next card %d", op, _nextCardID);
+
_nextCardTime = _vm->_system->getMillis() + 5000;
_cardSwapEnabled = true;
}