ScummVM API documentation
dcscript.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/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_DCSCRIPT_H
29#define WINTERMUTE_DCSCRIPT_H
30
31namespace Wintermute {
32
33#define SCRIPT_MAGIC 0xDEC0ADDE
34#define SCRIPT_VERSION 0x0102
35
36// value types
37typedef enum {
38 VAL_NULL,
39 VAL_STRING,
40 VAL_INT,
41 VAL_BOOL,
42 VAL_FLOAT,
43 VAL_OBJECT,
44 VAL_NATIVE,
45 VAL_VARIABLE_REF
46} TValType;
47
48
49// script states
50typedef enum {
51 SCRIPT_RUNNING,
52 SCRIPT_WAITING,
53 SCRIPT_SLEEPING,
54 SCRIPT_FINISHED,
55 SCRIPT_PERSISTENT,
56 SCRIPT_ERROR,
57 SCRIPT_PAUSED,
58 SCRIPT_WAITING_SCRIPT,
59 SCRIPT_THREAD_FINISHED
60} TScriptState;
61
62// opcodes
63typedef enum {
64 II_DEF_VAR = 0,
65 II_DEF_GLOB_VAR,
66 II_RET,
67 II_RET_EVENT,
68 II_CALL,
69 II_CALL_BY_EXP,
70 II_EXTERNAL_CALL,
71 II_SCOPE,
72 II_CORRECT_STACK,
73 II_CREATE_OBJECT,
74 II_POP_EMPTY,
75 II_PUSH_VAR,
76 II_PUSH_VAR_REF,
77 II_POP_VAR,
78 II_PUSH_VAR_THIS, // push current this on stack
79 II_PUSH_INT,
80 II_PUSH_BOOL,
81 II_PUSH_FLOAT,
82 II_PUSH_STRING,
83 II_PUSH_NULL,
84 II_PUSH_THIS_FROM_STACK,
85 II_PUSH_THIS,
86 II_POP_THIS,
87 II_PUSH_BY_EXP,
88 II_POP_BY_EXP,
89 II_JMP,
90 II_JMP_FALSE,
91 II_ADD,
92 II_SUB,
93 II_MUL,
94 II_DIV,
95 II_MODULO,
96 II_NOT,
97 II_AND,
98 II_OR,
99 II_CMP_EQ,
100 II_CMP_NE,
101 II_CMP_L,
102 II_CMP_G,
103 II_CMP_LE,
104 II_CMP_GE,
105 II_CMP_STRICT_EQ,
106 II_CMP_STRICT_NE,
107 II_DBG_LINE,
108 II_POP_REG1,
109 II_PUSH_REG1,
110 II_DEF_CONST_VAR
111} TInstruction;
112
113// operation code types
114typedef enum {
115 OPCODES_UNCHANGED = 0
116#ifdef ENABLE_FOXTAIL
117 ,
118 OPCODES_FOXTAIL_1_2_896,
119 OPCODES_FOXTAIL_1_2_902
120#endif
121} TOpcodesType;
122
123// external data types
124typedef enum {
125 TYPE_VOID = 0,
126 TYPE_BOOL,
127 TYPE_LONG,
128 TYPE_BYTE,
129 TYPE_STRING,
130 TYPE_FLOAT,
131 TYPE_DOUBLE,
132 TYPE_MEMBUFFER
133} TExternalType;
134
135
136// call types
137typedef enum {
138 CALL_STDCALL = 0,
139 CALL_CDECL,
140 CALL_THISCALL
141} TCallType;
142
143// element types
144typedef enum {
145 ELEMENT_STRING = 0
146} TElementType;
147
148} // End of namespace Wintermute
149
150#endif