ScummVM API documentation
script_move.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TWINE_SCRIPTMOVE_H
23 #define TWINE_SCRIPTMOVE_H
24 
25 #include "common/scummsys.h"
26 #include "twine/scene/actor.h"
27 
28 namespace TwinE {
29 
31  int32 actorIdx;
32  ActorStruct *actor;
33  int32 numRepeatSample = 1;
34 
36 
37  MoveScriptContext(int32 _actorIdx, ActorStruct *_actor) : actorIdx(_actorIdx), actor(_actor), stream(actor->_ptrTrack, actor->_moveScriptSize) {
38  assert(actor->_offsetTrack >= 0);
39  stream.skip(actor->_offsetTrack);
40  }
41 
42  void undo(int32 bytes) {
43  assert(bytes >= 0);
44  // the additional 1 byte is for the opcode
45  stream.rewind(bytes + 1);
46  }
47 };
48 
52 typedef int32 ScriptMoveFunc(TwinEEngine *engine, MoveScriptContext &ctx);
53 
55  const char *name;
56  ScriptMoveFunc *function;
57 };
58 
59 class ScriptMove {
60 private:
61  TwinEEngine *_engine;
62  const ScriptMoveFunction* _functionMap;
63  size_t _functionMapSize;
64 
65 public:
66  static int32 mEMPTY(TwinEEngine *engine, MoveScriptContext &ctx);
67  static int32 mEND(TwinEEngine *engine, MoveScriptContext &ctx);
68  static int32 mNOP(TwinEEngine *engine, MoveScriptContext &ctx);
69  static int32 mBODY(TwinEEngine *engine, MoveScriptContext &ctx);
70  static int32 mANIM(TwinEEngine *engine, MoveScriptContext &ctx);
71  static int32 mGOTO_POINT(TwinEEngine *engine, MoveScriptContext &ctx);
72  static int32 mWAIT_ANIM(TwinEEngine *engine, MoveScriptContext &ctx);
73  static int32 mLOOP(TwinEEngine *engine, MoveScriptContext &ctx);
74  static int32 mANGLE(TwinEEngine *engine, MoveScriptContext &ctx);
75  static int32 mPOS_POINT(TwinEEngine *engine, MoveScriptContext &ctx);
76  static int32 mLABEL(TwinEEngine *engine, MoveScriptContext &ctx);
77  static int32 mGOTO(TwinEEngine *engine, MoveScriptContext &ctx);
78  static int32 mSTOP(TwinEEngine *engine, MoveScriptContext &ctx);
79  static int32 mGOTO_SYM_POINT(TwinEEngine *engine, MoveScriptContext &ctx);
80  static int32 mWAIT_NUM_ANIM(TwinEEngine *engine, MoveScriptContext &ctx);
81  static int32 mSAMPLE(TwinEEngine *engine, MoveScriptContext &ctx);
82  static int32 mGOTO_POINT_3D(TwinEEngine *engine, MoveScriptContext &ctx);
83  static int32 mSPEED(TwinEEngine *engine, MoveScriptContext &ctx);
84  static int32 mBACKGROUND(TwinEEngine *engine, MoveScriptContext &ctx);
85  static int32 mWAIT_NUM_SECOND(TwinEEngine *engine, MoveScriptContext &ctx);
86  static int32 mNO_BODY(TwinEEngine *engine, MoveScriptContext &ctx);
87  static int32 mBETA(TwinEEngine *engine, MoveScriptContext &ctx);
88  static int32 mOPEN_GENERIC(TwinEEngine *engine, MoveScriptContext &ctx, int32 angle);
89  static int32 mOPEN_LEFT(TwinEEngine *engine, MoveScriptContext &ctx);
90  static int32 mOPEN_RIGHT(TwinEEngine *engine, MoveScriptContext &ctx);
91  static int32 mOPEN_UP(TwinEEngine *engine, MoveScriptContext &ctx);
92  static int32 mOPEN_DOWN(TwinEEngine *engine, MoveScriptContext &ctx);
93  static int32 mCLOSE(TwinEEngine *engine, MoveScriptContext &ctx);
94  static int32 mWAIT_DOOR(TwinEEngine *engine, MoveScriptContext &ctx);
95  static int32 mSAMPLE_RND(TwinEEngine *engine, MoveScriptContext &ctx);
96  static int32 mSAMPLE_ALWAYS(TwinEEngine *engine, MoveScriptContext &ctx);
97  static int32 mSAMPLE_STOP(TwinEEngine *engine, MoveScriptContext &ctx);
98  static int32 mPLAY_FLA(TwinEEngine *engine, MoveScriptContext &ctx);
99  static int32 mREPEAT_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx);
100  static int32 mSIMPLE_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx);
101  static int32 mFACE_HERO(TwinEEngine *engine, MoveScriptContext &ctx);
102  static int32 mANGLE_RND(TwinEEngine *engine, MoveScriptContext &ctx);
103 
104 public:
105  ScriptMove(TwinEEngine *engine, const ScriptMoveFunction* functionMap, size_t entries);
106  virtual ~ScriptMove() {}
111  void doTrack(int32 actorIdx);
112 };
113 
114 } // namespace TwinE
115 
116 #endif
Definition: actor.h:143
Definition: memstream.h:394
Definition: script_move.h:30
Definition: script_move.h:59
Definition: twine.h:207
Definition: achievements_tables.h:27
virtual bool skip(uint32 offset)
Definition: stream.h:793
Definition: script_move.h:54