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#include "common/scummsys.h"
26
27namespace MediaStation {
28
29enum ExpressionType {
30 kExpressionTypeEmpty = 0x0000,
31 kExpressionTypeVariable = 0x0065,
32 kExpressionTypeValue = 0x0066,
33 kExpressionTypeOperation = 0x0067,
34};
35const char *expressionTypeToStr(ExpressionType type);
36
37enum Opcode {
38 kOpcodeIf = 0xC9,
39 kOpcodeIfElse = 0xCA,
40 kOpcodeAssignVariable = 0xCB,
41 kOpcodeOr = 0xCC,
42 kOpcodeXor = 0xCD,
43 kOpcodeAnd = 0xCE,
44 kOpcodeEquals = 0xCF,
45 kOpcodeNotEquals = 0xD0,
46 kOpcodeLessThan = 0xD1,
47 kOpcodeGreaterThan = 0xD2,
48 kOpcodeLessThanOrEqualTo = 0xD3,
49 kOpcodeGreaterThanOrEqualTo = 0xD4,
50 kOpcodeAdd = 0xD5,
51 kOpcodeSubtract = 0xD6,
52 kOpcodeMultiply = 0xD7,
53 kOpcodeDivide = 0xD8,
54 kOpcodeModulo = 0xD9,
55 kOpcodeNegate = 0xDA,
56 kOpcodeCallFunction = 0xDB,
57 kOpcodeCallMethod = 0xDC,
58 kOpcodeDeclareLocals = 0xDD,
59 kOpcodeReturn = 0xDE,
60 kOpcodeReturnNoValue = 0xDF,
61 kOpcodeWhile = 0xE0,
62 kOpcodeCallFunctionInVariable = 0xE1, // IndirectCall
63 kOpcodeCallMethodInVariable = 0xE2 // IndirectMsg
64};
65const char *opcodeToStr(Opcode opcode);
66
67enum VariableScope {
68 kVariableScopeLocal = 0x1,
69 kVariableScopeParameter = 0x2,
70 kVariableScopeIndirectParameter = 0x3,
71 kVariableScopeGlobal = 0x4
72};
73const char *variableScopeToStr(VariableScope scope);
74
75enum BuiltInFunction {
76 kRandomFunction = 0x0A,
77 kTimeOfDayFunction = 0x0B,
78 kEffectTransitionFunction = 0x0C,
79 kEffectTransitionOnSyncFunction = 0x0D,
80 kPlatformFunction = 0x0E,
81 kSquareRootFunction = 0x0F,
82 kGetUniqueRandomFunction = 0x10,
83 kCurrentRunTimeFunction = 0x11,
84 kSetGammaCorrectionFunction = 0x12,
85 kGetDefaultGammaCorrectionFunction = 0x13,
86 kGetCurrentGammaCorrectionFunction = 0x14,
87 kSetAudioVolumeFunction = 0x17,
88 kGetAudioVolumeFunction = 0x18,
89 kSystemLanguagePreferenceFunction = 0x19,
90 kSetRegistryFunction = 0x1A,
91 kGetRegistryFunction = 0x1B,
92 kSetProfileFunction = 0x1C,
93 kMazeGenerateFunction = 0x1F,
94 kMazeApplyMoveMaskFunction = 0x20,
95 kMazeSolveFunction = 0x21,
96 kBeginTimedIntervalFunction = 0x22,
97 kEndTimedIntervalFunction = 0x23,
98 kCheckersFunction = 0x24, // Hercules
99 kDrawingFunction = 0x25, // IBM/Crayola
100 kMoveSophieFunction = 0x44c, // Puzzle Castle
101
102 // Early engine versions (like for Lion King and such), had different opcodes
103 // for some functions, even though the functions were the same. So those are
104 // defined here.
105 kLegacy_RandomFunction = 0x64,
106 kLegacy_TimeOfDayFunction = 0x65,
107 kLegacy_EffectTransitionFunction = 0x66,
108 kLegacy_EffectTransitionOnSyncFunction = 0x67,
109 kLegacy_PlatformFunction = 0x68,
110 kLegacy_SquareRootFunction = 0x69,
111 kLegacy_GetUniqueRandomFunction = 0x6A,
112 kLegacy_GetCurrentRunTimeFunction = 0x6B,
113 kLegacy_SetGammaCorrectionFunction = 0xAA,
114 kLegacy_GetDefaultGammaCorrectionFunction = 0xAB,
115 kLegacy_GetCurrentGammaCorrectionFunction = 0xAC,
116 kLegacy_DebugPrintFunction = 0xB4,
117 kLegacy_SetAudioVolumeFunction = 0xBE,
118 kLegacy_GetAudioVolumeFunction = 0xBF,
119 kLegacy_SystemLanguagePreferenceFunction = 0xC8,
120};
121const char *builtInFunctionToStr(uint function);
122
123enum BuiltInMethod {
124 kInvalidMethod = 0,
125 kSpatialHideMethod = 0xCB,
126 kSpatialMoveToMethod = 0xCC,
127 kSpatialMoveToByOffsetMethod = 0xCD,
128 kSpatialZMoveToMethod = 0xD8,
129 kSpatialShowMethod = 0xCA,
130 kTimePlayMethod = 0xCE,
131 kTimeStopMethod = 0xCF,
132 kTimePauseMethod = 0xD0,
133 kTimeResumeMethod = 0xD1,
134 kIsPlayingMethod = 0x174,
135 kSetDissolveFactorMethod = 0xF1,
136 kSpatialCenterMoveToMethod = 0xE6,
137 kGetLeftXMethod = 0xE9,
138 kGetTopYMethod = 0xEA,
139 kGetWidthMethod = 0xEB,
140 kGetHeightMethod = 0xEC,
141 kGetCenterXMethod = 0xED,
142 kGetCenterYMethod = 0xEE,
143 kGetZCoordinateMethod = 0xEF,
144 kIsPointInsideMethod = 0xF6,
145 kGetMouseXOffsetMethod = 0x108,
146 kGetMouseYOffsetMethod = 0x109,
147 kIsVisibleMethod = 0x10D,
148 kSetMousePositionMethod = 0x129,
149 // It isn't clear what the difference is meant to be
150 // between these two, as the code looks the same for both.
151 kGetParallaxFactorXMethod1 = 0x16E,
152 kGetParallaxFactorXMethod2 = 0x17E,
153 kSetParallaxFactorMethod = 0x16F,
154 kSetParallaxFactorXMethod = 0x17F,
155 kGetParallaxFactorYMethod = 0x180,
156 kSetParallaxFactorYMethod = 0x181,
157 kStartCachingMethod = 0x113,
158 kIsCachingMethod = 0x114,
159 kIsPausedMethod = 0x175,
160
161 // STREAM MOVIE METHODS.
162 kStreamMovieSetProxyZIndex = 0x10B,
163 kStreamMovieGetProxyZIndex = 0x10C,
164 kStreamMovieMoveProxyToStageMethod = 0x17C,
165 kStreamMovieMoveProxyToRootStageMethod = 0x17D,
166
167 // HOTSPOT METHODS.
168 // NOTE: IDs 0xD2 and 0xD3 seem to be double-assigned
169 // between two hotspot methods and two stage methods.
170 kMouseActivateMethod = 0xD2,
171 kMouseDeactivateMethod = 0xD3,
172 kTriggerAbsXPositionMethod = 0x141,
173 kTriggerAbsYPositionMethod = 0x142,
174 kIsActiveMethod = 0x173,
175
176 // SPRITE METHODS.
177 kMovieResetMethod = 0xDB,
178 kSetCurrentClipMethod = 0xDC,
179 kIncrementFrameMethod = 0xDD,
180 kDecrementFrameMethod = 0xDE,
181 kGetCurrentClipIdMethod = 0xF0,
182
183 // STAGE METHODS.
184 // NOTE: IDs 0xD2 and 0xD3 seem to be double-assigned
185 // between two hotspot methods and two stage methods.
186 kAddActorToStageMethod = 0xD2,
187 kAddActorToStageMethod2 = 0x170,
188 kRemoveActorFromStageMethod = 0xD3,
189 kRemoveActorFromStageMethod2 = 0x171,
190 kSetWorldSpaceExtentMethod = 0x16B,
191 kSetBoundsMethod = 0x11F,
192 kStageSetSizeMethod = 0x16B,
193 kStageGetWidthMethod = 0x16C,
194 kStageGetHeightMethod = 0x16D,
195
196 // CAMERA METHODS.
197 // NOTE: IDs 0x15A and 0x15B seem to be double-assigned
198 // between two camera methods and two printer methods.
199 kAddToStageMethod = 0x15A,
200 kRemoveFromStageMethod = 0x15B,
201 kAddedToStageMethod = 0x15C,
202 kStartPanMethod = 0x15D,
203 kStopPanMethod = 0x15E,
204 kIsPanningMethod = 0x15F,
205 kViewportMoveToMethod = 0x160,
206 kAdjustCameraViewportMethod = 0x161,
207 kAdjustCameraViewportSpatialCenterMethod = 0x162,
208 kSetCameraBoundsMethod = 0x163,
209 kXViewportPositionMethod = 0x164,
210 kYViewportPositionMethod = 0x165,
211 kPanToMethod = 0x172,
212
213 // CANVAS METHODS.
214 kCanvasClearToTransparencyMethod = 0x172,
215 kCanvasStampImageMethod = 0x179,
216 kCanvasCopyScreenToMethod = 0x17A,
217 kCanvasClearToPaletteMethod = 0x17B,
218
219 // DOCUMENT METHODS.
220 kDocumentBranchToScreenMethod = 0xC9,
221 kDocumentQuitMethod = 0xD9,
222 kIsLoadingMethod = 0x169,
223 kDocumentSetMultipleStreamsMethod = 0x174,
224 kDocumentSetMultipleSoundsMethod = 0x175,
225 kDocumentLoadContextMethod = 0x176,
226 kDocumentReleaseContextMethod = 0x177,
227 kDocumentContextIsLoadedMethod = 0x178,
228
229 // PATH METHODS.
230 kPathSetDurationMethod = 0x106,
231 kPathGetPercentCompleteMethod = 0x107,
232 kPathSetStartPointMethod = 0xf2,
233 kPathSetEndPointMethod = 0xf3,
234 kPathSetTotalStepsMethod = 0xf4,
235 kPathSetStepRateMethod = 0xf5,
236
237 // TEXT METHODS.
238 kTextSetEditableMethod = 0xD2,
239 kTextSetNonEditableMethod = 0xD3,
240 kTextGetFontActorMethod = 0x120,
241 kTextSetFontActorMethod = 0x121,
242 kTextGetTextMethod = 0x122,
243 kTextSetTextMethod = 0x123,
244 kTextGetMaxLengthMethod = 0x124,
245 kTextSetMaxLengthMethod = 0x125,
246 kGetLastPressedCharCodeMethod = 0x126,
247 kTextGetCursorPositionMethod = 0x127,
248 kTextSetCursorPositionMethod = 0x128,
249 kTextGetJustificationMethod = 0x14b,
250 kTextSetJustificationMethod = 0x14c,
251 kTextGetPositionMethod = 0x14d,
252 kTextSetPositionMethod = 0x14e,
253 kTextGetConstrainToWidthMethod = 0x150,
254 kTextSetConstrainToWidthMethod = 0x151,
255 kTextGetCursorIsVisibleMethod = 0x152,
256 kTextSetCursorIsVisibleMethod = 0x153,
257 kTextGetOverwriteModeMethod = 0x154,
258 kTextSetOverwriteModeMethod = 0x155,
259 kTextGetTranslatedCharCode = 0x156,
260 kTextAddAcceptedCharsMethod = 0x157,
261 kTextIsCharacterAcceptedMethod = 0x158,
262 kTextEnableDisableCharacterMethod = 0x159,
263 kTextIsEditableMethod = 0x173,
264
265 // COLLECTION METHODS.
266 // These are arrays used in Media Script.
267 kAppendMethod = 0xF7,
268 kApplyMethod = 0xF8,
269 kCountMethod = 0xF9,
270 kDeleteFirstMethod = 0xFA,
271 kDeleteLastMethod = 0xFB,
272 kEmptyMethod = 0xFC,
273 kGetAtMethod = 0xFD,
274 kIsEmptyMethod = 0xFE,
275 kJumbleMethod = 0xFF,
276 kSeekMethod = 0x100,
277 kSendMethod = 0x101,
278 kDeleteAtMethod = 0x102,
279 kInsertAtMethod = 0x103,
280 kReplaceAtMethod = 0x104,
281 kPrependListMethod = 0x105,
282 kSortMethod = 0x10A,
283
284 // PRINTER METHODS.
285 // NOTE: IDs 0x15A and 0x15B seem to be double-assigned
286 // between two camera methods and two printer methods.
287 kOpenLensMethod = 0x15A,
288 kCloseLensMethod = 0x15B,
289 kIsPrinterReadyMethod = 0x110,
290 kPrintActorsMethod = 0x111,
291 kPrintScreenMethod = 0x112,
292 kSetPortraitPrintMethod = 0x115,
293 kGetPortraitPrintMethod = 0x116,
294 kSetLeftPrintMarginMethod = 0x117,
295 kSetTopPrintMarginMethod = 0x118,
296 kSetRightPrintMarginMethod = 0x119,
297 kSetBottomPrintMarginMethod = 0x11a,
298 kGetLeftPrintMarginMethod = 0x11b,
299 kGetTopPrintMarginMethod = 0x11c,
300 kGetRightPrintMarginMethod = 0x11d,
301 kGetBottomPrintMarginMethod = 0x11e,
302
303 // CURSOR METHODS.
304 kCursorSetMethod = 0xC8,
305
306 // DISK IMAGE ACTOR METHODS.
307 kPreloadMethod = 0x166,
308 kPurgeMethod = 0x167,
309 kStopLoadMethod = 0x168,
310 kIsRectInMemoryMethod = 0x16A,
311
312 // MINIGAME ACTOR METHODS.
313 kMinigameResetMethod = 0xE2,
314 kMinigameActivateMethod = 0xE3,
315 kMinigameDeactivateMethod = 0xE4,
316 kDotGameHitMethod = 0xE5,
317
318 // STALKING ACTOR METHODS.
319 kStalkingStartZazuLookingMethod = 0xDF,
320 kStalkingStopZazuLookingMethod = 0xE0,
321 kStalkingGetZazuLookDirectionMethod = 0xE1,
322 kStalkingEnableAudio = 0xE7,
323 kStalkingDisableAudio = 0xE8,
324};
325const char *builtInMethodToStr(BuiltInMethod method);
326
327enum EventType {
328 kEventTypeInvalid = 0x00,
329 kDisplayAutoUpdateEvent = 0x02,
330 kDisplayEnableAutoUpdateEvent = 0x03,
331 kTimerServiceAlarmEvent = 0x04, // This schedules when the timer is supposed to fire.
332 kTimerScriptEvent = 0x05, // This is specifically a script timer event.
333 kMouseDownEvent = 0x06,
334 kMouseUpEvent = 0x07,
335 kMouseMovedEvent = 0x08,
336 kMouseEnteredEvent = 0x09,
337 kMouseExitedEvent = 0x0A,
338 kMouseEnterExitEvent = 0x0B,
339 kMouseOutOfFocusEvent = 0x0C,
340 kKeyDownEvent = 0x0D,
341 kSoundEndEvent = 0x0E,
342 kMovieEndEvent = 0x0F,
343 kPathEndEvent = 0x10,
344 kScreenEntryEvent = 0x11,
345 kScreenBranchEvent = 0x12,
346 kSoundAbortEvent = 0x13,
347 kSoundFailureEvent = 0x14,
348 kMovieAbortEvent = 0x15,
349 kMovieFailureEvent = 0x16,
350 kSpriteMovieEndEvent = 0x17,
351 kMinigameSuccessEvent = 0x18,
352 kMinigameDefeatEvent = 0x19,
353 kMinigameCrouchedEvent = 0x1A,
354 kScreenExitEvent = 0x1B,
355 kPathStepEvent = 0x1C,
356 kSoundStoppedEvent = 0x1D,
357 kSoundBeginEvent = 0x1E,
358 kMovieStoppedEvent = 0x1F,
359 kMovieBeginEvent = 0x20,
360 kPathStoppedEvent = 0x21,
361 kCachingFailureEvent = 0x22,
362 kCachingEndedEvent = 0x23,
363 kCachingStartedEvent = 0x24,
364 kTextInputEvent = 0x25,
365 kTextErrorEvent = 0x26,
366 kDiskImageActorStepEvent = 0x27,
367 kDiskImageActorEndEvent = 0x28,
368 kCameraPanStepEvent = 0x29,
369 kCameraPanEndEvent = 0x2A,
370 kCameraPanAbortEvent = 0x2B,
371 kContextLoadCompleteEvent = 0x2C,
372 kContextAlreadyLoadedEvent = 0x2D,
373 kContextReleaseCompleteEvent = 0x2E,
374 kContextAlreadyReleasedEvent = 0x2F,
375 kContextLoadStartEvent = 0x30,
376 kContextReleaseStartEvent = 0x31
377};
378const char *eventTypeToStr(EventType type);
379
380enum OperandType {
381 kOperandTypeEmpty = 0x0,
382 kOperandTypeBool = 0x97,
383 kOperandTypeFloat = 0x98,
384 kOperandTypeInt = 0x99,
385 kOperandTypeString = 0x9A,
386 kOperandTypeParamToken = 0x9B,
387 kOperandTypeActorId = 0x9C,
388 kOperandTypeTime = 0x9D,
389 kOperandTypeVariable = 0x9E,
390 kOperandTypeFunctionId = 0x9F,
391 kOperandTypeMethodId = 0xA0,
392 kOperandTypeCollection = 0xA1
393};
394const char *operandTypeToStr(OperandType type);
395
396enum ScriptValueType {
397 kScriptValueTypeEmpty = 0x0,
398 kScriptValueTypeFloat = 0x1,
399 kScriptValueTypeBool = 0x2,
400 kScriptValueTypeTime = 0x3,
401 kScriptValueTypeParamToken = 0x4,
402 kScriptValueTypeActorId = 0x5,
403 kScriptValueTypeString = 0x6,
404 kScriptValueTypeCollection = 0x7,
405 kScriptValueTypeFunctionId = 0x8,
406 kScriptValueTypeMethodId = 0x9
407};
408const char *scriptValueTypeToStr(ScriptValueType type);
409
410} // End of namespace MediaStation
411
412#endif
EventType
Definition: events.h:49