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  kFileVer300 = 0x404,
362  kFileVer310 = 0x405,
363  kFileVer400 = 0x45B,
364  kFileVer404 = 0x45D,
365  kFileVer500 = 0x4B1,
366  kFileVer600 = 0x4C2,
367  kFileVer700 = 0x4C8,
368  kFileVer800 = 0x582,
369  kFileVer850 = 0x6A4,
370  kFileVer1000 = 0x73B,
371  kFileVer1100 = 0x781,
372  kFileVer1150 = 0x782,
373  kFileVer1200 = 0x79F
374 };
375 
376 enum DatumType {
377  ARGC,
378  ARGCNORET,
379  ARRAY,
380  CASTREF,
381  CASTLIBREF,
382  CHUNKREF,
383  FIELDREF,
384  FLOAT,
385  GLOBALREF,
386  INT,
387  LOCALREF,
388  MEDIA,
389  MENUREF,
390  OBJECT,
391  PARRAY,
392  PICTUREREF,
393  POINT,
394  PROPREF,
395  RECT,
396  SPRITEREF,
397  STRING,
398  SYMBOL,
399  VARREF,
400  VOID,
401 };
402 
403 enum VarType {
404  kVarGeneric,
405  kVarArgument,
406  kVarProperty,
407  kVarInstance,
408  kVarGlobal,
409  kVarLocal
410 };
411 
412 enum LPPFlag {
413  kLPPNone = 0,
414  kLPPSimple = 1 << 0,
415  kLPPForceD2 = 1 << 1,
416  kLPPTrimGarbage = 1 << 2,
417 };
418 
419 struct CastMemberID {
420  int member;
421  int castLib;
422 
423  CastMemberID() : member(0), castLib(0) {}
424  CastMemberID(int memberID, int castLibID)
425  : member(memberID), castLib(castLibID) {}
426 
427  bool operator==(const CastMemberID &c) const {
428  return member == c.member && castLib == c.castLib;
429  }
430  bool operator!=(const CastMemberID &c) const {
431  return member != c.member || castLib != c.castLib;
432  }
433 
434  bool isNull() const { return member == 0 && castLib == 0; }
435 
436  Common::String asString() const;
437 
438  uint hash() const { return ((castLib & 0xffff) << 16) + (member & 0xffff); }
439 
440  CastMemberID fromMultiplex(int multiplexID) {
441  if (multiplexID < 0)
442  return CastMemberID(multiplexID, -1);
443  return CastMemberID(multiplexID % 0x20000, 1 + (multiplexID >> 17));
444  }
445 
446  int toMultiplex() {
447  if (castLib < 0)
448  return member;
449  return (member % 0x20000) + ((castLib - 1) << 17);
450  }
451 };
452 
453 enum CompareResult {
454  kCompareLess = 1 << 0,
455  kCompareEqual = 1 << 1,
456  kCompareGreater = 1 << 2,
457  kCompareLessEqual = 1 << 3,
458  kCompareGreaterEqual = 1 << 4,
459  kCompareError = 1 << 5,
460 };
461 
462 enum DebugDrawModes {
463  kDebugDrawCast = 1 << 0,
464  kDebugDrawFrame = 1 << 1,
465 };
466 
467 struct Datum;
468 struct PCell;
471 
472 const char *scriptType2str(ScriptType scr);
473 const char *castType2str(CastType type);
474 const char *spriteType2str(SpriteType type);
475 const char *inkType2str(InkType type);
476 const char *symbolType2str(SymbolType type);
477 Common::String objectType2str(int fl);
478 \
479 enum CollisionTest {
480  kCollisionNo = 0,
481  kCollisionYes,
482  kCollisionHole,
483 };
484 
485 } // End of namespace Director
486 
487 namespace Common {
488 
489 template<>
490 struct Hash<Director::CastMemberID> {
491  uint operator()(const Director::CastMemberID &id) const {
492  return id.hash();
493  }
494 };
495 
496 template<>
497 struct Hash<Director::LEvent> {
498  uint operator()(const Director::LEvent &event) const {
499  return event;
500  }
501 };
502 
503 
504 } // End of namespace Common
505 
506 #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:419