ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 InstructionType {
28  kInstructionTypeEmpty = 0x0000,
29  kInstructionTypeFunctionCall = 0x0067,
30  kInstructionTypeOperand = 0x0066,
31  kInstructionTypeVariableRef = 0x0065
32 };
33 const char *instructionTypeToStr(InstructionType type);
34 
35 enum Opcode {
36  kOpcodeIfElse = 202,
37  kOpcodeAssignVariable = 203,
38  kOpcodeOr = 204,
39  kOpcodeNot = 205,
40  kOpcodeAnd = 206,
41  kOpcodeEquals = 207,
42  kOpcodeNotEquals = 208,
43  kOpcodeLessThan = 209,
44  kOpcodeGreaterThan = 210,
45  kOpcodeLessThanOrEqualTo = 211,
46  kOpcodeGreaterThanOrEqualTo = 212,
47  kOpcodeAdd = 213,
48  kOpcodeSubtract = 214,
49  kOpcodeMultiply = 215,
50  kOpcodeDivide = 216,
51  kOpcodeModulo = 217,
52  kOpcodeNegate = 218,
53  kOpcodeCallFunction = 219,
54  kOpcodeCallMethod = 220,
55  // This seems to appear at the start of a function to declare the number of
56  // local variables used in the function. It seems to be the `Declare`
57  // keyword. In the observed examples, the number of variables to create is
58  // given, then the next instructions are variable assignments for that number
59  // of variables.
60  kOpcodeDeclareVariables = 221,
61  kOpcodeWhile = 224,
62  kOpcodeReturn = 222,
63  kOpcodeUnk1 = 223,
64  kOpcodeCallFunctionInVariable = 225
65 };
66 const char *opcodeToStr(Opcode opcode);
67 
68 enum VariableScope {
69  kVariableScopeLocal = 1,
70  kVariableScopeParameter = 2,
71  kVariableScopeGlobal = 4
72 };
73 const char *variableScopeToStr(VariableScope scope);
74 
75 enum BuiltInFunction {
76  kUnk1Function = 10,
77  // TODO: Figure out if effectTransitionOnSync = 13 is consistent across titles?
78  kEffectTransitionFunction = 12, // PARAMS: 1
79  kEffectTransitionOnSyncFunction = 13,
80  kDrawingFunction = 37, // PARAMS: 5
81  // TODO: Figure out if TimeOfDay = 101 is consistent across titles.
82  kDebugPrintFunction = 180, // PARAMS: 1+
83  // TODO: Figure out code for DebugPrint.
84  // TODO: Figure out code for Quit.
85 };
86 const char *builtInFunctionToStr(BuiltInFunction function);
87 
88 enum BuiltInMethod {
89  // TODO: What object types does CursorSet apply to?
90  // Currently it's only in var_7be1_cursor_currentTool in
91  // IBM/Crayola.
92  kCursorSetMethod = 200, // PARAMS: 0
93  kSpatialHideMethod = 203, // PARAMS: 1
94  kSpatialMoveToMethod = 204, // PARAMS: 2
95  kSpatialZMoveToMethod = 216, // PARAMS: 1
96  kSpatialShowMethod = 202, // PARAMS: 1
97  kTimePlayMethod = 206, // PARAMS: 1
98  kTimeStopMethod = 207, // PARAMS: 0
99  kIsPlayingMethod = 372, // PARAMS: 0
100  kSetDissolveFactorMethod = 241, // PARAMS: 1
101  kSpatialCenterMoveToMethod = 230,
102 
103  // HOTSPOT METHODS.
104  kMouseActivateMethod = 210, // PARAMS: 1
105  kMouseDeactivateMethod = 211, // PARAMS: 0
106  kXPositionMethod = 233, // PARAMS: 0
107  kYPositionMethod = 234, // PARAMS: 0
108  kTriggerAbsXPositionMethod = 321, // PARAMS: 0
109  kTriggerAbsYPositionMethod = 322, // PARAMS: 0
110  kIsActiveMethod = 371, // PARAMS: 0
111 
112  // IMAGE METHODS.
113  kWidthMethod = 235, // PARAMS: 0
114  kHeightMethod = 236, // PARAMS: 0
115  kIsVisibleMethod = 269,
116 
117  // SPRITE METHODS.
118  kMovieResetMethod = 219, // PARAMS: 0
119  kSetSpriteFrameByIdMethod = 220, // PARAMS: 1
120  kSetCurrentClipMethod = 221, // PARAMS: 0-1
121 
122  // STAGE METHODS.
123  kSetWorldSpaceExtentMethod = 363, // PARAMS: 2
124  kSetBoundsMethod = 287, // PARAMS: 4
125 
126  // CAMERA METHODS.
127  kStopPanMethod = 350, // PARAMS: 0
128  kViewportMoveToMethod = 352, // PARAMS: 2
129  kYViewportPositionMethod = 357, // PARAMS: 0
130  kPanToMethod = 370, // PARAMS: 4
131 
132  // CANVAS METHODS.
133  kClearToPaletteMethod = 379, // PARAMS: 1
134 
135  // DOCUMENT METHODS.
136  kLoadContextMethod = 374, // PARAMS: 1
137  kReleaseContextMethod = 375, // PARAMS: 1
138  kBranchToScreenMethod = 201, // PARAMS: 1
139  kIsLoadedMethod = 376, // PARAMS: 1
140 
141  // PATH METHODS.
142  kSetDurationMethod = 262, // PARAMS: 1
143  kPercentCompleteMethod = 263,
144 
145  // TEXT METHODS.
146  kTextMethod = 290,
147  kSetTextMethod = 291,
148  kSetMaximumTextLengthMethod = 293, // PARAM: 1
149 
150  // COLLECTION METHODS.
151  // These aren't assets but arrays used in Media Script.
152  kIsEmptyMethod = 254, // PARAMS: 0
153  kEmptyMethod = 252, // PARAMS: 0
154  kAppendMethod = 247, // PARAMS: 1+
155  kGetAtMethod = 253, // PARAMS: 1
156  kCountMethod = 249, // PARAMS: 0
157  // Looks like this lets you call a method on all the items in a collection.
158  // Examples look like : var_7be1_collect_shapes.send(spatialHide);
159  kSendMethod = 257, // PARAMS: 1+. Looks like the first param is the function,
160  // Seeking seems to be finding the index where a certain item is.
161  // and the next params are any arguments you want to send.
162  kSeekMethod = 256, // PARAMS: 1
163  kSortMethod = 266, // PARAMS: 0
164  kDeleteAtMethod = 258, // PARAMS: 1
165  kJumbleMethod = 255, // PARAMS: 0
166  kDeleteFirstMethod = 250, // PARAMS: 0
167 
168  // PRINTER METHODS.
169  kOpenLensMethod = 346, // PARAMS: 0
170  kCloseLensMethod = 347, // PARAMS: 0
171 };
172 const char *builtInMethodToStr(BuiltInMethod method);
173 
174 enum EventType {
175  // TIMER EVENTS.
176  kTimerEvent = 5,
177 
178  // HOTSPOT EVENTS.
179  kMouseDownEvent = 6,
180  kMouseUpEvent = 7,
181  kMouseMovedEvent = 8,
182  kMouseEnteredEvent = 9,
183  kMouseExitedEvent = 10,
184  kKeyDownEvent = 13, // PARAMS: 1 - ASCII code.
185 
186  // SOUND EVENTS.
187  kSoundEndEvent = 14,
188  kSoundAbortEvent = 19,
189  kSoundFailureEvent = 20,
190  kSoundStoppedEvent = 29,
191  kSoundBeginEvent = 30,
192 
193  // MOVIE EVENTS.
194  kMovieEndEvent = 15,
195  kMovieAbortEvent = 21,
196  kMovieFailureEvent = 22,
197  kMovieStoppedEvent = 31,
198  kMovieBeginEvent = 32,
199 
200  //SPRITE EVENTS.
201  // Just "MovieEnd" in source.
202  kSpriteMovieEndEvent = 23,
203 
204  // SCREEN EVENTS.
205  kEntryEvent = 17,
206  kExitEvent = 27,
207 
208  // CONTEXT EVENTS.
209  kLoadCompleteEvent = 44, // PARAMS: 1 - Context ID
210 
211  // TEXT EVENTS.
212  kInputEvent = 37,
213  kErrorEvent = 38,
214 
215  // CAMERA EVENTS.
216  kPanAbortEvent = 43,
217  kPanEndEvent = 42,
218 
219  // PATH EVENTS.
220  kStepEvent = 28,
221  kPathStoppedEvent = 33,
222  kPathEndEvent = 16
223 };
224 const char *eventTypeToStr(EventType type);
225 
226 enum EventHandlerArgumentType {
227  kNullEventHandlerArgument = 0,
228  kAsciiCodeEventHandlerArgument = 1,
229  kTimeEventHandlerArgument = 3,
230  // TODO: This argument type Appears to happen with MovieStart
231  // and nowhere else. However, this event handler shouldn't even need an
232  // argument...
233  kUnk1EventHandlerArgument = 4,
234  kContextEventHandlerArgument = 5
235 };
236 const char *eventHandlerArgumentTypeToStr(EventHandlerArgumentType type);
237 
238 enum OperandType {
239  // This is an invalid type used for initialization only.
240  kOperandTypeEmpty = 0,
241 
242  // TODO: Figure out the difference between these two.
243  kOperandTypeLiteral1 = 151,
244  kOperandTypeLiteral2 = 153,
245  // TODO: Figure out the difference between these two.
246  kOperandTypeFloat1 = 152,
247  kOperandTypeFloat2 = 157,
248  kOperandTypeString = 154,
249  // TODO: This only seems to be used in effectTransition,
250  // as in effectTransition ( $FadeToPalette )
251  kOperandTypeDollarSignVariable = 155,
252  kOperandTypeAssetId = 156,
253  kOperandTypeVariableDeclaration = 158,
254  kOperandTypeFunction = 159,
255  kOperandTypeMethod = 160,
256  kOperandTypeCollection = 161
257 };
258 const char *operandTypeToStr(OperandType type);
259 
260 enum VariableType {
261  // This is an invalid type used for initialization only.
262  kVariableTypeEmpty = 0x0000,
263 
264  kVariableTypeFunction = 0x0008,
265  kVariableTypeCollection = 0x0007,
266  kVariableTypeString = 0x0006,
267  kVariableTypeAssetId = 0x0005,
268  kVariableTypeInt = 0x0004,
269  // These seem to be constants of some sort? This is what some of these
270  // IDs look like in PROFILE._ST:
271  // - $downEar 10026
272  // - $sitDown 10027
273  // Seems like these can also reference variables:
274  // - var_6c14_bool_FirstThingLev3 315
275  // - var_6c14_NextEncouragementSound 316
276  kVariableTypeUnk2 = 0x0003,
277  kVariableTypeBoolean = 0x0002,
278  kVariableTypeFloat = 0x0001
279 };
280 const char *variableTypeToStr(VariableType type);
281 
282 } // End of namespace MediaStation
283 
284 #endif
Definition: asset.h:33
EventType
Definition: events.h:49