2010-12-01 15:24:54 +00:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-08-07 16:48:40 +02:00
|
|
|
#include "mohawk/cursors.h"
|
2010-12-01 15:24:54 +00:00
|
|
|
#include "mohawk/myst.h"
|
|
|
|
#include "mohawk/myst_areas.h"
|
2012-03-10 13:50:27 -05:00
|
|
|
#include "mohawk/myst_graphics.h"
|
2010-12-01 15:24:54 +00:00
|
|
|
#include "mohawk/sound.h"
|
|
|
|
#include "mohawk/video.h"
|
|
|
|
#include "mohawk/myst_stacks/slides.h"
|
|
|
|
|
2011-04-24 11:34:27 +03:00
|
|
|
#include "common/system.h"
|
2010-12-01 15:24:54 +00:00
|
|
|
#include "gui/message.h"
|
|
|
|
|
|
|
|
namespace Mohawk {
|
2011-02-15 21:24:05 +01:00
|
|
|
namespace MystStacks {
|
2010-12-01 15:24:54 +00:00
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
Slides::Slides(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
|
2010-12-01 15:24:54 +00:00
|
|
|
setupOpcodes();
|
2011-08-07 16:48:40 +02:00
|
|
|
_vm->_cursor->hideCursor();
|
2010-12-01 15:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
Slides::~Slides() {
|
2010-12-01 15:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Slides::x, #x))
|
2010-12-01 15:24:54 +00:00
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
void Slides::setupOpcodes() {
|
2010-12-01 15:24:54 +00:00
|
|
|
// "Stack-Specific" Opcodes
|
|
|
|
OPCODE(100, o_returnToMenu);
|
|
|
|
|
|
|
|
// "Init" Opcodes
|
|
|
|
OPCODE(200, o_setCardSwap);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef OPCODE
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
void Slides::disablePersistentScripts() {
|
2010-12-01 15:24:54 +00:00
|
|
|
_cardSwapEnabled = false;
|
|
|
|
}
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
void Slides::runPersistentScripts() {
|
2010-12-01 15:24:54 +00:00
|
|
|
if (_cardSwapEnabled) {
|
|
|
|
// Used on Cards...
|
2011-08-14 09:15:58 +02:00
|
|
|
if (_vm->_system->getMillis() > _nextCardTime) {
|
|
|
|
_vm->_gfx->fadeToBlack();
|
2011-08-15 08:52:11 +02:00
|
|
|
_vm->changeToCard(_nextCardID, false);
|
2011-08-14 09:15:58 +02:00
|
|
|
_vm->_gfx->fadeFromBlack();
|
|
|
|
}
|
2010-12-01 15:24:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
void Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
|
2011-08-14 09:15:58 +02:00
|
|
|
debugC(kDebugScript, "Opcode %d: Return to menu", op);
|
|
|
|
|
2011-08-07 15:36:26 +02:00
|
|
|
// Go to the information screens of the menu
|
|
|
|
_vm->changeToStack(kDemoStack, 2002, 0, 0);
|
2010-12-01 15:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-02-15 21:42:00 +01:00
|
|
|
void Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
|
2011-08-07 15:36:26 +02:00
|
|
|
_nextCardID = argv[0];
|
2011-08-14 09:15:58 +02:00
|
|
|
|
|
|
|
debugC(kDebugScript, "Opcode %d: Set next card %d", op, _nextCardID);
|
|
|
|
|
2011-08-07 15:36:26 +02:00
|
|
|
_nextCardTime = _vm->_system->getMillis() + 5000;
|
|
|
|
_cardSwapEnabled = true;
|
2010-12-01 15:24:54 +00:00
|
|
|
}
|
|
|
|
|
2011-02-15 21:24:05 +01:00
|
|
|
} // End of namespace MystStacks
|
2010-12-01 15:24:54 +00:00
|
|
|
} // End of namespace Mohawk
|