ScummVM API documentation
scriptconstants.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 MEDIASTATION_MEDIASCRIPT_BUILTINS_H
23 #define MEDIASTATION_MEDIASCRIPT_BUILTINS_H
24 
25 namespace MediaStation {
26 
27 enum ExpressionType {
28  kExpressionTypeEmpty = 0x0000,
29  kExpressionTypeVariable = 0x0065,
30  kExpressionTypeValue = 0x0066,
31  kExpressionTypeOperation = 0x0067,
32 };
33 const char *expressionTypeToStr(ExpressionType type);
34 
35 enum Opcode {
36  kOpcodeIf = 201,
37  kOpcodeIfElse = 202,
38  kOpcodeAssignVariable = 203,
39  kOpcodeOr = 204,
40  kOpcodeXor = 205,
41  kOpcodeAnd = 206,
42  kOpcodeEquals = 207,
43  kOpcodeNotEquals = 208,
44  kOpcodeLessThan = 209,
45  kOpcodeGreaterThan = 210,
46  kOpcodeLessThanOrEqualTo = 211,
47  kOpcodeGreaterThanOrEqualTo = 212,
48  kOpcodeAdd = 213,
49  kOpcodeSubtract = 214,
50  kOpcodeMultiply = 215,
51  kOpcodeDivide = 216,
52  kOpcodeModulo = 217,
53  kOpcodeNegate = 218,
54  kOpcodeCallFunction = 219,
55  kOpcodeCallMethod = 220,
56  kOpcodeDeclareLocals = 221,
57  kOpcodeReturn = 222,
58  kOpcodeReturnNoValue = 223,
59  kOpcodeWhile = 224,
60  kOpcodeCallFunctionInVariable = 225, // IndirectCall
61  kOpcodeCallMethodInVariable = 226 // IndirectMsg
62 };
63 const char *opcodeToStr(Opcode opcode);
64 
65 enum VariableScope {
66  kVariableScopeLocal = 1,
67  kVariableScopeParameter = 2,
68  kVariableScopeIndirectParameter = 3,
69  kVariableScopeGlobal = 4
70 };
71 const char *variableScopeToStr(VariableScope scope);
72 
73 enum BuiltInFunction {
74  kUnk1Function = 10,
75  // TODO: Figure out if effectTransitionOnSync = 13 is consistent across titles?
76  kEffectTransitionFunction = 12, // PARAMS: 1
77  kEffectTransitionOnSyncFunction = 13,
78  kDrawingFunction = 37, // PARAMS: 5
79  // TODO: Figure out if TimeOfDay = 101 is consistent across titles.
80  kDebugPrintFunction = 180, // PARAMS: 1+
81  // TODO: Figure out code for DebugPrint.
82  // TODO: Figure out code for Quit.
83 };
84 const char *builtInFunctionToStr(BuiltInFunction function);
85 
86 enum BuiltInMethod {
87  kInvalidMethod = 0,
88  // TODO: What object types does CursorSet apply to?
89  // Currently it's only in var_7be1_cursor_currentTool in
90  // IBM/Crayola.
91  kCursorSetMethod = 200, // PARAMS: 0
92 
93  // SPATIAL ENTITY METHODS.
94  kSpatialHideMethod = 203, // PARAMS: 1
95  kSpatialMoveToMethod = 204, // PARAMS: 2
96  kSpatialMoveToByOffsetMethod = 205, // PARAMS: 2
97  kSpatialZMoveToMethod = 216, // PARAMS: 1
98  kSpatialShowMethod = 202, // PARAMS: 1
99  kTimePlayMethod = 206, // PARAMS: 1
100  kTimeStopMethod = 207, // PARAMS: 0
101  kIsPlayingMethod = 372, // PARAMS: 0
102  kSetDissolveFactorMethod = 241, // PARAMS: 1
103  kSpatialCenterMoveToMethod = 230,
104  kGetLeftXMethod = 233,
105  kGetTopYMethod = 234,
106  kGetWidthMethod = 235, // PARAMS: 0
107  kGetHeightMethod = 236, // PARAMS: 0
108  kGetCenterXMethod = 237,
109  kGetCenterYMethod = 238,
110  kGetZCoordinateMethod = 239,
111  kIsPointInsideMethod = 246,
112  kGetMouseXOffsetMethod = 264,
113  kGetMouseYOffsetMethod = 265,
114  kIsVisibleMethod = 269,
115 
116  // HOTSPOT METHODS.
117  kMouseActivateMethod = 210, // PARAMS: 1
118  kMouseDeactivateMethod = 211, // PARAMS: 0
119  kTriggerAbsXPositionMethod = 321, // PARAMS: 0
120  kTriggerAbsYPositionMethod = 322, // PARAMS: 0
121  kIsActiveMethod = 371, // PARAMS: 0
122 
123  // SPRITE METHODS.
124  kMovieResetMethod = 219, // PARAMS: 0
125  kSetCurrentClipMethod = 220, // PARAMS: 1
126  kIncrementFrameMethod = 221, // PARAMS: 0-1
127  kDecrementFrameMethod = 222, // PARAMS: 0-1
128  kGetCurrentClipIdMethod = 240, // PARAMS: 0
129 
130  // STAGE METHODS.
131  kSetWorldSpaceExtentMethod = 363, // PARAMS: 2
132  kSetBoundsMethod = 287, // PARAMS: 4
133 
134  // CAMERA METHODS.
135  kStopPanMethod = 350, // PARAMS: 0
136  kViewportMoveToMethod = 352, // PARAMS: 2
137  kYViewportPositionMethod = 357, // PARAMS: 0
138  kPanToMethod = 370, // PARAMS: 4
139 
140  // CANVAS METHODS.
141  kClearToPaletteMethod = 379, // PARAMS: 1
142 
143  // DOCUMENT METHODS.
144  kLoadContextMethod = 374, // PARAMS: 1
145  kReleaseContextMethod = 375, // PARAMS: 1
146  kBranchToScreenMethod = 201, // PARAMS: 1
147  kIsLoadedMethod = 376, // PARAMS: 1
148 
149  // PATH METHODS.
150  kSetDurationMethod = 262, // PARAMS: 1
151  kPercentCompleteMethod = 263,
152 
153  // TEXT METHODS.
154  kTextMethod = 290,
155  kSetTextMethod = 291,
156  kSetMaximumTextLengthMethod = 293, // PARAM: 1
157 
158  // COLLECTION METHODS.
159  // These are arrays used in Media Script.
160  kAppendMethod = 247, // PARAMS: 1+
161  kApplyMethod = 248, // PARAMS: 1+
162  kCountMethod = 249, // PARAMS: 0
163  kDeleteFirstMethod = 250, // PARAMS: 0
164  kDeleteLastMethod = 251, // PARAMS: 0
165  kEmptyMethod = 252, // PARAMS: 0
166  kGetAtMethod = 253, // PARAMS: 1
167  kIsEmptyMethod = 254, // PARAMS: 0
168  kJumbleMethod = 255, // PARAMS: 0
169  kSeekMethod = 256, // PARAMS: 1
170  kSendMethod = 257, // PARAMS: 1+
171  kDeleteAtMethod = 258, // PARAMS: 1
172  kInsertAtMethod = 259, // PARAMS: 2
173  kReplaceAtMethod = 260, // PARAMS: 2
174  kPrependListMethod = 261, // PARAMS: 1+
175  kSortMethod = 266, // PARAMS: 0
176 
177  // PRINTER METHODS.
178  kOpenLensMethod = 346, // PARAMS: 0
179  kCloseLensMethod = 347, // PARAMS: 0
180 };
181 const char *builtInMethodToStr(BuiltInMethod method);
182 
183 enum EventType {
184  // TIMER EVENTS.
185  kTimerEvent = 5,
186 
187  // HOTSPOT EVENTS.
188  kMouseDownEvent = 6,
189  kMouseUpEvent = 7,
190  kMouseMovedEvent = 8,
191  kMouseEnteredEvent = 9,
192  kMouseExitedEvent = 10,
193  kKeyDownEvent = 13, // PARAMS: 1 - ASCII code.
194 
195  // SOUND EVENTS.
196  kSoundEndEvent = 14,
197  kSoundAbortEvent = 19,
198  kSoundFailureEvent = 20,
199  kSoundStoppedEvent = 29,
200  kSoundBeginEvent = 30,
201 
202  // MOVIE EVENTS.
203  kMovieEndEvent = 15,
204  kMovieAbortEvent = 21,
205  kMovieFailureEvent = 22,
206  kMovieStoppedEvent = 31,
207  kMovieBeginEvent = 32,
208 
209  // SPRITE EVENTS.
210  // Just "MovieEnd" in source.
211  kSpriteMovieEndEvent = 23,
212 
213  // SCREEN EVENTS.
214  kEntryEvent = 17,
215  kExitEvent = 27,
216 
217  // CONTEXT EVENTS.
218  kLoadCompleteEvent = 44, // PARAMS: 1 - Context ID
219 
220  // TEXT EVENTS.
221  kInputEvent = 37,
222  kErrorEvent = 38,
223 
224  // CAMERA EVENTS.
225  kPanAbortEvent = 43,
226  kPanEndEvent = 42,
227 
228  // PATH EVENTS.
229  kStepEvent = 28,
230  kPathStoppedEvent = 33,
231  kPathEndEvent = 16
232 };
233 const char *eventTypeToStr(EventType type);
234 
235 enum OperandType {
236  kOperandTypeEmpty = 0,
237  kOperandTypeBool = 151,
238  kOperandTypeFloat = 152,
239  kOperandTypeInt = 153,
240  kOperandTypeString = 154,
241  kOperandTypeParamToken = 155,
242  kOperandTypeAssetId = 156,
243  kOperandTypeTime = 157,
244  kOperandTypeVariable = 158,
245  kOperandTypeFunctionId = 159,
246  kOperandTypeMethodId = 160,
247  kOperandTypeCollection = 161
248 };
249 const char *operandTypeToStr(OperandType type);
250 
251 enum ScriptValueType {
252  kScriptValueTypeEmpty = 0,
253  kScriptValueTypeFloat = 1,
254  kScriptValueTypeBool = 2,
255  kScriptValueTypeTime = 3,
256  kScriptValueTypeParamToken = 4,
257  kScriptValueTypeAssetId = 5,
258  kScriptValueTypeString = 6,
259  kScriptValueTypeCollection = 7,
260  kScriptValueTypeFunctionId = 8,
261  kScriptValueTypeMethodId = 9
262 };
263 const char *scriptValueTypeToStr(ScriptValueType type);
264 
265 } // End of namespace MediaStation
266 
267 #endif
Definition: asset.h:32
EventType
Definition: events.h:49