ScummVM API documentation
scriptopcodes.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 ILLUSIONS_SCRIPTOPCODES_H
23 #define ILLUSIONS_SCRIPTOPCODES_H
24 
25 #include "common/func.h"
26 
27 namespace Illusions {
28 
29 class IllusionsEngine;
30 class ScriptThread;
31 
32 struct OpCall {
33  byte _op;
34  byte _opSize;
35  uint32 _threadId;
36  uint32 _callerThreadId;
37  int16 _deltaOfs;
38  byte *_code;
39  int _result;
40  void skip(uint size);
41  byte readByte();
42  int16 readSint16();
43  uint32 readUint32();
44 };
45 
47 
49 public:
51  virtual ~ScriptOpcodes();
52  void execOpcode(ScriptThread *scriptThread, OpCall &opCall);
53 protected:
54  IllusionsEngine *_vm;
55  ScriptOpcode *_opcodes[256];
56  Common::String _opcodeNames[256];
57  virtual void initOpcodes() {}
58  virtual void freeOpcodes() {}
59 };
60 
61 // Convenience macros
62 #define ARG_SKIP(x) opCall.skip(x);
63 #define ARG_BYTE(name) byte name = opCall.readByte(); debug(5, "ARG_BYTE(" #name " = %d)", name);
64 #define ARG_INT16(name) int16 name = opCall.readSint16(); debug(5, "ARG_INT16(" #name " = %d)", name);
65 #define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(5, "ARG_UINT32(" #name " = %08X)", name);
66 
67 } // End of namespace Illusions
68 
69 #endif // ILLUSIONS_SCRIPTOPCODES_H
Definition: str.h:59
Definition: actor.h:34
Definition: scriptopcodes.h:48
Definition: scriptthread.h:32
Definition: scriptopcodes.h:32
Definition: func.h:473
Definition: illusions.h:92