mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 13:13:58 +00:00
MYST3: Add infrastructure for puzzle helpers
This commit is contained in:
parent
4272279a50
commit
abecdf9cbf
@ -23,6 +23,7 @@
|
||||
#include "engines/myst3/console.h"
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/inventory.h"
|
||||
#include "engines/myst3/script.h"
|
||||
#include "engines/myst3/variables.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
@ -15,6 +15,7 @@ MODULE_OBJS := \
|
||||
node.o \
|
||||
nodecube.o \
|
||||
nodeframe.o \
|
||||
puzzles.o \
|
||||
scene.o \
|
||||
script.o \
|
||||
variables.o
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "engines/engine.h"
|
||||
|
||||
#include "engines/myst3/console.h"
|
||||
#include "engines/myst3/database.h"
|
||||
#include "engines/myst3/myst3.h"
|
||||
#include "engines/myst3/nodecube.h"
|
||||
@ -39,6 +40,7 @@
|
||||
#include "engines/myst3/variables.h"
|
||||
#include "engines/myst3/cursor.h"
|
||||
#include "engines/myst3/inventory.h"
|
||||
#include "engines/myst3/script.h"
|
||||
|
||||
#include "graphics/jpeg.h"
|
||||
#include "graphics/conversion.h"
|
||||
|
@ -29,11 +29,9 @@
|
||||
#include "common/random.h"
|
||||
|
||||
#include "engines/myst3/archive.h"
|
||||
#include "engines/myst3/console.h"
|
||||
#include "engines/myst3/movie.h"
|
||||
#include "engines/myst3/node.h"
|
||||
#include "engines/myst3/scene.h"
|
||||
#include "engines/myst3/script.h"
|
||||
|
||||
namespace Graphics {
|
||||
struct Surface;
|
||||
@ -62,6 +60,7 @@ class HotSpot;
|
||||
class Cursor;
|
||||
class Inventory;
|
||||
class Database;
|
||||
class Script;
|
||||
struct NodeData;
|
||||
|
||||
typedef Common::SharedPtr<NodeData> NodePtr;
|
||||
|
39
engines/myst3/puzzles.cpp
Normal file
39
engines/myst3/puzzles.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM 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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/myst3/puzzles.h"
|
||||
#include "engines/myst3/myst3.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
Puzzles::Puzzles(Myst3Engine *vm) :
|
||||
_vm(vm) {
|
||||
}
|
||||
|
||||
Puzzles::~Puzzles() {
|
||||
}
|
||||
|
||||
void Puzzles::run(uint16 id, uint16 arg0, uint16 arg1, uint16 arg3) {
|
||||
warning("Puzzle %d is not implemented", id);
|
||||
}
|
||||
|
||||
} /* namespace Myst3 */
|
44
engines/myst3/puzzles.h
Normal file
44
engines/myst3/puzzles.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM 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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PUZZLES_H_
|
||||
#define PUZZLES_H_
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
class Myst3Engine;
|
||||
|
||||
class Puzzles {
|
||||
public:
|
||||
Puzzles(Myst3Engine *vm);
|
||||
virtual ~Puzzles();
|
||||
|
||||
void run(uint16 id, uint16 arg0 = 0, uint16 arg1 = 0, uint16 arg3 = 0);
|
||||
|
||||
private:
|
||||
Myst3Engine *_vm;
|
||||
};
|
||||
|
||||
} /* namespace Myst3 */
|
||||
#endif /* PUZZLES_H_ */
|
@ -26,12 +26,15 @@
|
||||
#include "engines/myst3/variables.h"
|
||||
#include "engines/myst3/cursor.h"
|
||||
#include "engines/myst3/inventory.h"
|
||||
#include "engines/myst3/puzzles.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
Script::Script(Myst3Engine *vm):
|
||||
_vm(vm) {
|
||||
|
||||
_puzzles = new Puzzles(_vm);
|
||||
|
||||
#define OP_0(op, x) _commands.push_back(Command(op, &Script::x, #x, 0))
|
||||
#define OP_1(op, x, type1) _commands.push_back(Command(op, &Script::x, #x, 1, type1))
|
||||
#define OP_2(op, x, type1, type2) _commands.push_back(Command(op, &Script::x, #x, 2, type1, type2))
|
||||
@ -161,6 +164,10 @@ Script::Script(Myst3Engine *vm):
|
||||
OP_3(185, drawFramesForVarEachTwoFrames, kVar, kValue, kValue );
|
||||
OP_3(186, drawFramesForVarStartEndVarEachTwoFrames, kVar, kVar, kVar );
|
||||
OP_1(187, runScript, kValue );
|
||||
OP_1(194, runPuzzle1, kValue );
|
||||
OP_2(195, runPuzzle2, kValue, kValue );
|
||||
OP_3(196, runPuzzle3, kValue, kValue, kValue );
|
||||
OP_4(197, runPuzzle4, kValue, kValue, kValue, kValue );
|
||||
|
||||
#undef OP_0
|
||||
#undef OP_1
|
||||
@ -171,6 +178,7 @@ Script::Script(Myst3Engine *vm):
|
||||
}
|
||||
|
||||
Script::~Script() {
|
||||
delete _puzzles;
|
||||
}
|
||||
|
||||
bool Script::run(const Common::Array<Opcode> *script) {
|
||||
@ -1522,4 +1530,28 @@ void Script::runScript(Context &c, const Opcode &cmd) {
|
||||
_vm->runScriptsFromNode(cmd.args[0], _vm->_vars->getLocationRoom());
|
||||
}
|
||||
|
||||
void Script::runPuzzle1(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Run puzzle helper %d", cmd.op, cmd.args[0]);
|
||||
|
||||
_puzzles->run(cmd.args[0]);
|
||||
}
|
||||
|
||||
void Script::runPuzzle2(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Run puzzle helper %d", cmd.op, cmd.args[0]);
|
||||
|
||||
_puzzles->run(cmd.args[0], cmd.args[1]);
|
||||
}
|
||||
|
||||
void Script::runPuzzle3(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Run puzzle helper %d", cmd.op, cmd.args[0]);
|
||||
|
||||
_puzzles->run(cmd.args[0], cmd.args[1], cmd.args[2]);
|
||||
}
|
||||
|
||||
void Script::runPuzzle4(Context &c, const Opcode &cmd) {
|
||||
debugC(kDebugScript, "Opcode %d: Run puzzle helper %d", cmd.op, cmd.args[0]);
|
||||
|
||||
_puzzles->run(cmd.args[0], cmd.args[1], cmd.args[2], cmd.args[3]);
|
||||
}
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
@ -28,6 +28,7 @@
|
||||
namespace Myst3 {
|
||||
|
||||
class Myst3Engine;
|
||||
class Puzzles;
|
||||
struct Opcode;
|
||||
|
||||
#define DECLARE_OPCODE(x) void x(Context &c, const Opcode &cmd)
|
||||
@ -80,6 +81,8 @@ private:
|
||||
};
|
||||
|
||||
Myst3Engine *_vm;
|
||||
Puzzles *_puzzles;
|
||||
|
||||
Common::Array<Command> _commands;
|
||||
|
||||
const Command &findCommand(uint16 op);
|
||||
@ -214,6 +217,11 @@ private:
|
||||
DECLARE_OPCODE(drawFramesForVarEachTwoFrames);
|
||||
DECLARE_OPCODE(drawFramesForVarStartEndVarEachTwoFrames);
|
||||
DECLARE_OPCODE(runScript);
|
||||
DECLARE_OPCODE(runPuzzle1);
|
||||
DECLARE_OPCODE(runPuzzle2);
|
||||
DECLARE_OPCODE(runPuzzle3);
|
||||
DECLARE_OPCODE(runPuzzle4);
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user