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 
241 enum TransitionType {
242  kTransNone,
243  kTransWipeRight,
244  kTransWipeLeft,
245  kTransWipeDown,
246  kTransWipeUp,
247  kTransCenterOutHorizontal, // 5
248  kTransEdgesInHorizontal,
249  kTransCenterOutVertical,
250  kTransEdgesInVertical,
251  kTransCenterOutSquare,
252  kTransEdgesInSquare, // 10
253  kTransPushLeft,
254  kTransPushRight,
255  kTransPushDown,
256  kTransPushUp,
257  kTransRevealUp, // 15
258  kTransRevealUpRight,
259  kTransRevealRight,
260  kTransRevealDownRight,
261  kTransRevealDown,
262  kTransRevealDownLeft, // 20
263  kTransRevealLeft,
264  kTransRevealUpLeft,
265  kTransDissolvePixelsFast,
266  kTransDissolveBoxyRects,
267  kTransDissolveBoxySquares, // 25
268  kTransDissolvePatterns,
269  kTransRandomRows,
270  kTransRandomColumns,
271  kTransCoverDown,
272  kTransCoverDownLeft, // 30
273  kTransCoverDownRight,
274  kTransCoverLeft,
275  kTransCoverRight,
276  kTransCoverUp,
277  kTransCoverUpLeft, // 35
278  kTransCoverUpRight,
279  kTransVenetianBlind,
280  kTransCheckerboard,
281  kTransStripsBottomBuildLeft,
282  kTransStripsBottomBuildRight, // 40
283  kTransStripsLeftBuildDown,
284  kTransStripsLeftBuildUp,
285  kTransStripsRightBuildDown,
286  kTransStripsRightBuildUp,
287  kTransStripsTopBuildLeft, // 45
288  kTransStripsTopBuildRight,
289  kTransZoomOpen,
290  kTransZoomClose,
291  kTransVerticalBinds,
292  kTransDissolveBitsFast, // 50
293  kTransDissolvePixels,
294  kTransDissolveBits
295 };
296 
297 enum RenderMode {
298  kRenderModeNormal,
299  kRenderForceUpdate
300 };
301 
302 // TODO: Can there be any more built-in palette types?
303 enum PaletteType {
304  kClutSystemMac = -1,
305  kClutRainbow = -2,
306  kClutGrayscale = -3,
307  kClutPastels = -4,
308  kClutVivid = -5,
309  kClutNTSC = -6,
310  kClutMetallic = -7,
311  kClutSystemWin = -101,
312  kClutSystemWinD5 = -102
313 };
314 
315 enum {
316  kNumBuiltinTiles = 8
317 };
318 
319 enum DirectorCursor {
320  kCursorMouseDown,
321  kCursorMouseUp
322 };
323 
324 enum PlayState {
325  kPlayNotStarted,
326  kPlayLoaded,
327  kPlayStarted,
328  kPlayStopped,
329  kPlayPaused,
330  kPlayPausedAfterLoading,
331 };
332 
333 enum SymbolType {
334  VOIDSYM,
335  OPCODE,
336  CBLTIN, // builtin command
337  FBLTIN, // builtin function
338  HBLTIN, // builtin handler (can be called as either command or func)
339  KBLTIN, // builtin constant
340  FBLTIN_LIST, // builtin function w/list override check
341  HBLTIN_LIST, // builtin handler w/list override check
342  HANDLER // user-defined handler
343 };
344 
345 enum ChunkType {
346  kChunkChar,
347  kChunkWord,
348  kChunkItem,
349  kChunkLine
350 };
351 
352 enum FileVer {
353  kFileVer300 = 0x404,
354  kFileVer310 = 0x405,
355  kFileVer400 = 0x45B,
356  kFileVer404 = 0x45D,
357  kFileVer500 = 0x4B1,
358  kFileVer600 = 0x4C2,
359  kFileVer700 = 0x4C8,
360  kFileVer800 = 0x582,
361  kFileVer850 = 0x6A4,
362  kFileVer1000 = 0x73B,
363  kFileVer1100 = 0x781,
364  kFileVer1150 = 0x782,
365  kFileVer1200 = 0x79F
366 };
367 
368 enum DatumType {
369  ARGC,
370  ARGCNORET,
371  ARRAY,
372  CASTREF,
373  CASTLIBREF,
374  CHUNKREF,
375  FIELDREF,
376  FLOAT,
377  GLOBALREF,
378  INT,
379  LOCALREF,
380  MEDIA,
381  MENUREF,
382  OBJECT,
383  PARRAY,
384  PICTUREREF,
385  POINT,
386  PROPREF,
387  RECT,
388  SPRITEREF,
389  STRING,
390  SYMBOL,
391  VARREF,
392  VOID,
393 };
394 
395 enum VarType {
396  kVarGeneric,
397  kVarArgument,
398  kVarProperty,
399  kVarInstance,
400  kVarGlobal,
401  kVarLocal
402 };
403 
404 enum LPPFlag {
405  kLPPNone = 0,
406  kLPPSimple = 1 << 0,
407  kLPPForceD2 = 1 << 1,
408  kLPPTrimGarbage = 1 << 2,
409 };
410 
411 struct CastMemberID {
412  int member;
413  int castLib;
414 
415  CastMemberID() : member(0), castLib(0) {}
416  CastMemberID(int memberID, int castLibID)
417  : member(memberID), castLib(castLibID) {}
418 
419  bool operator==(const CastMemberID &c) const {
420  return member == c.member && castLib == c.castLib;
421  }
422  bool operator!=(const CastMemberID &c) const {
423  return member != c.member || castLib != c.castLib;
424  }
425 
426  bool isNull() const { return member == 0 && castLib == 0; }
427 
428  Common::String asString() const;
429 
430  uint hash() const { return ((castLib & 0xffff) << 16) + (member & 0xffff); }
431 
432  CastMemberID fromMultiplex(int multiplexID) {
433  if (multiplexID < 0)
434  return CastMemberID(multiplexID, -1);
435  return CastMemberID(multiplexID % 0x20000, 1 + (multiplexID >> 17));
436  }
437 
438  int toMultiplex() {
439  if (castLib < 0)
440  return member;
441  return (member % 0x20000) + ((castLib - 1) << 17);
442  }
443 };
444 
445 enum CompareResult {
446  kCompareLess = 1 << 0,
447  kCompareEqual = 1 << 1,
448  kCompareGreater = 1 << 2,
449  kCompareLessEqual = 1 << 3,
450  kCompareGreaterEqual = 1 << 4,
451  kCompareError = 1 << 5,
452 };
453 
454 enum DebugDrawModes {
455  kDebugDrawCast = 1 << 0,
456  kDebugDrawFrame = 1 << 1,
457 };
458 
459 struct Datum;
460 struct PCell;
463 
464 const char *scriptType2str(ScriptType scr);
465 const char *castType2str(CastType type);
466 const char *spriteType2str(SpriteType type);
467 const char *inkType2str(InkType type);
468 const char *symbolType2str(SymbolType type);
469 Common::String objectType2str(int fl);
470 \
471 enum CollisionTest {
472  kCollisionNo = 0,
473  kCollisionYes,
474  kCollisionHole,
475 };
476 
477 } // End of namespace Director
478 
479 namespace Common {
480 
481 template<>
482 struct Hash<Director::CastMemberID> {
483  uint operator()(const Director::CastMemberID &id) const {
484  return id.hash();
485  }
486 };
487 
488 template<>
489 struct Hash<Director::LEvent> {
490  uint operator()(const Director::LEvent &event) const {
491  return event;
492  }
493 };
494 
495 
496 } // End of namespace Common
497 
498 #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:219
Definition: types.h:411