aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2010-12-01 15:24:54 +0000
committerMatthew Hoops2010-12-01 15:24:54 +0000
commit81209867a2eaa0cf9fa4cf0120c9cb6ef353e2fe (patch)
tree40ead0ee6894a1f99889c81146656960076cef93 /engines
parente5f2c235d307f14081812608345b963f62ccbe5d (diff)
downloadscummvm-rg350-81209867a2eaa0cf9fa4cf0120c9cb6ef353e2fe.tar.gz
scummvm-rg350-81209867a2eaa0cf9fa4cf0120c9cb6ef353e2fe.tar.bz2
scummvm-rg350-81209867a2eaa0cf9fa4cf0120c9cb6ef353e2fe.zip
MOHAWK: Split the demo slideshow opcodes into their own class
svn-id: r54705
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/module.mk1
-rw-r--r--engines/mohawk/myst.cpp4
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp23
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp86
-rw-r--r--engines/mohawk/myst_stacks/slides.h64
5 files changed, 155 insertions, 23 deletions
diff --git a/engines/mohawk/module.mk b/engines/mohawk/module.mk
index 7ca71c99ad..1d8153a5e7 100644
--- a/engines/mohawk/module.mk
+++ b/engines/mohawk/module.mk
@@ -29,6 +29,7 @@ MODULE_OBJS = \
myst_stacks/mechanical.o \
myst_stacks/myst.o \
myst_stacks/selenitic.o \
+ myst_stacks/slides.o \
myst_stacks/stoneship.o
# This module can be built as a plugin
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 27f248e819..eb3c20e478 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -45,6 +45,7 @@
#include "mohawk/myst_stacks/mechanical.h"
#include "mohawk/myst_stacks/myst.h"
#include "mohawk/myst_stacks/selenitic.h"
+#include "mohawk/myst_stacks/slides.h"
#include "mohawk/myst_stacks/stoneship.h"
namespace Mohawk {
@@ -395,6 +396,9 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) {
case kSeleniticStack:
_scriptParser = new MystScriptParser_Selenitic(this);
break;
+ case kDemoSlidesStack:
+ _scriptParser = new MystScriptParser_Slides(this);
+ break;
case kStoneshipStack:
_scriptParser = new MystScriptParser_Stoneship(this);
break;
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 547c432cf8..219aa65a1d 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -227,11 +227,6 @@ void MystScriptParser_Myst::opcode_100(uint16 op, uint16 var, uint16 argc, uint1
case kMakingOfStack:
_vm->_system->quit();
break;
- case kDemoSlidesStack:
- // TODO: Change to changeStack call?
- _vm->changeToStack(kDemoStack);
- _vm->changeToCard(2001, true);
- break;
default:
unknown(op, var, argc, argv);
break;
@@ -1034,10 +1029,6 @@ static struct {
uint16 imageBaseId;
uint16 soundDecrement;
uint16 soundIncrement;
-
- // Myst Demo slideshow variables
- uint16 cardId;
- uint32 lastCardTime;
} g_opcode200Parameters;
void MystScriptParser_Myst::opcode_200_run() {
@@ -1080,11 +1071,6 @@ void MystScriptParser_Myst::opcode_200_run() {
lastImageIndex = curImageIndex;
break;
- case kDemoSlidesStack:
- // Used on Cards...
- if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 2 * 1000)
- _vm->changeToCard(g_opcode200Parameters.cardId, true);
- break;
}
}
}
@@ -1143,15 +1129,6 @@ void MystScriptParser_Myst::opcode_200(uint16 op, uint16 var, uint16 argc, uint1
} else
unknown(op, var, argc, argv);
break;
- case kDemoSlidesStack:
- // Used on Cards...
- if (argc == 1) {
- g_opcode200Parameters.cardId = argv[0];
- g_opcode200Parameters.lastCardTime = _vm->_system->getMillis();
- g_opcode200Parameters.enabled = true;
- } else
- unknown(op, var, argc, argv);
- break;
default:
unknown(op, var, argc, argv);
break;
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
new file mode 100644
index 0000000000..cdc0db1560
--- /dev/null
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "mohawk/myst.h"
+#include "mohawk/graphics.h"
+#include "mohawk/myst_areas.h"
+#include "mohawk/sound.h"
+#include "mohawk/video.h"
+#include "mohawk/myst_stacks/slides.h"
+
+#include "gui/message.h"
+
+namespace Mohawk {
+
+// NOTE: Credits Start Card is 10000
+
+MystScriptParser_Slides::MystScriptParser_Slides(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+ setupOpcodes();
+}
+
+MystScriptParser_Slides::~MystScriptParser_Slides() {
+}
+
+#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &MystScriptParser_Slides::x, #x))
+
+void MystScriptParser_Slides::setupOpcodes() {
+ // "Stack-Specific" Opcodes
+ OPCODE(100, o_returnToMenu);
+
+ // "Init" Opcodes
+ OPCODE(200, o_setCardSwap);
+}
+
+#undef OPCODE
+
+void MystScriptParser_Slides::disablePersistentScripts() {
+ _cardSwapEnabled = false;
+}
+
+void MystScriptParser_Slides::runPersistentScripts() {
+ if (_cardSwapEnabled) {
+ // Used on Cards...
+ if (_vm->_system->getMillis() - _lastCardTime >= 2 * 1000)
+ _vm->changeToCard(_nextCardID, true);
+ }
+}
+
+void MystScriptParser_Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ // TODO: Change to changeStack call?
+ _vm->changeToStack(kDemoStack);
+ _vm->changeToCard(2001, true);
+}
+
+void MystScriptParser_Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ // Used on Cards...
+ if (argc == 1) {
+ _nextCardID = argv[0];
+ _lastCardTime = _vm->_system->getMillis();
+ _cardSwapEnabled = true;
+ } else
+ unknown(op, var, argc, argv);
+}
+
+} // End of namespace Mohawk
diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h
new file mode 100644
index 0000000000..7230eead25
--- /dev/null
+++ b/engines/mohawk/myst_stacks/slides.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef MYST_SCRIPTS_SLIDES_H
+#define MYST_SCRIPTS_SLIDES_H
+
+#include "common/scummsys.h"
+#include "common/util.h"
+#include "mohawk/myst_scripts.h"
+
+namespace Mohawk {
+
+#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, uint16 argc, uint16 *argv)
+
+class MohawkEngine_Myst;
+struct MystScriptEntry;
+
+class MystScriptParser_Slides : public MystScriptParser {
+public:
+ MystScriptParser_Slides(MohawkEngine_Myst *vm);
+ ~MystScriptParser_Slides();
+
+ void disablePersistentScripts();
+ void runPersistentScripts();
+
+private:
+ void setupOpcodes();
+
+ DECLARE_OPCODE(o_returnToMenu);
+
+ DECLARE_OPCODE(o_setCardSwap);
+
+ bool _cardSwapEnabled;
+ uint16 _nextCardID;
+ uint32 _lastCardTime;
+};
+
+} // End of namespace Mohawk
+
+#undef DECLARE_OPCODE
+
+#endif