ScummVM API documentation
types.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 DIRECTOR_TYPES_H
23 #define DIRECTOR_TYPES_H
24 
25 namespace Director {
26 
27 #define CONTINUATION (0xAC)
28 
29 enum {
30  kFewFamesMaxCounter = 19,
31 };
32 
33 enum {
34  kShotColorDiffThreshold = 2,
35  kShotPercentPixelThreshold = 1
36 };
37 
38 #define kQuirksCacheArchive "quirks"
39 
40 enum MovieFlag {
41  kMovieFlagRemapPalettesWhenNeeded = (1 << 6),
42  kMovieFlagAllowOutdatedLingo = (1 << 8)
43 };
44 
45 enum CastType {
46  kCastTypeAny = -1,
47  kCastTypeNull = 0,
48  kCastBitmap = 1,
49  kCastFilmLoop = 2,
50  kCastText = 3,
51  kCastPalette = 4,
52  kCastPicture = 5,
53  kCastSound = 6,
54  kCastButton = 7,
55  kCastShape = 8,
56  kCastMovie = 9,
57  kCastDigitalVideo = 10,
58  kCastLingoScript = 11,
59  kCastRichText = 12,
60  kCastTransition = 14,
61 };
62 
63 enum ScriptType {
64  kNoneScript = -1,
65  kScoreScript = 0,
66  kCastScript = 1,
67  kMovieScript = 2,
68  kEventScript = 3,
69  kTestScript = 4,
70  kParentScript = 7,
71  kMaxScriptType = 7 // Sync with types.cpp:28, array scriptTypes[]
72 };
73 
74 enum EventHandlerSourceType {
75  kNoneHandler = 0,
76  kPrimaryHandler = 1,
77  kSpriteHandler = 2,
78  kCastHandler = 3,
79  kFrameHandler = 4,
80  kMovieHandler = 5
81 };
82 
83 enum ScriptFlag {
84  kScriptFlagUnused = (1 << 0x0),
85  kScriptFlagFuncsGlobal = (1 << 0x1),
86  kScriptFlagVarsGlobal = (1 << 0x2), // Occurs in event scripts (which have no local vars). Correlated with use of alternate global var opcodes.
87  kScriptFlagUnk3 = (1 << 0x3),
88  kScriptFlagFactoryDef = (1 << 0x4),
89  kScriptFlagUnk5 = (1 << 0x5),
90  kScriptFlagUnk6 = (1 << 0x6),
91  kScriptFlagUnk7 = (1 << 0x7),
92  kScriptFlagHasFactory = (1 << 0x8),
93  kScriptFlagEventScript = (1 << 0x9),
94  kScriptFlagEventScript2 = (1 << 0xa),
95  kScriptFlagUnkB = (1 << 0xb),
96  kScriptFlagUnkC = (1 << 0xc),
97  kScriptFlagUnkD = (1 << 0xd),
98  kScriptFlagUnkE = (1 << 0xe),
99  kScriptFlagUnkF = (1 << 0xf)
100 };
101 
102 enum ObjectType {
103  kNoneObj = 0,
104  kFactoryObj = 1 << 0,
105  kXObj = 1 << 1,
106  kScriptObj = 1 << 2,
107  kXtraObj = 1 << 3,
108  kAllObj = kFactoryObj | kXObj | kScriptObj | kXtraObj,
109  kWindowObj = 1 << 4,
110  kCastMemberObj = 1 << 5
111 };
112 
113 enum ShapeType {
114  kShapeRectangle = 1,
115  kShapeRoundRect = 2,
116  kShapeOval = 3,
117  kShapeLine = 4
118 };
119 
120 enum TextType {
121  kTextTypeAdjustToFit,
122  kTextTypeScrolling,
123  kTextTypeFixed
124 };
125 
126 enum TextAlignType {
127  kTextAlignRight = -1,
130 };
131 
132 enum TextFlag {
133  kTextFlagEditable = (1 << 0),
134  kTextFlagAutoTab = (1 << 1),
135  kTextFlagDoNotWrap = (1 << 2)
136 };
137 
138 enum ButtonType {
139  kTypeButton,
140  kTypeCheckBox,
141  kTypeRadio
142 };
143 
144 enum FrameRateType {
145  kFrameRateDefault = -1,
146  kFrameRateNormal = 0,
147  kFrameRateFastest = 1,
148  kFrameRateFixed = 2
149 };
150 
151 enum SpriteType {
152  kInactiveSprite = 0, // turns the sprite off
153  kBitmapSprite = 1,
154  kRectangleSprite = 2, // QuickDraw
155  kRoundedRectangleSprite = 3, // QuickDraw
156  kOvalSprite = 4, // QuickDraw
157  kLineTopBottomSprite = 5, // line from top left to bottom right
158  kLineBottomTopSprite = 6, // line from bottom left to top right
159  kTextSprite = 7,
160  kButtonSprite = 8,
161  kCheckboxSprite = 9,
162  kRadioButtonSprite = 10,
163  kPictSprite = 11, // Cast picture
164  kOutlinedRectangleSprite = 12, // QuickDraw
165  kOutlinedRoundedRectangleSprite = 13, // QuickDraw
166  kOutlinedOvalSprite = 14, // QuickDraw
167  kThickLineSprite = 15, // 2pt width line
168  kCastMemberSprite = 16, // Specified by cast member
169  kFilmLoopSprite = 17,
170  kDirMovieSprite = 18
171 };
172 
173 enum InkType {
174  kInkTypeCopy,
175  kInkTypeTransparent,
176  kInkTypeReverse,
177  kInkTypeGhost,
178  kInkTypeNotCopy,
179  kInkTypeNotTrans,
180  kInkTypeNotReverse,
181  kInkTypeNotGhost,
182  kInkTypeMatte,
183  kInkTypeMask,
184  //10-31 Not used (Lingo in a Nutshell)
185  kInkTypeBlend = 32,
186  kInkTypeAddPin,
187  kInkTypeAdd,
188  kInkTypeSubPin,
189  kInkTypeBackgndTrans,
190  kInkTypeLight,
191  kInkTypeSub,
192  kInkTypeDark
193 };
194 
195 // ID matches up to the fake cast member ID used by EventScript
196 enum LEvent {
197  kEventPrepareMovie, // 0
198  kEventStartMovie,
199  kEventStepMovie,
200  kEventStopMovie,
201 
202  kEventNew, // 4
203  kEventBeginSprite,
204  kEventEndSprite,
205 
206  kEventNone, // 7
207  kEventGeneric,
208  kEventEnterFrame,
209  kEventPrepareFrame,
210  kEventIdle,
211  kEventStepFrame,
212  kEventExitFrame,
213  kEventTimeout,
214 
215  kEventActivateWindow, // 15
216  kEventDeactivateWindow,
217  kEventMoveWindow,
218  kEventResizeWindow,
219  kEventOpenWindow,
220  kEventCloseWindow,
221  kEventZoomWindow,
222 
223  kEventKeyUp, // 22
224  kEventKeyDown,
225  kEventMouseUp,
226  kEventMouseDown,
227  kEventRightMouseUp,
228  kEventRightMouseDown,
229  kEventMouseEnter,
230  kEventMouseLeave,
231  kEventMouseUpOutSide,
232  kEventMouseWithin,
233 
234  kEventStartUp, // 32
235 
236  kEventMenuCallback // 33
237 };
238 
239 enum TransitionType {
240  kTransNone,
241  kTransWipeRight,
242  kTransWipeLeft,
243  kTransWipeDown,
244  kTransWipeUp,
245  kTransCenterOutHorizontal, // 5
246  kTransEdgesInHorizontal,
247  kTransCenterOutVertical,
248  kTransEdgesInVertical,
249  kTransCenterOutSquare,
250  kTransEdgesInSquare, // 10
251  kTransPushLeft,
252  kTransPushRight,
253  kTransPushDown,
254  kTransPushUp,
255  kTransRevealUp, // 15
256  kTransRevealUpRight,
257  kTransRevealRight,
258  kTransRevealDownRight,
259  kTransRevealDown,
260  kTransRevealDownLeft, // 20
261  kTransRevealLeft,
262  kTransRevealUpLeft,
263  kTransDissolvePixelsFast,
264  kTransDissolveBoxyRects,
265  kTransDissolveBoxySquares, // 25
266  kTransDissolvePatterns,
267  kTransRandomRows,
268  kTransRandomColumns,
269  kTransCoverDown,
270  kTransCoverDownLeft, // 30
271  kTransCoverDownRight,
272  kTransCoverLeft,
273  kTransCoverRight,
274  kTransCoverUp,
275  kTransCoverUpLeft, // 35
276  kTransCoverUpRight,
277  kTransVenetianBlind,
278  kTransCheckerboard,
279  kTransStripsBottomBuildLeft,
280  kTransStripsBottomBuildRight, // 40
281  kTransStripsLeftBuildDown,
282  kTransStripsLeftBuildUp,
283  kTransStripsRightBuildDown,
284  kTransStripsRightBuildUp,
285  kTransStripsTopBuildLeft, // 45
286  kTransStripsTopBuildRight,
287  kTransZoomOpen,
288  kTransZoomClose,
289  kTransVerticalBinds,
290  kTransDissolveBitsFast, // 50
291  kTransDissolvePixels,
292  kTransDissolveBits
293 };
294 
295 enum RenderMode {
296  kRenderModeNormal,
297  kRenderForceUpdate
298 };
299 
300 // TODO: Can there be any more built-in palette types?
301 enum PaletteType {
302  kClutSystemMac = -1,
303  kClutRainbow = -2,
304  kClutGrayscale = -3,
305  kClutPastels = -4,
306  kClutVivid = -5,
307  kClutNTSC = -6,
308  kClutMetallic = -7,
309  kClutSystemWin = -101,
310  kClutSystemWinD5 = -102
311 };
312 
313 enum {
314  kNumBuiltinTiles = 8
315 };
316 
317 enum DirectorCursor {
318  kCursorMouseDown,
319  kCursorMouseUp
320 };
321 
322 enum PlayState {
323  kPlayNotStarted,
324  kPlayLoaded,
325  kPlayStarted,
326  kPlayStopped,
327  kPlayPaused,
328  kPlayPausedAfterLoading,
329 };
330 
331 enum SymbolType {
332  VOIDSYM,
333  OPCODE,
334  CBLTIN, // builtin command
335  FBLTIN, // builtin function
336  HBLTIN, // builtin handler (can be called as either command or func)
337  KBLTIN, // builtin constant
338  FBLTIN_LIST, // builtin function w/list override check
339  HBLTIN_LIST, // builtin handler w/list override check
340  HANDLER // user-defined handler
341 };
342 
343 enum ChunkType {
344  kChunkChar,
345  kChunkWord,
346  kChunkItem,
347  kChunkLine
348 };
349 
350 enum FileVer {
351  kFileVer300 = 0x404,
352  kFileVer310 = 0x405,
353  kFileVer400 = 0x45B,
354  kFileVer404 = 0x45D,
355  kFileVer500 = 0x4B1,
356  kFileVer600 = 0x4C2,
357  kFileVer700 = 0x4C8,
358  kFileVer800 = 0x582,
359  kFileVer850 = 0x6A4,
360  kFileVer1000 = 0x73B,
361  kFileVer1100 = 0x781,
362  kFileVer1150 = 0x782,
363  kFileVer1200 = 0x79F
364 };
365 
366 enum DatumType {
367  ARGC,
368  ARGCNORET,
369  ARRAY,
370  CASTREF,
371  CASTLIBREF,
372  CHUNKREF,
373  FIELDREF,
374  FLOAT,
375  GLOBALREF,
376  INT,
377  LOCALREF,
378  MENUREF,
379  OBJECT,
380  PARRAY,
381  PICTUREREF,
382  POINT,
383  PROPREF,
384  RECT,
385  SPRITEREF,
386  STRING,
387  SYMBOL,
388  VARREF,
389  VOID,
390 };
391 
392 enum VarType {
393  kVarGeneric,
394  kVarArgument,
395  kVarProperty,
396  kVarInstance,
397  kVarGlobal,
398  kVarLocal
399 };
400 
401 enum LPPFlag {
402  kLPPNone = 0,
403  kLPPSimple = 1 << 0,
404  kLPPForceD2 = 1 << 1,
405  kLPPTrimGarbage = 1 << 2,
406 };
407 
408 struct CastMemberID {
409  int member;
410  int castLib;
411 
412  CastMemberID() : member(0), castLib(0) {}
413  CastMemberID(int memberID, int castLibID)
414  : member(memberID), castLib(castLibID) {}
415 
416  bool operator==(const CastMemberID &c) const {
417  return member == c.member && castLib == c.castLib;
418  }
419  bool operator!=(const CastMemberID &c) const {
420  return member != c.member || castLib != c.castLib;
421  }
422 
423  bool isNull() const { return member == 0 && castLib == 0; }
424 
425  Common::String asString() const;
426 
427  uint hash() const { return ((castLib & 0xffff) << 16) + (member & 0xffff); }
428 
429  CastMemberID fromMultiplex(int multiplexID) {
430  if (multiplexID < 0)
431  return CastMemberID(multiplexID, -1);
432  return CastMemberID(multiplexID % 0x20000, 1 + (multiplexID >> 17));
433  }
434 
435  int toMultiplex() {
436  if (castLib < 0)
437  return member;
438  return (member % 0x20000) + ((castLib - 1) << 17);
439  }
440 };
441 
442 enum CompareResult {
443  kCompareLess = 1 << 0,
444  kCompareEqual = 1 << 1,
445  kCompareGreater = 1 << 2,
446  kCompareError = 1 << 3,
447 };
448 
449 enum DebugDrawModes {
450  kDebugDrawCast = 1 << 0,
451  kDebugDrawFrame = 1 << 1,
452 };
453 
454 struct Datum;
455 struct PCell;
458 
459 const char *scriptType2str(ScriptType scr);
460 const char *castType2str(CastType type);
461 const char *spriteType2str(SpriteType type);
462 const char *inkType2str(InkType type);
463 
464 } // End of namespace Director
465 
466 namespace Common {
467 
468 template<>
469 struct Hash<Director::CastMemberID> {
470  uint operator()(const Director::CastMemberID &id) const {
471  return id.hash();
472  }
473 };
474 
475 } // End of namespace Common
476 
477 #endif
Center the text.
Definition: font.h:52
Definition: str.h:59
Align the text to the left.
Definition: font.h:51
RenderMode
Definition: rendermode.h:48
Definition: func.h:527
Definition: archive.h:35
Align the text to the right.
Definition: font.h:54
Definition: algorithm.h:29
Definition: lingo.h:130
Definition: lingo.h:218
Definition: types.h:408