22 #ifndef MEDIASTATION_ACTOR_H 23 #define MEDIASTATION_ACTOR_H 25 #include "common/events.h" 26 #include "common/keyboard.h" 28 #include "mediastation/datafile.h" 29 #include "mediastation/mediascript/scriptresponse.h" 30 #include "mediastation/mediascript/scriptconstants.h" 31 #include "mediastation/mediascript/scriptvalue.h" 40 kActorTypeEmpty = 0x0000,
41 kActorTypeScreen = 0x0001,
42 kActorTypeStage = 0x0002,
43 kActorTypePath = 0x0004,
44 kActorTypeSound = 0x0005,
45 kActorTypeTimer = 0x0006,
46 kActorTypeImage = 0x0007,
47 kActorTypeHotspot = 0x000b,
48 kActorTypeSprite = 0x000e,
49 kActorTypeLKZazu = 0x000f,
50 kActorTypeLKConstellations = 0x0010,
51 kActorTypeDocument = 0x0011,
52 kActorTypeImageSet = 0x001d,
53 kActorTypeCursor = 0x000c,
54 kActorTypePrinter = 0x0019,
55 kActorTypeMovie = 0x0016,
56 kActorTypePalette = 0x0017,
57 kActorTypeStreamMovieProxy = 0x18,
58 kActorTypeText = 0x001a,
59 kActorTypeFont = 0x001b,
60 kActorTypeCamera = 0x001c,
61 kActorTypeDiskImageActor = 0x001d,
62 kActorTypeCanvas = 0x001e,
63 kActorTypeXsnd = 0x001f,
64 kActorTypeXsndMidi = 0x0020,
65 kActorTypeRecorder = 0x0021,
66 kActorTypeFunction = 0x0069
68 const char *actorTypeToStr(ActorType type);
70 enum ActorHeaderSectionType {
71 kActorHeaderEmptySection = 0x0000,
72 kActorHeaderScriptResponse = 0x0017,
73 kActorHeaderChildActorId = 0x0019,
74 kActorHeaderActorId = 0x001a,
75 kActorHeaderChannelIdent = 0x001b,
76 kActorHeaderMovieAnimationChannelIdent = 0x06a4,
77 kActorHeaderMovieAudioChannelIdent = 0x06a5,
78 kActorHeaderActorReference = 0x077b,
79 kActorHeaderBoundingBox = 0x001c,
80 kActorHeaderMouseActiveArea = 0x001d,
81 kActorHeaderZIndex = 0x001e,
82 kActorHeaderStartup = 0x001f,
83 kActorHeaderTransparency = 0x0020,
84 kActorHeaderDiscardAfterUse = 0x0021,
85 kActorHeaderCursorResourceId = 0x0022,
86 kActorHeaderFrameRate = 0x0024,
87 kActorHeaderLoadType = 0x0032,
88 kActorHeaderSoundInfo = 0x0033,
89 kActorHeaderCachingEnabled = 0x0034,
90 kActorHeaderInstallType = 0x0037,
91 kActorHeaderSpriteChunkCount = 0x03e8,
92 kActorHeaderPalette = 0x05aa,
93 kActorHeaderDissolveFactor = 0x05dc,
94 kActorHeaderGetOffstageEvents = 0x05dd,
95 kActorHeaderX = 0x05de,
96 kActorHeaderY = 0x05df,
97 kActorHeaderScaleXAndY = 0x77a,
98 kActorHeaderScaleX = 0x77c,
99 kActorHeaderScaleY = 0x77d,
100 kActorHeaderActorName = 0x0bb8,
101 kStreamMovieProxyInfo = 0x06ac,
104 kActorHeaderStartPoint = 0x060e,
105 kActorHeaderEndPoint = 0x060f,
106 kActorHeaderPathTotalSteps = 0x0610,
107 kActorHeaderStepRate = 0x0611,
108 kActorHeaderDuration = 0x0612,
111 kActorHeaderCameraViewportOrigin = 0x076f,
112 kActorHeaderCameraLensOpen = 0x0770,
113 kActorHeaderCameraImageActor = 0x77b,
116 kActorHeaderCanvasDissolveFactor = 0x493,
117 kActorHeaderCanvasTransparency = 0x7d0,
120 kActorHeaderStageExtent = 0x0771,
121 kActorHeaderCylindricalX = 0x0772,
122 kActorHeaderCylindricalY = 0x0773,
125 kActorHeaderEditable = 0x03eb,
126 kActorHeaderFontActorId = 0x0258,
127 kActorHeaderInitialText = 0x0259,
128 kActorHeaderTextMaxLength = 0x25a,
129 kActorHeaderTextJustification = 0x025b,
130 kActorHeaderTextPosition = 0x25f,
131 kActorHeaderTextCursorIsVisible = 0x262,
132 kActorHeaderTextConstrainToWidth = 0x263,
133 kActorHeaderTextOverwriteMode = 0x264,
134 kActorHeaderTextAcceptedCharRange = 0x265,
135 kActorHeaderTextAcceptedCharRangeWithOffset = 0x0266,
138 kActorHeaderSpriteClip = 0x03e9,
139 kActorHeaderDefaultSpriteClip = 0x03ea
142 enum CylindricalWrapMode : int;
155 enum MouseEventFlag {
157 kMouseDownFlag = 0x01,
159 kMouseMovedFlag = 0x04,
160 kMouseExitFlag = 0x10,
161 kMouseEnterFlag = 0x08,
162 kMouseUnk1Flag = 0x20,
163 kMouseOutOfFocusFlag = 0x40,
170 #define ARGCOUNTCHECK(n) \ 171 if (args.size() != (n)) { \ 172 warning("%s: Expected %d arguments, got %d", builtInMethodToStr(methodId), (n), args.size()); \ 176 #define ARGCOUNTRANGE(min, max) \ 177 if ((int64)(min) > args.size() || args.size() > (int64)(max)) { \ 178 warning("%s: Expected %d to %d arguments, got %d", builtInMethodToStr(methodId), (min), (max), args.size()); \ 182 #define ARGCOUNTMIN(min) \ 183 if (args.size() < (min)) { \ 184 warning("%s: Expected at least %d arguments, got %d", builtInMethodToStr(methodId), (min), args.size()); \ 189 Actor(ActorType type) : _type(type) {};
193 virtual void process() {
return; }
198 virtual bool isSpatialActor()
const {
return false; }
200 virtual void initFromParameterStream(
Chunk &chunk);
201 virtual void readParameter(
Chunk &chunk, ActorHeaderSectionType paramType);
202 virtual void loadIsComplete();
204 void processTimeScriptResponses();
205 void runScriptResponseIfExists(EventType eventType,
const ScriptValue &arg);
206 void runScriptResponseIfExists(EventType eventType);
208 ActorType type()
const {
return _type; }
209 uint id()
const {
return _id; }
210 uint contextId()
const {
return _contextId; }
212 void setContextId(uint
id) { _contextId = id; }
213 const char *debugName()
const;
214 void updateDebugName();
217 ActorType _type = kActorTypeEmpty;
218 bool _loadIsComplete =
false;
224 uint _lastProcessedTime = 0;
236 virtual void readParameter(
Chunk &chunk, ActorHeaderSectionType paramType)
override;
237 virtual void loadIsComplete()
override;
239 virtual bool isRectInMemory(
const Common::Rect &rect) {
return true; }
240 virtual bool isLoading() {
return false; }
242 virtual bool isSpatialActor()
const override {
return true; }
243 virtual bool isVisible()
const {
return _isVisible; }
244 virtual Common::Rect getBbox()
const {
return _boundingBox; }
245 int zIndex()
const {
return _zIndex; }
246 void moveTo(int16 x, int16 y);
249 virtual void invalidateMouse();
250 virtual bool interactsWithMouse()
const {
return false; }
252 virtual uint16 findActorToAcceptMouseEvents(
256 bool inBounds) {
return kNoFlag; }
257 virtual uint16 findActorToAcceptKeyboardEvents(
262 virtual void mouseDownEvent(
const Common::Event &event) {
return; }
263 virtual void mouseUpEvent(
const Common::Event &event) {
return; }
264 virtual void mouseEnteredEvent(
const Common::Event &event) {
return; }
265 virtual void mouseExitedEvent(
const Common::Event &event) {
return; }
266 virtual void mouseMovedEvent(
const Common::Event &event) {
return; }
267 virtual void mouseOutOfFocusEvent(
const Common::Event &event) {
return; }
268 virtual void keyboardEvent(
const Common::Event &event) {
return; }
270 void setParentStage(
StageActor *parentStage) { _parentStage = parentStage; }
271 void setToNoParentStage() { _parentStage =
nullptr; }
272 StageActor *getParentStage()
const {
return _parentStage; }
274 virtual void invalidateLocalBounds();
275 virtual void setAdjustedBounds(CylindricalWrapMode alignmentMode);
280 double _dissolveFactor = 1.0;
281 double _scaleX = 0.0;
282 double _scaleY = 0.0;
285 bool _isVisible =
false;
286 bool _hasTransparency =
false;
287 bool _getOffstageEvents =
false;
290 void moveToCentered(int16 x, int16 y);
292 void setZIndex(
int zIndex);
293 virtual void setMousePosition(int16 x, int16 y);
295 virtual void setDissolveFactor(
double dissolveFactor);
296 virtual void invalidateLocalZIndex();
Definition: graphics.h:100