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