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 ScriptFlag {
75  kScriptFlagUnused = (1 << 0x0),
76  kScriptFlagFuncsGlobal = (1 << 0x1),
77  kScriptFlagVarsGlobal = (1 << 0x2), // Occurs in event scripts (which have no local vars). Correlated with use of alternate global var opcodes.
78  kScriptFlagUnk3 = (1 << 0x3),
79  kScriptFlagFactoryDef = (1 << 0x4),
80  kScriptFlagUnk5 = (1 << 0x5),
81  kScriptFlagUnk6 = (1 << 0x6),
82  kScriptFlagUnk7 = (1 << 0x7),
83  kScriptFlagHasFactory = (1 << 0x8),
84  kScriptFlagEventScript = (1 << 0x9),
85  kScriptFlagEventScript2 = (1 << 0xa),
86  kScriptFlagUnkB = (1 << 0xb),
87  kScriptFlagUnkC = (1 << 0xc),
88  kScriptFlagUnkD = (1 << 0xd),
89  kScriptFlagUnkE = (1 << 0xe),
90  kScriptFlagUnkF = (1 << 0xf)
91 };
92 
93 enum ObjectType {
94  kNoneObj = 0,
95  kFactoryObj = 1 << 0,
96  kXObj = 1 << 1,
97  kScriptObj = 1 << 2,
98  kXtraObj = 1 << 3,
99  kAllObj = kFactoryObj | kXObj | kScriptObj | kXtraObj,
100  kWindowObj = 1 << 4,
101  kCastMemberObj = 1 << 5
102 };
103 
104 enum ShapeType {
105  kShapeRectangle = 1,
106  kShapeRoundRect = 2,
107  kShapeOval = 3,
108  kShapeLine = 4
109 };
110 
111 enum TextType {
112  kTextTypeAdjustToFit,
113  kTextTypeScrolling,
114  kTextTypeFixed
115 };
116 
117 enum TextAlignType {
118  kTextAlignRight = -1,
121 };
122 
123 enum TextFlag {
124  kTextFlagEditable = (1 << 0),
125  kTextFlagAutoTab = (1 << 1),
126  kTextFlagDoNotWrap = (1 << 2)
127 };
128 
129 enum SizeType {
130  kSizeNone,
131  kSizeSmallest,
132  kSizeSmall,
133  kSizeMedium,
134  kSizeLarge,
135  kSizeLargest
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 enum LEvent {
196  kEventPrepareMovie,
197  kEventStartMovie,
198  kEventStepMovie,
199  kEventStopMovie,
200 
201  kEventNew,
202  kEventBeginSprite,
203  kEventEndSprite,
204 
205  kEventNone,
206  kEventGeneric,
207  kEventEnterFrame,
208  kEventPrepareFrame,
209  kEventIdle,
210  kEventStepFrame,
211  kEventExitFrame,
212  kEventTimeout,
213 
214  kEventActivateWindow,
215  kEventDeactivateWindow,
216  kEventMoveWindow,
217  kEventResizeWindow,
218  kEventOpenWindow,
219  kEventCloseWindow,
220 
221  kEventKeyUp,
222  kEventKeyDown,
223  kEventMouseUp,
224  kEventMouseDown,
225  kEventRightMouseUp,
226  kEventRightMouseDown,
227  kEventMouseEnter,
228  kEventMouseLeave,
229  kEventMouseUpOutSide,
230  kEventMouseWithin,
231 
232  kEventStartUp,
233 
234  kEventMenuCallback
235 };
236 
237 enum TransitionType {
238  kTransNone,
239  kTransWipeRight,
240  kTransWipeLeft,
241  kTransWipeDown,
242  kTransWipeUp,
243  kTransCenterOutHorizontal, // 5
244  kTransEdgesInHorizontal,
245  kTransCenterOutVertical,
246  kTransEdgesInVertical,
247  kTransCenterOutSquare,
248  kTransEdgesInSquare, // 10
249  kTransPushLeft,
250  kTransPushRight,
251  kTransPushDown,
252  kTransPushUp,
253  kTransRevealUp, // 15
254  kTransRevealUpRight,
255  kTransRevealRight,
256  kTransRevealDownRight,
257  kTransRevealDown,
258  kTransRevealDownLeft, // 20
259  kTransRevealLeft,
260  kTransRevealUpLeft,
261  kTransDissolvePixelsFast,
262  kTransDissolveBoxyRects,
263  kTransDissolveBoxySquares, // 25
264  kTransDissolvePatterns,
265  kTransRandomRows,
266  kTransRandomColumns,
267  kTransCoverDown,
268  kTransCoverDownLeft, // 30
269  kTransCoverDownRight,
270  kTransCoverLeft,
271  kTransCoverRight,
272  kTransCoverUp,
273  kTransCoverUpLeft, // 35
274  kTransCoverUpRight,
275  kTransVenetianBlind,
276  kTransCheckerboard,
277  kTransStripsBottomBuildLeft,
278  kTransStripsBottomBuildRight, // 40
279  kTransStripsLeftBuildDown,
280  kTransStripsLeftBuildUp,
281  kTransStripsRightBuildDown,
282  kTransStripsRightBuildUp,
283  kTransStripsTopBuildLeft, // 45
284  kTransStripsTopBuildRight,
285  kTransZoomOpen,
286  kTransZoomClose,
287  kTransVerticalBinds,
288  kTransDissolveBitsFast, // 50
289  kTransDissolvePixels,
290  kTransDissolveBits
291 };
292 
293 enum RenderMode {
294  kRenderModeNormal,
295  kRenderForceUpdate
296 };
297 
298 // TODO: Can there be any more built-in palette types?
299 enum PaletteType {
300  kClutSystemMac = -1,
301  kClutRainbow = -2,
302  kClutGrayscale = -3,
303  kClutPastels = -4,
304  kClutVivid = -5,
305  kClutNTSC = -6,
306  kClutMetallic = -7,
307  kClutSystemWin = -101,
308  kClutSystemWinD5 = -102
309 };
310 
311 enum {
312  kNumBuiltinTiles = 8
313 };
314 
315 enum DirectorCursor {
316  kCursorMouseDown,
317  kCursorMouseUp
318 };
319 
320 enum PlayState {
321  kPlayNotStarted,
322  kPlayStarted,
323  kPlayStopped,
324  kPlayPaused,
325 };
326 
327 enum SymbolType {
328  VOIDSYM,
329  OPCODE,
330  CBLTIN, // builtin command
331  FBLTIN, // builtin function
332  HBLTIN, // builtin handler (can be called as either command or func)
333  KBLTIN, // builtin constant
334  FBLTIN_LIST, // builtin function w/list override check
335  HBLTIN_LIST, // builtin handler w/list override check
336  HANDLER // user-defined handler
337 };
338 
339 enum ChunkType {
340  kChunkChar,
341  kChunkWord,
342  kChunkItem,
343  kChunkLine
344 };
345 
346 enum FileVer {
347  kFileVer300 = 0x404,
348  kFileVer310 = 0x405,
349  kFileVer400 = 0x45B,
350  kFileVer404 = 0x45D,
351  kFileVer500 = 0x4B1,
352  kFileVer600 = 0x4C2,
353  kFileVer700 = 0x4C8,
354  kFileVer800 = 0x582,
355  kFileVer850 = 0x6A4,
356  kFileVer1000 = 0x73B,
357  kFileVer1100 = 0x781,
358  kFileVer1150 = 0x782,
359  kFileVer1200 = 0x79F
360 };
361 
362 enum DatumType {
363  ARGC,
364  ARGCNORET,
365  ARRAY,
366  CASTREF,
367  CHUNKREF,
368  FIELDREF,
369  FLOAT,
370  GLOBALREF,
371  INT,
372  LOCALREF,
373  MENUREF,
374  OBJECT,
375  PARRAY,
376  PICTUREREF,
377  POINT,
378  PROPREF,
379  RECT,
380  STRING,
381  SYMBOL,
382  VARREF,
383  VOID,
384 };
385 
386 enum VarType {
387  kVarGeneric,
388  kVarArgument,
389  kVarProperty,
390  kVarInstance,
391  kVarGlobal,
392  kVarLocal
393 };
394 
395 enum LPPFlag {
396  kLPPNone = 0,
397  kLPPSimple = 1 << 0,
398  kLPPForceD2 = 1 << 1,
399  kLPPTrimGarbage = 1 << 2,
400 };
401 
402 struct CastMemberID {
403  int member;
404  int castLib;
405 
406  CastMemberID() : member(0), castLib(0) {}
407  CastMemberID(int memberID, int castLibID)
408  : member(memberID), castLib(castLibID) {}
409 
410  bool operator==(const CastMemberID &c) const {
411  return member == c.member && castLib == c.castLib;
412  }
413  bool operator!=(const CastMemberID &c) const {
414  return member != c.member || castLib != c.castLib;
415  }
416 
417  bool isNull() const { return member == 0 && castLib == 0; }
418 
419  Common::String asString() const;
420 
421  uint hash() const { return ((castLib & 0xffff) << 16) + (member & 0xffff); }
422 };
423 
424 enum CompareResult {
425  kCompareLess = 1 << 0,
426  kCompareEqual = 1 << 1,
427  kCompareGreater = 1 << 2,
428  kCompareError = 1 << 3,
429 };
430 
431 enum DebugDrawModes {
432  kDebugDrawCast = 1 << 0,
433  kDebugDrawFrame = 1 << 1,
434 };
435 
436 struct Datum;
437 struct PCell;
440 
441 const char *scriptType2str(ScriptType scr);
442 const char *castType2str(CastType type);
443 const char *spriteType2str(SpriteType type);
444 
445 } // End of namespace Director
446 
447 namespace Common {
448 
449 template<>
450 struct Hash<Director::CastMemberID> {
451  uint operator()(const Director::CastMemberID &id) const {
452  return id.hash();
453  }
454 };
455 
456 } // End of namespace Common
457 
458 #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:129
Definition: lingo.h:216
Definition: types.h:402