[Scummvm-cvs-logs] SF.net SVN: scummvm:[54705] scummvm/trunk/engines/mohawk
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Wed Dec 1 16:24:56 CET 2010
Revision: 54705
http://scummvm.svn.sourceforge.net/scummvm/?rev=54705&view=rev
Author: mthreepwood
Date: 2010-12-01 15:24:54 +0000 (Wed, 01 Dec 2010)
Log Message:
-----------
MOHAWK: Split the demo slideshow opcodes into their own class
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/module.mk
scummvm/trunk/engines/mohawk/myst.cpp
scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
Added Paths:
-----------
scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp
scummvm/trunk/engines/mohawk/myst_stacks/slides.h
Modified: scummvm/trunk/engines/mohawk/module.mk
===================================================================
--- scummvm/trunk/engines/mohawk/module.mk 2010-12-01 15:15:42 UTC (rev 54704)
+++ scummvm/trunk/engines/mohawk/module.mk 2010-12-01 15:24:54 UTC (rev 54705)
@@ -29,6 +29,7 @@
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
Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp 2010-12-01 15:15:42 UTC (rev 54704)
+++ scummvm/trunk/engines/mohawk/myst.cpp 2010-12-01 15:24:54 UTC (rev 54705)
@@ -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 @@
case kSeleniticStack:
_scriptParser = new MystScriptParser_Selenitic(this);
break;
+ case kDemoSlidesStack:
+ _scriptParser = new MystScriptParser_Slides(this);
+ break;
case kStoneshipStack:
_scriptParser = new MystScriptParser_Stoneship(this);
break;
Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp 2010-12-01 15:15:42 UTC (rev 54704)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp 2010-12-01 15:24:54 UTC (rev 54705)
@@ -227,11 +227,6 @@
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 @@
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 @@
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 @@
} 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;
Added: scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp (rev 0)
+++ scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp 2010-12-01 15:24:54 UTC (rev 54705)
@@ -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
Property changes on: scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: scummvm/trunk/engines/mohawk/myst_stacks/slides.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/slides.h (rev 0)
+++ scummvm/trunk/engines/mohawk/myst_stacks/slides.h 2010-12-01 15:24:54 UTC (rev 54705)
@@ -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
Property changes on: scummvm/trunk/engines/mohawk/myst_stacks/slides.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list