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