22#ifndef RIVEN_SCRIPTS_H
23#define RIVEN_SCRIPTS_H
25#include "mohawk/riven_stack.h"
27#include "common/str-array.h"
28#include "common/ptr.h"
29#include "common/textconsole.h"
31#define DECLARE_OPCODE(x) void x(uint16 op, const ArgumentArray &args)
44 kMouseEnterScript = 3,
45 kMouseInsideScript = 4,
46 kMouseLeaveScript = 5,
52 kCardUpdateScript = 10
55enum RivenCommandType {
56 kRivenCommandDrawBitmap = 1,
57 kRivenCommandChangeCard = 2,
58 kRivenCommandPlayScriptSLST = 3,
59 kRivenCommandPlaySound = 4,
60 kRivenCommandSetVariable = 7,
61 kRivenCommandSwitch = 8,
62 kRivenCommandEnableHotspot = 9,
63 kRivenCommandDisableHotspot = 10,
64 kRivenCommandStopSound = 12,
65 kRivenCommandChangeCursor = 13,
66 kRivenCommandDelay = 14,
67 kRivenCommandRunExternal = 17,
68 kRivenCommandTransition = 18,
69 kRivenCommandRefreshCard = 19,
70 kRivenCommandBeginScreenUpdate = 20,
71 kRivenCommandApplyScreenUpdate = 21,
72 kRivenCommandIncrementVariable = 24,
73 kRivenCommandChangeStack = 27,
74 kRivenCommandDisableMovie = 28,
75 kRivenCommandDisableAllMovies = 29,
76 kRivenCommandEnableMovie = 31,
77 kRivenCommandPlayMovieBlocking = 32,
78 kRivenCommandPlayMovie = 33,
79 kRivenCommandStopMovie = 34,
80 kRivenCommandUnk36 = 36,
81 kRivenCommandFadeAmbientSounds = 37,
82 kRivenCommandStoreMovieOpcode = 38,
83 kRivenCommandActivatePLST = 39,
84 kRivenCommandActivateSLST = 40,
85 kRivenCommandActivateMLSTAndPlay = 41,
86 kRivenCommandActivateBLST = 43,
87 kRivenCommandActivateFLST = 44,
88 kRivenCommandZipMode = 45,
89 kRivenCommandActivateMLST = 46,
90 kRivenCommandTimer = 1001
93class MohawkEngine_Riven;
96class RivenScriptManager;
229 uint16 getStoredMovieOpcodeSlot() {
return _storedMovieOpcode.slot; }
230 uint32 getStoredMovieOpcodeTime() {
return _storedMovieOpcode.time; }
231 void setStoredMovieOpcode(
const StoredMovieOpcode &op);
232 void runStoredMovieOpcode();
233 void clearStoredMovieOpcode();
236 MohawkEngine_Riven *_vm;
239 bool _runningQueuedScripts;
240 bool _stoppingAllScripts;
242 StoredMovieOpcode _storedMovieOpcode;
258 virtual void dump(
byte tabs) = 0;
297 OpcodeProcRiven proc;
305 void activateMLST(
const MLSTRecord &mlst)
const;
307 DECLARE_OPCODE(empty) {
warning (
"Unknown Opcode %04x", op); }
310 DECLARE_OPCODE(drawBitmap);
311 DECLARE_OPCODE(switchCard);
312 DECLARE_OPCODE(playScriptSLST);
313 DECLARE_OPCODE(playSound);
314 DECLARE_OPCODE(setVariable);
315 DECLARE_OPCODE(enableHotspot);
316 DECLARE_OPCODE(disableHotspot);
317 DECLARE_OPCODE(stopSound);
318 DECLARE_OPCODE(changeCursor);
319 DECLARE_OPCODE(delay);
320 DECLARE_OPCODE(runExternalCommand);
321 DECLARE_OPCODE(transition);
322 DECLARE_OPCODE(refreshCard);
323 DECLARE_OPCODE(beginScreenUpdate);
324 DECLARE_OPCODE(applyScreenUpdate);
325 DECLARE_OPCODE(incrementVariable);
326 DECLARE_OPCODE(disableMovie);
327 DECLARE_OPCODE(disableAllMovies);
328 DECLARE_OPCODE(enableMovie);
329 DECLARE_OPCODE(playMovieBlocking);
330 DECLARE_OPCODE(playMovie);
331 DECLARE_OPCODE(stopMovie);
332 DECLARE_OPCODE(unk_36);
333 DECLARE_OPCODE(fadeAmbientSounds);
334 DECLARE_OPCODE(storeMovieOpcode);
335 DECLARE_OPCODE(activatePLST);
336 DECLARE_OPCODE(activateSLST);
337 DECLARE_OPCODE(activateMLSTAndPlay);
338 DECLARE_OPCODE(activateBLST);
339 DECLARE_OPCODE(activateFLST);
340 DECLARE_OPCODE(zipMode);
341 DECLARE_OPCODE(activateMLST);
343 const RivenOpcode *_opcodes;
345 RivenCommandType _type;
346 ArgumentArray _arguments;
390 bool byStackId,
bool byStackCardId);
Definition: riven_scripts.h:252
virtual void applyCardPatches(uint32 globalId, int scriptType, uint16 hotspotId)
Definition: riven_scripts.h:267
virtual void dump(byte tabs)=0
virtual RivenCommandType getType() const =0
Definition: riven_scripts.h:108
void addCommand(RivenCommandPtr command)
void applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId, uint16 scriptType, uint16 hotspotId)
RivenScript & operator+=(const RivenScript &other)
void run(RivenScriptManager *scriptManager)
void dumpScript(byte tabs)
static const char * getTypeName(uint16 type)
Definition: riven_scripts.h:164
bool stoppingAllScripts() const
bool runningQueuedScripts() const
bool hasQueuedScripts() const
RivenScriptPtr readScriptFromData(uint16 *data, uint16 size)
RivenScriptPtr createScriptFromData(uint commandCount,...)
void runScript(const RivenScriptPtr &script, bool queue)
RivenScriptPtr createScriptWithCommand(RivenCommand *command)
RivenScriptList readScripts(Common::ReadStream *stream)
RivenScriptPtr readScript(Common::ReadStream *stream)
Definition: riven_scripts.h:280
RivenCommandType getType() const override
void dump(byte tabs) override
Definition: riven_scripts.h:387
void dump(byte tabs) override
RivenCommandType getType() const override
Definition: riven_scripts.h:357
void dump(byte tabs) override
RivenCommandType getType() const override
void applyCardPatches(uint32 globalId, int scriptType, uint16 hotspotId) override
Definition: riven_scripts.h:413
void dump(byte tabs) override
RivenCommandType getType() const override
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: algorithm.h:29
RivenScriptPtr & operator+=(RivenScriptPtr &lhs, const RivenScriptPtr &rhs)
Definition: riven_card.h:203
Definition: riven_scripts.h:223
Definition: riven_scripts.h:151