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  kCastRTE = 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 SizeType {
139  kSizeNone,
140  kSizeSmallest,
141  kSizeSmall,
142  kSizeMedium,
143  kSizeLarge,
144  kSizeLargest
145 };
146 
147 enum ButtonType {
148  kTypeButton,
149  kTypeCheckBox,
150  kTypeRadio
151 };
152 
153 enum FrameRateType {
154  kFrameRateDefault = -1,
155  kFrameRateNormal = 0,
156  kFrameRateFastest = 1,
157  kFrameRateFixed = 2
158 };
159 
160 enum SpriteType {
161  kInactiveSprite = 0, // turns the sprite off
162  kBitmapSprite = 1,
163  kRectangleSprite = 2, // QuickDraw
164  kRoundedRectangleSprite = 3, // QuickDraw
165  kOvalSprite = 4, // QuickDraw
166  kLineTopBottomSprite = 5, // line from top left to bottom right
167  kLineBottomTopSprite = 6, // line from bottom left to top right
168  kTextSprite = 7,
169  kButtonSprite = 8,
170  kCheckboxSprite = 9,
171  kRadioButtonSprite = 10,
172  kPictSprite = 11, // Cast picture
173  kOutlinedRectangleSprite = 12, // QuickDraw
174  kOutlinedRoundedRectangleSprite = 13, // QuickDraw
175  kOutlinedOvalSprite = 14, // QuickDraw
176  kThickLineSprite = 15, // 2pt width line
177  kCastMemberSprite = 16, // Specified by cast member
178  kFilmLoopSprite = 17,
179  kDirMovieSprite = 18
180 };
181 
182 enum InkType {
183  kInkTypeCopy,
184  kInkTypeTransparent,
185  kInkTypeReverse,
186  kInkTypeGhost,
187  kInkTypeNotCopy,
188  kInkTypeNotTrans,
189  kInkTypeNotReverse,
190  kInkTypeNotGhost,
191  kInkTypeMatte,
192  kInkTypeMask,
193  //10-31 Not used (Lingo in a Nutshell)
194  kInkTypeBlend = 32,
195  kInkTypeAddPin,
196  kInkTypeAdd,
197  kInkTypeSubPin,
198  kInkTypeBackgndTrans,
199  kInkTypeLight,
200  kInkTypeSub,
201  kInkTypeDark
202 };
203 
204 enum LEvent {
205  kEventPrepareMovie,
206  kEventStartMovie,
207  kEventStepMovie,
208  kEventStopMovie,
209 
210  kEventNew,
211  kEventBeginSprite,
212  kEventEndSprite,
213 
214  kEventNone,
215  kEventGeneric,
216  kEventEnterFrame,
217  kEventPrepareFrame,
218  kEventIdle,
219  kEventStepFrame,
220  kEventExitFrame,
221  kEventTimeout,
222 
223  kEventActivateWindow,
224  kEventDeactivateWindow,
225  kEventMoveWindow,
226  kEventResizeWindow,
227  kEventOpenWindow,
228  kEventCloseWindow,
229 
230  kEventKeyUp,
231  kEventKeyDown,
232  kEventMouseUp,
233  kEventMouseDown,
234  kEventRightMouseUp,
235  kEventRightMouseDown,
236  kEventMouseEnter,
237  kEventMouseLeave,
238  kEventMouseUpOutSide,
239  kEventMouseWithin,
240 
241  kEventStartUp,
242 
243  kEventMenuCallback
244 };
245 
246 enum TransitionType {
247  kTransNone,
248  kTransWipeRight,
249  kTransWipeLeft,
250  kTransWipeDown,
251  kTransWipeUp,
252  kTransCenterOutHorizontal, // 5
253  kTransEdgesInHorizontal,
254  kTransCenterOutVertical,
255  kTransEdgesInVertical,
256  kTransCenterOutSquare,
257  kTransEdgesInSquare, // 10
258  kTransPushLeft,
259  kTransPushRight,
260  kTransPushDown,
261  kTransPushUp,
262  kTransRevealUp, // 15
263  kTransRevealUpRight,
264  kTransRevealRight,
265  kTransRevealDownRight,
266  kTransRevealDown,
267  kTransRevealDownLeft, // 20
268  kTransRevealLeft,
269  kTransRevealUpLeft,
270  kTransDissolvePixelsFast,
271  kTransDissolveBoxyRects,
272  kTransDissolveBoxySquares, // 25
273  kTransDissolvePatterns,
274  kTransRandomRows,
275  kTransRandomColumns,
276  kTransCoverDown,
277  kTransCoverDownLeft, // 30
278  kTransCoverDownRight,
279  kTransCoverLeft,
280  kTransCoverRight,
281  kTransCoverUp,
282  kTransCoverUpLeft, // 35
283  kTransCoverUpRight,
284  kTransVenetianBlind,
285  kTransCheckerboard,
286  kTransStripsBottomBuildLeft,
287  kTransStripsBottomBuildRight, // 40
288  kTransStripsLeftBuildDown,
289  kTransStripsLeftBuildUp,
290  kTransStripsRightBuildDown,
291  kTransStripsRightBuildUp,
292  kTransStripsTopBuildLeft, // 45
293  kTransStripsTopBuildRight,
294  kTransZoomOpen,
295  kTransZoomClose,
296  kTransVerticalBinds,
297  kTransDissolveBitsFast, // 50
298  kTransDissolvePixels,
299  kTransDissolveBits
300 };
301 
302 enum RenderMode {
303  kRenderModeNormal,
304  kRenderForceUpdate
305 };
306 
307 // TODO: Can there be any more built-in palette types?
308 enum PaletteType {
309  kClutSystemMac = -1,
310  kClutRainbow = -2,
311  kClutGrayscale = -3,
312  kClutPastels = -4,
313  kClutVivid = -5,
314  kClutNTSC = -6,
315  kClutMetallic = -7,
316  kClutSystemWin = -101,
317  kClutSystemWinD5 = -102
318 };
319 
320 enum {
321  kNumBuiltinTiles = 8
322 };
323 
324 enum DirectorCursor {
325  kCursorMouseDown,
326  kCursorMouseUp
327 };
328 
329 enum PlayState {
330  kPlayNotStarted,
331  kPlayLoaded,
332  kPlayStarted,
333  kPlayStopped,
334  kPlayPaused,
335  kPlayPausedAfterLoading,
336 };
337 
338 enum SymbolType {
339  VOIDSYM,
340  OPCODE,
341  CBLTIN, // builtin command
342  FBLTIN, // builtin function
343  HBLTIN, // builtin handler (can be called as either command or func)
344  KBLTIN, // builtin constant
345  FBLTIN_LIST, // builtin function w/list override check
346  HBLTIN_LIST, // builtin handler w/list override check
347  HANDLER // user-defined handler
348 };
349 
350 enum ChunkType {
351  kChunkChar,
352  kChunkWord,
353  kChunkItem,
354  kChunkLine
355 };
356 
357 enum FileVer {
358  kFileVer300 = 0x404,
359  kFileVer310 = 0x405,
360  kFileVer400 = 0x45B,
361  kFileVer404 = 0x45D,
362  kFileVer500 = 0x4B1,
363  kFileVer600 = 0x4C2,
364  kFileVer700 = 0x4C8,
365  kFileVer800 = 0x582,
366  kFileVer850 = 0x6A4,
367  kFileVer1000 = 0x73B,
368  kFileVer1100 = 0x781,
369  kFileVer1150 = 0x782,
370  kFileVer1200 = 0x79F
371 };
372 
373 enum DatumType {
374  ARGC,
375  ARGCNORET,
376  ARRAY,
377  CASTREF,
378  CASTLIBREF,
379  CHUNKREF,
380  FIELDREF,
381  FLOAT,
382  GLOBALREF,
383  INT,
384  LOCALREF,
385  MENUREF,
386  OBJECT,
387  PARRAY,
388  PICTUREREF,
389  POINT,
390  PROPREF,
391  RECT,
392  STRING,
393  SYMBOL,
394  VARREF,
395  VOID,
396 };
397 
398 enum VarType {
399  kVarGeneric,
400  kVarArgument,
401  kVarProperty,
402  kVarInstance,
403  kVarGlobal,
404  kVarLocal
405 };
406 
407 enum LPPFlag {
408  kLPPNone = 0,
409  kLPPSimple = 1 << 0,
410  kLPPForceD2 = 1 << 1,
411  kLPPTrimGarbage = 1 << 2,
412 };
413 
414 struct CastMemberID {
415  int member;
416  int castLib;
417 
418  CastMemberID() : member(0), castLib(0) {}
419  CastMemberID(int memberID, int castLibID)
420  : member(memberID), castLib(castLibID) {}
421 
422  bool operator==(const CastMemberID &c) const {
423  return member == c.member && castLib == c.castLib;
424  }
425  bool operator!=(const CastMemberID &c) const {
426  return member != c.member || castLib != c.castLib;
427  }
428 
429  bool isNull() const { return member == 0 && castLib == 0; }
430 
431  Common::String asString() const;
432 
433  uint hash() const { return ((castLib & 0xffff) << 16) + (member & 0xffff); }
434 };
435 
436 enum CompareResult {
437  kCompareLess = 1 << 0,
438  kCompareEqual = 1 << 1,
439  kCompareGreater = 1 << 2,
440  kCompareError = 1 << 3,
441 };
442 
443 enum DebugDrawModes {
444  kDebugDrawCast = 1 << 0,
445  kDebugDrawFrame = 1 << 1,
446 };
447 
448 struct Datum;
449 struct PCell;
452 
453 const char *scriptType2str(ScriptType scr);
454 const char *castType2str(CastType type);
455 const char *spriteType2str(SpriteType type);
456 const char *inkType2str(InkType type);
457 
458 } // End of namespace Director
459 
460 namespace Common {
461 
462 template<>
463 struct Hash<Director::CastMemberID> {
464  uint operator()(const Director::CastMemberID &id) const {
465  return id.hash();
466  }
467 };
468 
469 } // End of namespace Common
470 
471 #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:414