22 #ifndef MTROPOLIS_RUNTIME_H 23 #define MTROPOLIS_RUNTIME_H 25 #include "common/archive.h" 26 #include "common/array.h" 27 #include "common/events.h" 28 #include "common/language.h" 29 #include "common/platform.h" 30 #include "common/ptr.h" 31 #include "common/stream.h" 32 #include "common/hashmap.h" 33 #include "common/hash-str.h" 35 #include "graphics/pixelformat.h" 37 #include "mtropolis/actions.h" 38 #include "mtropolis/core.h" 39 #include "mtropolis/coroutine_protos.h" 40 #include "mtropolis/data.h" 41 #include "mtropolis/debug.h" 42 #include "mtropolis/hacks.h" 43 #include "mtropolis/miniscript_protos.h" 44 #include "mtropolis/subtitles.h" 45 #include "mtropolis/vthread.h" 63 struct WinCursorGroup;
76 class AssetManagerInterface;
77 class CoroutineManager;
79 class CursorGraphicCollection;
81 class GraphicModifier;
82 class KeyboardInputEvent;
83 class MessageDispatch;
84 class MiniscriptThread;
86 class ObjectLinkingScope;
93 class SystemInterface;
96 class WorldManagerInterface;
98 struct DynamicValueWriteProxy;
99 struct IBoundaryDetector;
101 struct ILoadUIProvider;
102 struct IMessageConsumer;
103 struct IModifierContainer;
104 struct IPlugInModifierFactory;
105 struct IPlugInModifierFactoryAndDataFactory;
107 struct ISaveUIProvider;
109 struct IStructuralReferenceVisitor;
110 struct MessageProperties;
111 struct ModifierLoaderContext;
112 struct PlugInModifierLoaderContext;
113 struct SIModifierFactory;
116 #ifdef MTROPOLIS_DEBUG_ENABLE 120 char invariantToLower(
char c);
125 enum ColorDepthMode {
130 kColorDepthMode16Bit,
131 kColorDepthMode32Bit,
133 kColorDepthModeCount,
135 kColorDepthModeInvalid,
138 namespace SceneTransitionTypes {
140 enum SceneTransitionType {
151 bool loadFromData(SceneTransitionType &transType, int32 data);
155 namespace SceneTransitionDirections {
157 enum SceneTransitionDirection {
164 bool loadFromData(SceneTransitionDirection &transDir, int32 data);
168 enum ConstraintDirection {
169 kConstraintDirectionNone,
170 kConstraintDirectionHorizontal,
171 kConstraintDirectionVertical,
174 enum MouseInteractivityTestType {
175 kMouseInteractivityTestAnything,
176 kMouseInteractivityTestMouseClick,
179 namespace DynamicValueSourceTypes {
180 enum DynamicValueSourceType {
189 namespace DynamicValueTypes {
192 enum DynamicValueType {
215 namespace AttributeIDs {
230 kAttribLoopBackForth = 59,
231 kAttribPlayEveryFrame = 60,
232 kAttribTimeValue = 16,
233 kAttribTrackDisable = 51,
234 kAttribTrackEnable = 50,
238 kAttribMasterVolume = 18,
239 kAttribUserTimeout = 19,
249 kElementEnableEdit = 207,
250 kElementDisableEdit = 220,
251 kElementSelect = 209,
252 kElementDeselect = 210,
253 kElementToggleSelect = 213,
254 kElementUpdatedCalculated = 219,
258 kElementScrollUp = 1001,
259 kElementScrollDown = 1002,
260 kElementScrollRight = 1005,
261 kElementScrollLeft = 1006,
263 kMotionStarted = 501,
266 kTransitionStarted = 503,
267 kTransitionEnded = 504,
273 kMouseTrackedInside = 305,
274 kMouseTrackedOutside = 306,
275 kMouseTracking = 307,
276 kMouseUpInside = 309,
277 kMouseUpOutside = 310,
281 kSceneDeactivated = 103,
282 kSceneReactivated = 104,
283 kSceneTransitionEnded = 506,
285 kSharedSceneReturnedToScene = 401,
286 kSharedSceneSceneChanged = 402,
287 kSharedSceneNoNextScene = 403,
288 kSharedSceneNoPrevScene = 404,
290 kParentEnabled = 2001,
291 kParentDisabled = 2002,
292 kParentChanged = 227,
294 kPreloadMedia = 1701,
296 kPrerollMedia = 1704,
298 kCloseProject = 1601,
301 kProjectStarted = 1802,
302 kProjectEnded = 1803,
303 kFlushAllMedia = 1804,
320 kAuthorMessage = 900,
323 bool isCommand(EventID eventID);
339 inline bool operator==(
const IntRange &other)
const {
340 return min == other.min && max == other.max;
343 inline bool operator!=(
const IntRange &other)
const {
344 return !((*this) == other);
353 Label(int32 psuperGroupID, int32 pid);
360 inline bool operator==(
const Label &other)
const {
361 return superGroupID == other.superGroupID &&
id == other.id;
364 inline bool operator!=(
const Label &other)
const {
365 return !((*this) == other);
371 Event(EventIDs::EventID peventType, uint32 peventInfo);
373 EventIDs::EventID eventType;
378 bool respondsTo(
const Event &otherEvent)
const;
382 inline bool operator==(
const Event &other)
const {
383 return eventType == other.eventType && eventInfo == other.eventInfo;
386 inline bool operator!=(
const Event &other)
const {
387 return !((*this) == other);
399 inline bool operator==(
const VarReference &other)
const {
400 return guid == other.guid && source == other.source;
403 inline bool operator!=(
const VarReference &other)
const {
404 return !((*this) == other);
428 return !
object.owner_before(other.object) && !other.object.owner_before(
object);
432 return !((*this) == other);
435 inline void reset() {
447 return angleDegrees == other.angleDegrees && magnitude == other.magnitude;
451 return !((*this) == other);
454 inline static AngleMagVector createRadians(
double angleRadians,
double magnitude) {
458 inline static AngleMagVector createDegrees(
double angleDegrees,
double magnitude) {
479 inline bool operator==(
const ColorRGB8 &other)
const {
480 return r == other.r && g == other.g && b == other.b;
483 inline bool operator!=(
const ColorRGB8 &other)
const {
484 return !((*this) == other);
504 typedef MiniscriptInstructionOutcome (*writeFunc_t)(
MiniscriptThread *thread,
const DynamicValue &dest,
void *objectRef, uintptr ptrOrOffset);
509 refAttribFunc_t refAttrib;
510 refAttribIndexedFunc_t refAttribIndexed;
529 static_cast<DynamicValueWriteInterface::writeFunc_t
>(T::write),
530 static_cast<DynamicValueWriteInterface::refAttribFunc_t>(T::refAttrib),
531 static_cast<DynamicValueWriteInterface::refAttribIndexedFunc_t
>(T::refAttribIndexed),
562 virtual bool setAtIndex(
size_t index,
const DynamicValue &dynValue) = 0;
563 virtual bool getAtIndex(
size_t index,
DynamicValue &dynValue)
const = 0;
564 virtual void truncateToSize(
size_t sz) = 0;
565 virtual bool expandToMinimumSize(
size_t sz) = 0;
567 virtual const void *getConstArrayPtr()
const = 0;
568 virtual void *getArrayPtr() = 0;
569 virtual size_t getSize()
const = 0;
575 static void defaultSet(int32 &value);
576 static void defaultSet(
double &value);
578 static void defaultSet(
IntRange &value);
579 static void defaultSet(
bool &value);
581 static void defaultSet(
Label &value);
582 static void defaultSet(
Event &value);
590 typedef T DynamicValuePODType_t;
592 static const T &dereference(
const T *source) {
return *source; }
596 static bool importValue(
const DynamicValue &dynValue,
const int32 *&outPtr);
597 static bool importValue(
const DynamicValue &dynValue,
const double *&outPtr);
600 static bool importValue(
const DynamicValue &dynValue,
const bool *&outPtr);
610 static void exportValue(
DynamicValue &dynValue,
const int32 &value);
611 static void exportValue(
DynamicValue &dynValue,
const double &value);
614 static void exportValue(
DynamicValue &dynValue,
const bool &value);
626 bool setAtIndex(
size_t index,
const DynamicValue &dynValue)
override;
627 bool getAtIndex(
size_t index,
DynamicValue &dynValue)
const override;
628 void truncateToSize(
size_t sz)
override;
629 bool expandToMinimumSize(
size_t sz)
override;
631 const void *getConstArrayPtr()
const override;
632 void *getArrayPtr()
override;
633 size_t getSize()
const override;
646 bool setAtIndex(
size_t index,
const DynamicValue &dynValue)
override;
647 bool getAtIndex(
size_t index,
DynamicValue &dynValue)
const override;
648 void truncateToSize(
size_t sz)
override;
649 bool expandToMinimumSize(
size_t sz)
override;
651 const void *getConstArrayPtr()
const override;
652 void *getArrayPtr()
override;
653 size_t getSize()
const override;
663 const typename DynamicListValueConverter<T>::DynamicValuePODType_t *valuePtr =
nullptr;
664 if (!DynamicListValueImporter::importValue(dynValue, valuePtr))
667 _array.reserve(index + 1);
668 if (_array.size() <= index) {
669 if (_array.size() < index) {
671 DynamicListDefaultSetter::defaultSet(defaultValue);
672 while (_array.size() < index) {
673 _array.push_back(defaultValue);
686 if (_array.size() > sz)
693 if (_array.size() < sz) {
695 DynamicListDefaultSetter::defaultSet(defaultValue);
696 while (_array.size() < sz) {
697 _array.push_back(defaultValue);
706 if (index >= _array.size())
709 DynamicListValueExporter::exportValue(dynValue, _array[index]);
730 return _array.size();
736 return _array == otherTyped._array;
749 DynamicValueTypes::DynamicValueType getType()
const;
775 bool getAtIndex(
size_t index,
DynamicValue &value)
const;
776 bool setAtIndex(
size_t index,
const DynamicValue &value);
777 void deleteAtIndex(
size_t index);
778 void truncateToSize(
size_t sz);
779 void expandToMinimumSize(
size_t sz);
780 size_t getSize()
const;
782 void forceType(DynamicValueTypes::DynamicValueType type);
784 static bool dynamicValueToIndex(
size_t &outIndex,
const DynamicValue &value);
789 inline bool operator!=(
const DynamicList &other)
const {
790 return !((*this) == other);
800 struct WriteProxyInterface {
807 void destroyContainer();
808 bool createContainerAndSetType(DynamicValueTypes::DynamicValueType type);
810 DynamicValueTypes::DynamicValueType _type;
824 DynamicValueTypes::DynamicValueType getType()
const;
826 const int32 &getInt()
const;
827 const double &getFloat()
const;
829 const IntRange &getIntRange()
const;
831 const Label &getLabel()
const;
832 const Event &getEvent()
const;
834 const bool &getBool()
const;
841 void setInt(int32 value);
842 void setFloat(
double value);
844 void setIntRange(
const IntRange &value);
846 void setLabel(
const Label &value);
847 void setEvent(
const Event &value);
849 void setBool(
bool value);
855 bool roundToInt(int32 &outInt)
const;
857 bool convertToType(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
864 inline bool operator!=(
const DynamicValue &other)
const {
865 return !((*this) == other);
888 template<
class T, T(ValueUnion::*TMember)>
889 void construct(
const T &value);
891 template<
class T, T(ValueUnion::*TMember)>
892 void construct(T &&value);
894 template<
class T, T(ValueUnion::*TMember)>
895 void assign(
const T &value);
897 template<
class T, T(ValueUnion::*TMember)>
898 void assign(T &&value);
900 template<
class T, T(ValueUnion::*TMember)>
905 void internalSwap(T &a, T &b) {
911 bool convertIntToType(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
912 bool convertFloatToType(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
913 bool convertBoolToType(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
914 bool convertStringToType(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
916 bool convertToTypeNoDereference(DynamicValueTypes::DynamicValueType targetType,
DynamicValue &result)
const;
921 DynamicValueTypes::DynamicValueType _type;
934 DynamicValueSourceTypes::DynamicValueSourceType getSourceType()
const;
955 void destructValue();
959 DynamicValueSourceTypes::DynamicValueSourceType _sourceType;
960 ValueUnion _valueUnion;
963 template<
class TFloat>
968 TFloat &dest = *
static_cast<TFloat *
>(objectRef);
969 switch (derefValue.getType()) {
970 case DynamicValueTypes::kFloat:
971 dest =
static_cast<TFloat
>(derefValue.getFloat());
972 return kMiniscriptInstructionOutcomeContinue;
973 case DynamicValueTypes::kInteger:
974 dest =
static_cast<TFloat
>(derefValue.getInt());
975 return kMiniscriptInstructionOutcomeContinue;
977 return kMiniscriptInstructionOutcomeFailed;
981 return kMiniscriptInstructionOutcomeFailed;
984 return kMiniscriptInstructionOutcomeFailed;
988 proxy.pod.ptrOrOffset = 0;
989 proxy.pod.objectRef = floatValue;
994 template<
class TInteger>
999 TInteger &dest = *
static_cast<TInteger *
>(objectRef);
1000 switch (derefValue.getType()) {
1001 case DynamicValueTypes::kFloat:
1002 dest =
static_cast<TInteger
>(floor(derefValue.getFloat() + 0.5));
1003 return kMiniscriptInstructionOutcomeContinue;
1004 case DynamicValueTypes::kInteger:
1005 dest =
static_cast<TInteger
>(derefValue.getInt());
1006 return kMiniscriptInstructionOutcomeContinue;
1008 return kMiniscriptInstructionOutcomeFailed;
1012 return kMiniscriptInstructionOutcomeFailed;
1015 return kMiniscriptInstructionOutcomeFailed;
1019 proxy.pod.ptrOrOffset = 0;
1020 proxy.pod.objectRef = intValue;
1057 template<
class TClass, MiniscriptInstructionOutcome (TClass::*TWriteMethod)(MiniscriptThread *thread, const DynamicValue &dest), MiniscriptInstructionOutcome (TClass::*TRefAttribMethod)(MiniscriptThread *thread, DynamicValueWriteProxy &proxy, const Common::String &attrib)>
1062 return (static_cast<TClass *>(objectRef)->*TWriteMethod)(thread, derefValue);
1065 return (static_cast<TClass *>(objectRef)->*TRefAttribMethod)(thread, proxy, attrib);
1068 return kMiniscriptInstructionOutcomeFailed;
1072 proxy.pod.ptrOrOffset = 0;
1073 proxy.pod.objectRef = obj;
1078 template<
class TClass, MiniscriptInstructionOutcome (TClass::*TWriteMethod)(MiniscriptThread *thread, const DynamicValue &dest),
bool TDereference>
1082 return (static_cast<TClass *>(objectRef)->*TWriteMethod)(thread, dest.dereference());
1084 return (static_cast<TClass *>(objectRef)->*TWriteMethod)(thread, dest);
1087 return kMiniscriptInstructionOutcomeFailed;
1090 return kMiniscriptInstructionOutcomeFailed;
1094 proxy.pod.ptrOrOffset = 0;
1095 proxy.pod.objectRef = obj;
1125 kLinkTypeNotYetLinked,
1126 kLinkTypeStructural,
1129 kLinkTypeUnresolved,
1144 static bool isSceneFilter(
Structural *section);
1145 static bool isSectionFilter(
Structural *section);
1146 static bool isSubsectionFilter(
Structural *section);
1147 static bool isElementFilter(
Structural *section);
1150 enum MessageDestination {
1151 kMessageDestNone = 0,
1153 kMessageDestSharedScene = 0x65,
1154 kMessageDestScene = 0x66,
1155 kMessageDestSection = 0x67,
1156 kMessageDestProject = 0x68,
1157 kMessageDestActiveScene = 0x69,
1158 kMessageDestElementsParent = 0x6a,
1159 kMessageDestChildren = 0x6b,
1160 kMessageDestModifiersParent = 0x6c,
1161 kMessageDestSubsection = 0x6d,
1163 kMessageDestElement = 0xc9,
1164 kMessageDestSourcesParent = 0xcf,
1166 kMessageDestBehavior = 0xd4,
1167 kMessageDestNextElement = 0xd1,
1168 kMessageDestPrevElement = 0xd2,
1169 kMessageDestBehaviorsParent = 0xd3,
1246 enum ProjectPlatform {
1247 kProjectPlatformUnknown,
1249 kProjectPlatformWindows,
1250 kProjectPlatformMacintosh,
1258 void addSegment(
int volumeID,
const char *filePath);
1274 ProjectPlatform getPlatform()
const;
1275 RuntimeVersion getRuntimeVersion()
const;
1276 bool isRuntimeVersionAuto()
const;
1291 ProjectPlatform _platform;
1292 RuntimeVersion _runtimeVersion;
1293 bool _isRuntimeVersionAuto;
1333 kShowDefaultVisibleElements,
1341 ActionType getActionType()
const;
1348 ActionType _actionType;
1363 kTypeChangeSharedScene,
1364 kTypeForceLoadScene,
1365 kTypeRequestUnloadScene,
1372 bool addToDestinationScene;
1373 bool addToReturnList;
1381 SceneTransitionTypes::SceneTransitionType _transitionType;
1382 SceneTransitionDirections::SceneTransitionDirection _transitionDirection;
1387 enum class RootType {
1401 bool isCascade()
const;
1402 bool isRelay()
const;
1404 RootType getRootType()
const;
1424 static bool keyboardMessengerFilterFunc(
void *userData,
RuntimeObject *
object);
1426 bool isTerminated()
const;
1427 VThreadState continuePropagating(
Runtime *runtime);
1431 size_t _dispatchIndex;
1442 uint64 getScheduledTime()
const;
1443 void activate(
Runtime *runtime)
const;
1449 void (*_activateFunc)(
void *obj,
Runtime *runtime);
1451 uint64 _scheduledTime;
1462 template<
class T,
void (T::*TMethodPtr)(Runtime *)>
1470 void descheduleFirstEvent();
1473 template<
class T,
void (T::*TMethodPtr)(Runtime *)>
1474 static void methodActivateHelper(
void *obj,
Runtime *runtime) {
1475 (
static_cast<T *
>(obj)->*TMethodPtr)(runtime);
1485 kOSEventTypeMouseDown,
1486 kOSEventTypeMouseUp,
1487 kOSEventTypeMouseMove,
1489 kOSEventTypeKeyboard,
1496 explicit OSEvent(OSEventType eventType);
1499 OSEventType getEventType()
const;
1502 OSEventType _eventType;
1507 explicit MouseInputEvent(OSEventType eventType, int32 x, int32 y, Actions::MouseButton button);
1511 Actions::MouseButton getButton()
const;
1516 Actions::MouseButton _button;
1524 bool isRepeat()
const;
1535 explicit ActionEvent(OSEventType osEventType, Actions::Action action);
1537 Actions::Action getAction()
const;
1540 Actions::Action _action;
1546 ConstraintDirection constraintDirection;
1548 bool constrainToParent;
1557 virtual void onProjectStarted(
Runtime *runtime);
1565 void initDefaultPalette(
int version);
1567 const byte *getPalette()
const;
1569 static const uint kNumColors = 256;
1572 byte _colors[kNumColors * 3];
1584 void closeProject();
1586 void addVolume(
int volumeID,
const char *name,
bool isMounted);
1587 bool getVolumeState(
const Common::String &name,
int &outVolumeID,
bool &outIsMounted)
const;
1589 void addSceneReturn();
1599 uint32 allocateRuntimeGUID();
1602 void removeWindow(
Window *window);
1607 bool isDisplayModeSupported(ColorDepthMode displayMode)
const;
1611 bool switchDisplayMode(ColorDepthMode realDisplayMode, ColorDepthMode fakeDisplayMode);
1613 void setDisplayResolution(uint16 width, uint16 height);
1614 void getDisplayResolution(uint16 &outWidth, uint16 &outHeight)
const;
1616 ColorDepthMode getRealColorDepth()
const;
1617 ColorDepthMode getFakeColorDepth()
const;
1627 bool mustDraw()
const;
1629 uint64 getRealTime()
const;
1630 uint64 getPlayTime()
const;
1638 CORO_DEFINE_RETURN_TYPE(
void);
1654 void setVolume(
double volume);
1656 void onMouseDown(int32 x, int32 y, Actions::MouseButton mButton);
1657 void onMouseMove(int32 x, int32 y);
1658 void onMouseUp(int32 x, int32 y, Actions::MouseButton mButton);
1660 void onAction(MTropolis::Actions::Action action);
1663 void setModifierCursorOverride(uint32 cursorID);
1664 void clearModifierCursorOverride();
1665 void forceCursorRefreshOnce();
1666 void setAutoResetCursor(
bool enabled);
1668 uint getMultiClickCount()
const;
1670 bool isAwaitingSceneTransition()
const;
1683 const Hacks &getHacks()
const;
1685 void setSceneGraphDirty();
1686 void clearSceneGraphDirty();
1687 bool isSceneGraphDirty()
const;
1690 void removeCollider(
ICollider *collider);
1691 void checkCollisions(
ICollider *optRestrictToCollider);
1694 void updateCursorElementPosition();
1698 void checkBoundaries();
1704 const Palette &getGlobalPalette()
const;
1705 void setGlobalPalette(
const Palette &palette);
1707 void addMouseBlocker();
1708 void removeMouseBlocker();
1710 const Common::String *resolveAttributeIDName(uint32 attribID)
const;
1717 bool isIdle()
const;
1727 #ifdef MTROPOLIS_DEBUG_ENABLE 1728 void debugSetEnabled(
bool enabled);
1730 Debugger *debugGetDebugger()
const;
1736 enum SceneTransitionState {
1737 kSceneTransitionStateNotTransitioning,
1738 kSceneTransitionStateWaitingForDraw,
1739 kSceneTransitionStateTransitioning,
1742 struct SceneStackEntry {
1753 bool onlyRemoveChildren;
1756 struct SceneReturnListEntry {
1757 SceneReturnListEntry();
1760 bool isAddToDestinationSceneTransition;
1763 struct DispatchMethodTaskData {
1767 struct DispatchKeyTaskData {
1771 struct DispatchActionTaskData {
1772 DispatchActionTaskData();
1774 Actions::Action action;
1777 struct ConsumeMessageTaskData {
1778 ConsumeMessageTaskData();
1784 struct ConsumeCommandTaskData {
1785 ConsumeCommandTaskData();
1791 struct ApplyDefaultVisibilityTaskData {
1792 ApplyDefaultVisibilityTaskData();
1795 bool targetVisibility;
1798 struct UpdateMouseStateTaskData {
1799 UpdateMouseStateTaskData();
1804 struct UpdateMousePositionTaskData {
1805 UpdateMousePositionTaskData();
1811 struct CollisionCheckState {
1812 CollisionCheckState();
1818 struct BoundaryCheckState {
1819 BoundaryCheckState();
1822 uint currentContacts;
1824 bool positionResolved;
1827 struct ColliderInfo {
1830 size_t sceneStackDepth;
1837 void executeTeardown(
const Teardown &teardown);
1839 void executeHighLevelSceneReturn();
1842 void executeSharedScenePostSceneChangeActions();
1843 void executeSceneChangeRecursiveVisibilityChange(
Structural *structural,
bool showing);
1848 void recursiveAutoPlayMedia(
Structural *structural);
1849 void recursiveDeactivateStructural(
Structural *structural);
1850 void recursiveActivateStructural(
Structural *structural);
1852 static bool isStructuralMouseInteractive(
Structural *structural, MouseInteractivityTestType testType);
1853 static bool isModifierMouseInteractive(
Modifier *modifier, MouseInteractivityTestType testType);
1854 static void recursiveFindMouseCollision(
Structural *&bestResult, int32 &bestLayer, int32 &bestStackHeight,
bool &bestDirect,
Structural *candidate, int32 stackHeight, int32 relativeX, int32 relativeY, MouseInteractivityTestType testType);
1856 void queueEventAsLowLevelSceneStateTransitionAction(
const Event &evt,
Structural *root,
bool cascade,
bool relay);
1860 void ensureMainWindowExists();
1862 void unloadProject();
1863 void refreshPlayTime();
1865 struct DispatchMessageCoroutine {
1866 CORO_DEFINE_RETURN_TYPE(
void);
1870 struct SendMessageToStructuralCoroutine {
1871 CORO_DEFINE_RETURN_TYPE(
void);
1875 struct SendMessageToModifierContainerCoroutine {
1876 CORO_DEFINE_RETURN_TYPE(
void);
1880 struct SendMessageToModifierCoroutine {
1881 CORO_DEFINE_RETURN_TYPE(
void);
1885 VThreadState dispatchKeyTask(
const DispatchKeyTaskData &data);
1886 VThreadState dispatchActionTask(
const DispatchActionTaskData &data);
1887 VThreadState consumeMessageTask(
const ConsumeMessageTaskData &data);
1888 VThreadState consumeCommandTask(
const ConsumeCommandTaskData &data);
1889 VThreadState updateMouseStateTask(
const UpdateMouseStateTaskData &data);
1890 VThreadState updateMousePositionTask(
const UpdateMousePositionTaskData &data);
1891 VThreadState applyDefaultVisibility(
const ApplyDefaultVisibilityTaskData &data);
1893 void updateMainWindowCursor();
1896 static bool sortColliderPredicate(
const ColliderInfo &a,
const ColliderInfo &b);
1915 uint _pendingSceneReturnCount;
1922 SceneTransitionState _sceneTransitionState;
1928 uint32 _sceneTransitionStartTime;
1929 uint32 _sceneTransitionEndTime;
1930 bool _sharedSceneWasSetExplicitly;
1939 uint32 _nextRuntimeGUID;
1941 bool _displayModeSupported[kColorDepthModeCount];
1943 ColorDepthMode _realDisplayMode;
1944 ColorDepthMode _fakeDisplayMode;
1945 uint16 _displayWidth;
1946 uint16 _displayHeight;
1948 uint64 _realTimeBase;
1949 uint64 _playTimeBase;
1964 bool _lastFrameMouseVisible;
1967 bool _mouseFocusFlags[Actions::kMouseButtonCount];
1991 bool _trackedMouseOutside;
1992 bool _forceCursorRefreshOnce;
1993 bool _autoResetCursor;
1995 uint32 _modifierOverrideCursorID;
1996 bool _haveModifierOverrideCursor;
1997 bool _haveCursorElement;
1999 uint32 _multiClickStartTime;
2000 uint32 _multiClickInterval;
2001 uint _multiClickCount;
2003 uint _numMouseBlockers;
2005 bool _defaultVolumeState;
2008 bool _sceneGraphChanged;
2014 uint32 _collisionCheckTime;
2029 #ifdef MTROPOLIS_DEBUG_ENABLE 2037 virtual void removeModifier(
const Modifier *modifier) = 0;
2044 void removeModifier(
const Modifier *modifier)
override;
2053 template<
typename TElement,
typename TElementData>
2060 uint32 getStaticGUID()
const;
2061 uint32 getRuntimeGUID()
const;
2063 void setRuntimeGUID(uint32 runtimeGUID);
2068 virtual bool isStructural()
const;
2069 virtual bool isProject()
const;
2070 virtual bool isSection()
const;
2071 virtual bool isSubsection()
const;
2072 virtual bool isModifier()
const;
2073 virtual bool isElement()
const;
2090 uint32 _runtimeGUID;
2106 const Event &getEvent()
const;
2127 virtual bool respondsToEvent(
const Event &evt)
const = 0;
2147 bool _combineRedraws;
2148 bool _postponeRedraws;
2164 const int kFullVolume = 7;
2188 virtual void onCreate(
Structural *structural);
2189 virtual void onPostActivate(
Structural *structural);
2192 virtual void onHidden(
Structural *structural,
bool &visible);
2197 enum class SceneLoadState {
2207 bool isStructural()
const override;
2208 SceneLoadState getSceneLoadState()
const;
2209 void setSceneLoadState(SceneLoadState sceneLoadState);
2217 void removeAllChildren();
2218 void removeAllModifiers();
2220 void removeAllAssets();
2236 void removeModifier(
const Modifier *modifier)
override;
2238 bool respondsToEvent(
const Event &evt)
const override;
2245 CORO_DEFINE_RETURN_TYPE(
void);
2251 virtual void activate();
2252 virtual void deactivate();
2264 #ifdef MTROPOLIS_DEBUG_ENABLE 2265 SupportStatus debugGetSupportStatus()
const override;
2269 virtual void debugSkipMovies();
2286 virtual void onPauseStateChanged();
2306 int32 _flushPriority;
2307 SceneLoadState _sceneLoadState;
2320 uint32 bitsPerPixel;
2330 kTypeCountedModifierList,
2331 kTypeFlagTerminatedModifierList,
2334 kTypeFilteredElements,
2339 bool (*filterFunc)(Data::DataObjectTypes::DataObjectType dataObjectType);
2350 uint remainingCount;
2391 virtual void onSegmentUnloaded(
int segmentIndex) = 0;
2399 void onSegmentUnloaded();
2428 virtual void getCollisionProperties(
Modifier *&modifier,
bool &collideInFront,
bool &collideBehind,
bool &excludeParents)
const = 0;
2429 virtual void triggerCollision(
Runtime *runtime,
Structural *collidingElement,
bool wasInContact,
bool isInContact,
bool &outShouldStop) = 0;
2440 virtual void getCollisionProperties(
Modifier *&modifier, uint &edgeFlags,
bool &mustBeCompletelyOutside,
bool &continuous)
const = 0;
2441 virtual void triggerCollision(
Runtime *runtime) = 0;
2449 virtual Modifier *getMediaCueModifier() = 0;
2454 enum TriggerTiming {
2455 kTriggerTimingStart = 0,
2456 kTriggerTimingDuring = 1,
2457 kTriggerTimingEnd = 2,
2464 TriggerTiming triggerTiming;
2469 void checkTimestampChange(
Runtime *runtime, uint32 oldTS, uint32 newTS,
bool continuousTimestamps,
bool canTriggerDuring);
2490 bool isProject()
const override;
2494 bool getAssetIDByName(
const Common::String &assetName, uint32 &outAssetID)
const;
2497 size_t getSegmentForStreamIndex(
size_t streamIndex)
const;
2498 void openSegmentStream(
int segmentIndex);
2499 void closeSegmentStream(
int segmentIndex);
2504 void onPostRender();
2511 const char *findAuthorMessageName(uint32
id)
const;
2517 RuntimeVersion getRuntimeVersion()
const;
2518 ProjectPlatform getPlatform()
const;
2523 #ifdef MTROPOLIS_DEBUG_ENABLE 2524 const char *debugGetTypeName()
const override {
return "Project"; }
2528 struct LabelSuperGroup {
2531 size_t firstRootNodeIndex;
2532 size_t numRootNodes;
2533 size_t numTotalNodes;
2535 uint32 superGroupID;
2542 size_t firstChildIndex;
2570 StreamType streamType;
2571 uint16 segmentIndex;
2581 uint32 filePosition;
2589 void loadBootStream(
size_t streamIndex,
const Hacks &hacks);
2611 Data::ProjectFormat _projectFormat;
2620 bool _haveGlobalObjectInfo;
2621 bool _haveProjectStructuralDef;
2638 ProjectPlatform _platform;
2643 RuntimeVersion _runtimeVersion;
2644 bool _isRuntimeVersionAutoDetect;
2651 bool isSection()
const override;
2656 #ifdef MTROPOLIS_DEBUG_ENABLE 2657 const char *debugGetTypeName()
const override {
return "Section"; }
2676 bool isSubsection()
const override;
2681 #ifdef MTROPOLIS_DEBUG_ENABLE 2682 const char *debugGetTypeName()
const override {
return "Subsection"; }
2697 virtual bool isVisual()
const = 0;
2698 virtual bool canAutoPlay()
const;
2699 virtual void queueAutoPlayEvents(
Runtime *runtime,
bool isAutoPlaying);
2701 bool isElement()
const override;
2703 uint32 getStreamLocator()
const;
2708 void triggerAutoPlay(
Runtime *runtime);
2711 virtual bool resolveMediaMarkerLabel(
const Label &label, int32 &outResolution)
const;
2720 uint32 _streamLocator;
2725 bool _haveCheckedAutoPlay;
2732 uint8 getAlpha()
const;
2733 void setAlpha(uint8 alpha);
2735 bool isDirty()
const;
2750 kInkModeTransparent = 0x1,
2751 kInkModeGhost = 0x3,
2752 kInkModeReverseCopy = 0x4,
2753 kInkModeReverseGhost = 0x7,
2754 kInkModeReverseTransparent = 0x9,
2755 kInkModeBlend = 0x20,
2756 kInkModeBackgroundTransparent = 0x24,
2757 kInkModeChameleonDark = 0x25,
2758 kInkModeChameleonLight = 0x27,
2759 kInkModeBackgroundMatte = 0x224,
2760 kInkModeInvisible = 0xffff,
2762 kInkModeXor = 0x7ffffff0,
2763 kInkModeDefault = 0x7fffffff,
2768 kShapeRoundedRect = 0x2,
2770 kShapePolygon = 0x9,
2774 kShapeObsidianCanvasPuzzleTri1 = 0x7ffffff1,
2775 kShapeObsidianCanvasPuzzleTri2 = 0x7ffffff2,
2776 kShapeObsidianCanvasPuzzleTri3 = 0x7ffffff3,
2777 kShapeObsidianCanvasPuzzleTri4 = 0x7ffffff4,
2780 InkMode getInkMode()
const;
2781 void setInkMode(InkMode inkMode);
2783 Shape getShape()
const;
2784 void setShape(Shape shape);
2787 void setForeColor(
const ColorRGB8 &color);
2790 void setBackColor(
const ColorRGB8 &color);
2792 const ColorRGB8 &getBorderColor()
const;
2793 void setBorderColor(
const ColorRGB8 &color);
2795 const ColorRGB8 &getShadowColor()
const;
2796 void setShadowColor(
const ColorRGB8 &color);
2798 uint16 getBorderSize()
const;
2799 void setBorderSize(uint16 size);
2801 uint16 getShadowSize()
const;
2802 void setShadowSize(uint16 size);
2807 bool isDirty()
const;
2831 bool isVisual()
const override;
2832 virtual bool isTextLabel()
const;
2835 CORO_DEFINE_RETURN_TYPE(
void);
2841 bool respondsToEvent(
const Event &evt)
const override;
2844 bool isVisible()
const;
2845 bool isVisibleByDefault()
const;
2846 void setVisible(
Runtime *runtime,
bool visible);
2848 bool isDirectToScreen()
const;
2849 void setDirectToScreen(
bool directToScreen);
2851 uint16 getLayer()
const;
2852 void setLayer(uint16 layer);
2854 bool isMouseInsideDrawableArea(int32 relativeX, int32 relativeY)
const;
2857 virtual bool isMouseCollisionAtPoint(int32 relativeX, int32 relativeY)
const;
2872 void setCachedAbsoluteOrigin(
const Common::Point &absOrigin);
2892 void setShading(int16 topLeftBevelShading, int16 bottomRightBevelShading, int16 interiorShading, uint32 bevelSize);
2897 bool needsRender()
const;
2898 virtual void render(
Window *window) = 0;
2899 void finalizeRender();
2906 void pushVisibilityChangeTask(
Runtime *runtime,
bool desiredVisibility);
2908 #ifdef MTROPOLIS_DEBUG_ENABLE 2915 bool loadCommon(
const Common::String &name, uint32 guid,
const Data::Rect &rect, uint32 elementFlags, uint16 layer, uint32 streamLocator, uint16 sectionID);
2934 void offsetTranslate(int32 xDelta, int32 yDelta,
bool cachedOriginOnly);
2935 void resize(int32 width, int32 height);
2940 CORO_DEFINE_RETURN_TYPE(
void);
2957 static uint32 quantizeShading(uint32 mask, int16 shading);
2959 static void renderShadingScanlineDynamic(
void *data,
size_t numElements, uint32 rMask, uint32 rAdd, uint32 gMask, uint32 gAdd, uint32 bMask, uint32 bAdd,
bool isBrighten, byte bytesPerPixel);
2961 template<
class TElement>
2962 static void renderBrightenScanline(TElement *element,
size_t numElements, TElement rMask, TElement rAdd, TElement gMask, TElement gAdd, TElement bMask, TElement bAdd);
2964 template<
class TElement>
2965 static void renderDarkenScanline(TElement *element,
size_t numElements, TElement rMask, TElement rSub, TElement gMask, TElement gSub, TElement bMask, TElement bSub);
2967 bool _directToScreen;
2969 bool _visibleByDefault;
2974 int16 _topLeftBevelShading;
2975 int16 _bottomRightBevelShading;
2976 int16 _interiorShading;
2991 bool _contentsDirty;
2996 bool isVisual()
const override;
2998 bool loadCommon(
const Common::String &name, uint32 guid, uint32 elementFlags);
3005 bool load(
const uint32 dataModifierFlags);
3007 bool isLastModifier : 1;
3008 bool flagsWereLoaded : 1;
3017 virtual void commitLoad()
const = 0;
3032 virtual void onCreate(
Modifier *modifier);
3045 virtual bool isAlias()
const;
3046 virtual bool isVariable()
const;
3047 virtual bool isBehavior()
const;
3048 virtual bool isCompoundVariable()
const;
3049 virtual bool isKeyboardMessenger()
const;
3052 bool isModifier()
const override;
3064 bool respondsToEvent(
const Event &evt)
const override;
3077 virtual const char *getDefaultName()
const = 0;
3094 virtual void disable(
Runtime *runtime) = 0;
3096 #ifdef MTROPOLIS_DEBUG_ENABLE 3097 SupportStatus debugGetSupportStatus()
const override;
3129 virtual bool isVariable()
const override;
3130 virtual bool isListVariable()
const;
3138 virtual void varGetValue(
DynamicValue &dest)
const = 0;
3142 void disable(
Runtime *runtime)
override;
3146 #ifdef MTROPOLIS_DEBUG_ENABLE 3153 struct WriteProxyInterface {
3168 kAssetTypeColorTable,
3187 uint32 getAssetID()
const;
3189 virtual AssetType getAssetType()
const = 0;
Definition: managed_surface.h:51
Definition: runtime.h:1353
Definition: runtime.h:1058
Definition: runtime.h:816
Definition: runtime.h:418
Definition: runtime.h:1299
Definition: runtime.h:2151
Definition: runtime.h:2093
Definition: runtime.h:2034
Definition: runtime.h:3028
Definition: runtime.h:514
Definition: runtime.h:1172
Definition: runtime.h:469
Definition: runtime.h:2359
Definition: runtime.h:2413
Definition: runtime.h:1455
Definition: runtime.h:330
Definition: modifier_factory.h:30
Definition: runtime.h:3003
Definition: runtime.h:925
Definition: runtime.h:1637
Definition: runtime.h:1543
Definition: runtime.h:1192
Definition: runtime.h:2315
Definition: runtime.h:995
Definition: runtime.h:2337
EventType
Definition: events.h:49
Definition: runtime.h:1203
Definition: modifier_factory.h:44
Definition: runtime.h:2195
Definition: runtime.h:2409
Definition: runtime.h:2444
Definition: runtime.h:440
Definition: runtime.h:1575
Definition: runtime.h:488
Definition: runtime.h:503
Definition: runtime.h:2244
Definition: runtime.h:2693
Definition: runtime.h:2342
Definition: runtime.h:2052
Definition: runtime.h:2879
Definition: runtime.h:1185
Definition: runtime.h:2743
Definition: runtime.h:3035
Definition: runtime.h:2040
Definition: runtime.h:2647
Definition: runtime.h:2390
Definition: runtime.h:1049
Definition: miniscript.h:421
Definition: runtime.h:2827
Definition: runtime.h:544
Definition: archive.h:141
Definition: runtime.h:1197
Definition: runtime.h:1231
Definition: modifier_factory.h:48
Definition: noncopyable.h:39
Definition: runtime.h:369
Definition: runtime.h:2131
Definition: runtime.h:351
Definition: runtime.h:1079
Definition: runtime.h:1437
Definition: runtime.h:1560
Definition: runtime.h:1307
Definition: runtime.h:609
Definition: runtime.h:2432
Definition: runtime.h:1210
Definition: runtime.h:2355
Definition: runtime.h:574
Definition: runtime.h:2118
Definition: runtime.h:1326
Definition: runtime.h:624
Definition: runtime.h:2668
Definition: atari-cursor.h:38
Definition: runtime.h:1100
Definition: runtime.h:2944
Definition: runtime.h:1180
Definition: subtitles.h:123
Definition: runtime.h:3182
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: runtime.h:1108
Definition: runtime.h:3124
Definition: runtime.h:2939
Definition: runtime.h:1041
Definition: runtime.h:2162
Definition: runtime.h:1220
Definition: runtime.h:1533
Definition: saveload.h:59
Definition: runtime.h:3175
Definition: runtime.h:589
Definition: runtime.h:2994
Definition: vthread.h:133
Definition: runtime.h:114
Definition: runtime.h:744
Definition: runtime.h:1033
Definition: runtime.h:559
Definition: modifier_factory.h:40
Definition: saveload.h:54
Definition: runtime.h:2323
Definition: keyboard.h:294
Definition: runtime.h:1551
Definition: runtime.h:2125
Definition: runtime.h:1360
Definition: runtime.h:2327
Definition: runtime.h:2184
Definition: runtime.h:391
Definition: runtime.h:3011
Definition: runtime.h:2103
Definition: runtime.h:2427
Definition: runtime.h:1494
Definition: runtime.h:551
Definition: runtime.h:1253
Definition: runtime.h:2728
Definition: runtime.h:1419
Definition: runtime.h:2472
Definition: runtime.h:2394
Definition: runtime.h:1025
Definition: runtime.h:1376
Definition: runtime.h:2834
Definition: runtime.h:1385
Definition: runtime.h:536
Definition: runtime.h:964
Definition: runtime.h:595
Definition: runtime.h:3116
Language
Definition: language.h:45