ScummVM API documentation
modifiers.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 MTROPOLIS_MODIFIERS_H
23 #define MTROPOLIS_MODIFIERS_H
24 
25 #include "common/events.h"
26 
27 #include "mtropolis/render.h"
28 #include "mtropolis/runtime.h"
29 #include "mtropolis/data.h"
30 
31 namespace MTropolis {
32 
33 struct AudioMetadata;
34 class AudioPlayer;
35 class CachedAudio;
36 struct ModifierLoaderContext;
37 class MiniscriptProgram;
38 class MiniscriptReferences;
39 class MiniscriptThread;
40 
42 public:
44 
45  bool load(ModifierLoaderContext &context, const Data::BehaviorModifier &data);
46 
47  bool isBehavior() const override { return true; }
48 
49  const Common::Array<Common::SharedPtr<Modifier> > &getModifiers() const override;
50  void appendModifier(const Common::SharedPtr<Modifier> &modifier) override;
51  void removeModifier(const Modifier *modifier) override;
52 
53  IModifierContainer *getMessagePropagationContainer() override;
54  IModifierContainer *getChildContainer() override;
55 
56  bool respondsToEvent(const Event &evt) const override;
57  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
58  void disable(Runtime *runtime) override;
59 
60 #ifdef MTROPOLIS_DEBUG_ENABLE
61  const char *debugGetTypeName() const override { return "Behavior Modifier"; }
62  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
63  void debugInspect(IDebugInspectionReport *report) const override;
64 #endif
65 
66 private:
67  struct SwitchTaskData {
68  SwitchTaskData() : targetState(false), eventID(EventIDs::kNothing), runtime(nullptr) {}
69 
70  bool targetState;
71  EventIDs::EventID eventID;
72  Runtime *runtime;
73  };
74 
75  struct PropagateTaskData {
76  PropagateTaskData() : index(0), eventID(EventIDs::kNothing), runtime(nullptr) {}
77 
78  size_t index;
79  EventIDs::EventID eventID;
80  Runtime *runtime;
81  };
82 
83  struct DisableTaskData {
84  DisableTaskData() : runtime(nullptr) {}
85 
86  Runtime *runtime;
87  };
88 
89  VThreadState switchTask(const SwitchTaskData &taskData);
90  VThreadState propagateTask(const PropagateTaskData &taskData);
91  VThreadState disableTask(const DisableTaskData &taskData);
92 
93  Common::SharedPtr<Modifier> shallowClone() const override;
94  const char *getDefaultName() const override;
95  void linkInternalReferences(ObjectLinkingScope *scope) override;
96  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
97 
99 
100  Event _enableWhen;
101  Event _disableWhen;
102  bool _switchable;
103  bool _isEnabled;
104 };
105 
106 class MiniscriptModifier : public Modifier {
107 public:
108  bool load(ModifierLoaderContext &context, const Data::MiniscriptModifier &data);
109 
110  bool respondsToEvent(const Event &evt) const override;
111  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
112 
113  void disable(Runtime *runtime) override {}
114 
115 #ifdef MTROPOLIS_DEBUG_ENABLE
116  const char *debugGetTypeName() const override { return "Miniscript Modifier"; }
117  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
118 #endif
119 
120 private:
121  Common::SharedPtr<Modifier> shallowClone() const override;
122  const char *getDefaultName() const override;
123  void linkInternalReferences(ObjectLinkingScope *scope) override;
124  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
125 
126  Event _enableWhen;
127 
130 };
131 
132 class ColorTableModifier : public Modifier {
133 public:
135 
136  bool load(ModifierLoaderContext &context, const Data::ColorTableModifier &data);
137 
138  bool respondsToEvent(const Event &evt) const override;
139  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
140 
141  void disable(Runtime *runtime) override {}
142 
143 #ifdef MTROPOLIS_DEBUG_ENABLE
144  const char *debugGetTypeName() const override { return "Color Table Modifier"; }
145  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
146 #endif
147 
148 private:
149  Common::SharedPtr<Modifier> shallowClone() const override;
150  const char *getDefaultName() const override;
151 
152  Event _applyWhen;
153 
154  uint32 _assetID;
155 };
156 
157 class SoundFadeModifier : public Modifier {
158 public:
160 
161  bool load(ModifierLoaderContext &context, const Data::SoundFadeModifier &data);
162 
163  bool respondsToEvent(const Event &evt) const override;
164  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
165 
166  void disable(Runtime *runtime) override {}
167 
168 #ifdef MTROPOLIS_DEBUG_ENABLE
169  const char *debugGetTypeName() const override { return "Sound Fade Modifier"; }
170  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
171 #endif
172 
173 private:
174  Common::SharedPtr<Modifier> shallowClone() const override;
175  const char *getDefaultName() const override;
176 
177  Event _enableWhen;
178  Event _disableWhen;
179 
180  uint16 _fadeToVolume;
181  uint32 _durationMSec;
182 };
183 
185 public:
186  bool load(ModifierLoaderContext &context, const Data::SaveAndRestoreModifier &data);
187 
188  bool respondsToEvent(const Event &evt) const override;
189  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
190 
191  void disable(Runtime *runtime) override {}
192 
193 #ifdef MTROPOLIS_DEBUG_ENABLE
194  const char *debugGetTypeName() const override { return "Save And Restore Modifier"; }
195  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
196 #endif
197 
198 protected:
199  void linkInternalReferences(ObjectLinkingScope *scope) override;
200  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
201 
202 private:
203  Common::SharedPtr<Modifier> shallowClone() const override;
204  const char *getDefaultName() const override;
205 
206  Event _saveWhen;
207  Event _restoreWhen;
208 
209  DynamicValueSource _saveOrRestoreValue;
210 
211  Common::String _filePath;
212  Common::String _fileName;
213 };
214 
215 class MessengerModifier : public Modifier {
216 public:
217  bool load(ModifierLoaderContext &context, const Data::MessengerModifier &data);
218 
219  bool respondsToEvent(const Event &evt) const override;
220  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
221 
222  void disable(Runtime *runtime) override {}
223 
224  void linkInternalReferences(ObjectLinkingScope *outerScope) override;
225  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
226 
227 #ifdef MTROPOLIS_DEBUG_ENABLE
228  const char *debugGetTypeName() const override { return "Messenger Modifier"; }
229  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
230 #endif
231 
232 private:
233  Common::SharedPtr<Modifier> shallowClone() const override;
234  const char *getDefaultName() const override;
235 
236  Event _when;
237  MessengerSendSpec _sendSpec;
238 };
239 
240 class SetModifier : public Modifier {
241 public:
242  bool load(ModifierLoaderContext &context, const Data::SetModifier &data);
243 
244  bool respondsToEvent(const Event &evt) const override;
245  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
246 
247  void disable(Runtime *runtime) override {}
248 
249  void linkInternalReferences(ObjectLinkingScope *outerScope) override;
250  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
251 
252 #ifdef MTROPOLIS_DEBUG_ENABLE
253  const char *debugGetTypeName() const override { return "Set Modifier"; }
254  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
255 #endif
256 
257 private:
258  Common::SharedPtr<Modifier> shallowClone() const override;
259  const char *getDefaultName() const override;
260 
261  Event _executeWhen;
262  DynamicValueSource _source;
263  DynamicValueSource _target;
264 };
265 
266 class AliasModifier : public Modifier {
267 public:
268  AliasModifier();
269 
270  bool load(ModifierLoaderContext &context, const Data::AliasModifier &data);
271  uint32 getAliasID() const;
272 
273  bool isAlias() const override;
274 
275  void disable(Runtime *runtime) override {}
276 
277 #ifdef MTROPOLIS_DEBUG_ENABLE
278  const char *debugGetTypeName() const override { return "Alias Modifier"; }
279  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
280 #endif
281 
282 private:
283  Common::SharedPtr<Modifier> shallowClone() const override;
284  const char *getDefaultName() const override;
285 
286  uint32 _aliasID;
287 };
288 
290 public:
291  bool load(ModifierLoaderContext &context, const Data::ChangeSceneModifier &data);
292 
293  bool respondsToEvent(const Event &evt) const override;
294  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
295 
296  void disable(Runtime *runtime) override {}
297 
298 #ifdef MTROPOLIS_DEBUG_ENABLE
299  const char *debugGetTypeName() const override { return "Change Scene Modifier"; }
300  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
301 #endif
302 
303 private:
304  Common::SharedPtr<Modifier> shallowClone() const override;
305  const char *getDefaultName() const override;
306 
307  enum SceneSelectionType {
308  kSceneSelectionTypeNext,
309  kSceneSelectionTypePrevious,
310  kSceneSelectionTypeSpecific,
311  };
312 
313  Event _executeWhen;
314  SceneSelectionType _sceneSelectionType;
315  uint32 _targetSectionGUID;
316  uint32 _targetSubsectionGUID;
317  uint32 _targetSceneGUID;
318  bool _addToReturnList;
319  bool _addToDestList;
320  bool _wrapAround;
321 };
322 
324 public:
326 
327  bool load(ModifierLoaderContext &context, const Data::SoundEffectModifier &data);
328 
329  bool respondsToEvent(const Event &evt) const override;
330  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
331  void disable(Runtime *runtime) override;
332 
333 #ifdef MTROPOLIS_DEBUG_ENABLE
334  const char *debugGetTypeName() const override { return "Sound Effect Modifier"; }
335  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
336 #endif
337 
338 private:
339  Common::SharedPtr<Modifier> shallowClone() const override;
340  const char *getDefaultName() const override;
341 
342  enum SoundType {
343  kSoundTypeBeep,
344  kSoundTypeAudioAsset,
345  };
346 
347  void loadAndCacheAudio(Runtime *runtime);
348 
349  Event _executeWhen;
350  Event _terminateWhen;
351 
352  SoundType _soundType;
353  uint32 _assetID;
354 
355  Common::SharedPtr<CachedAudio> _cachedAudio;
358 };
359 
360 class PathMotionModifier : public Modifier {
361 public:
364 
365  bool load(ModifierLoaderContext &context, const Data::PathMotionModifier &data);
366 
367  bool respondsToEvent(const Event &evt) const override;
368  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
369  void disable(Runtime *runtime) override;
370 
371  void linkInternalReferences(ObjectLinkingScope *scope) override;
372  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
373 
374 #ifdef MTROPOLIS_DEBUG_ENABLE
375  const char *debugGetTypeName() const override { return "Path Motion Modifier"; }
376  SupportStatus debugGetSupportStatus() const override { return kSupportStatusPartial; }
377 #endif
378 
379 private:
380  struct PointDef {
381  PointDef();
382 
383  Common::Point point;
384  uint32 frame;
385  bool useFrame;
386 
387  MessengerSendSpec sendSpec;
388  };
389 
390  struct ExecuteTaskData {
391  ExecuteTaskData() : runtime(nullptr) {}
392 
393  Runtime *runtime;
394  };
395 
396  struct TerminateTaskData {
397  TerminateTaskData() : runtime(nullptr) {}
398 
399  Runtime *runtime;
400  };
401 
402  struct ChangePointsTaskData {
403  ChangePointsTaskData() : runtime(nullptr), prevPoint(0), newPoint(0), isTerminal(false) {}
404 
405  Runtime *runtime;
406  uint prevPoint;
407  uint newPoint;
408  bool isTerminal;
409  };
410 
411  struct TriggerMessageTaskData {
412  TriggerMessageTaskData() : runtime(nullptr), pointIndex(0) {}
413 
414  Runtime *runtime;
415  uint pointIndex;
416  };
417 
418  struct SendMessageToParentTaskData {
419  SendMessageToParentTaskData() : runtime(nullptr), eventID(EventIDs::kNothing) {}
420 
421  Runtime *runtime;
422  EventIDs::EventID eventID;
423  };
424 
425  struct ChangeCelTaskData {
426  ChangeCelTaskData() : runtime(nullptr), pointIndex(0) {}
427 
428  Runtime *runtime;
429  uint pointIndex;
430  };
431 
432  struct ChangePositionTaskData {
433  ChangePositionTaskData() : runtime(nullptr) {}
434 
435  Runtime *runtime;
436  Common::Point positionDelta;
437  };
438 
439  struct AdvanceFrameTaskData {
440  AdvanceFrameTaskData() : runtime(nullptr), terminationTimeDUSec(0) {}
441 
442  Runtime *runtime;
443  uint64 terminationTimeDUSec;
444  };
445 
446  VThreadState executeTask(const ExecuteTaskData &taskData);
447  VThreadState terminateTask(const TerminateTaskData &taskData);
448  VThreadState changePointsTask(const ChangePointsTaskData &taskData);
449  VThreadState triggerMessageTask(const TriggerMessageTaskData &taskData);
450  VThreadState sendMessageToParentTask(const SendMessageToParentTaskData &taskData);
451  VThreadState changeCelTask(const ChangeCelTaskData &taskData);
452  VThreadState changePositionTask(const ChangePositionTaskData &taskData);
453  VThreadState advanceFrameTask(const AdvanceFrameTaskData &taskData);
454 
455  void scheduleNextAdvance(Runtime *runtime, uint64 startingFromTimeDUSec);
456  void advance(Runtime *runtime);
457 
458  Common::SharedPtr<Modifier> shallowClone() const override;
459  const char *getDefaultName() const override;
460 
461  Event _executeWhen;
462  Event _terminateWhen;
463 
464  bool _reverse;
465  bool _loop;
466  bool _alternate;
467  bool _startAtBeginning;
468 
469  uint64 _frameDurationDUSec;
470 
471  Common::Array<PointDef> _points;
472 
473  DynamicValue _incomingData;
474 
475  Common::WeakPtr<RuntimeObject> _triggerSource;
476  Common::SharedPtr<ScheduledEvent> _scheduledEvent;
477  bool _isAlternatingDirection;
478  uint _currentPointIndex;
479  uint64 _lastPointTimeDUSec;
480 };
481 
483 public:
486 
487  bool load(ModifierLoaderContext &context, const Data::SimpleMotionModifier &data);
488 
489  bool respondsToEvent(const Event &evt) const override;
490  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
491  void disable(Runtime *runtime) override;
492 
493 #ifdef MTROPOLIS_DEBUG_ENABLE
494  const char *debugGetTypeName() const override { return "Simple Motion Modifier"; }
495  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
496 #endif
497 
498 private:
499  enum MotionType {
500  kMotionTypeOutOfScene = 1,
501  kMotionTypeIntoScene = 2,
502  kMotionTypeRandomBounce = 3,
503  };
504 
505  enum DirectionFlags {
506  kDirectionFlagDown = 1,
507  kDirectionFlagUp = 2,
508  kDirectionFlagRight = 4,
509  kDirectionFlagLeft = 8,
510  };
511 
512  void startRandomBounce(Runtime *runtime);
513  void runRandomBounce(Runtime *runtime);
514 
515  Common::SharedPtr<Modifier> shallowClone() const override;
516  const char *getDefaultName() const override;
517 
518  Event _executeWhen;
519  Event _terminateWhen;
520 
521  MotionType _motionType;
522  uint16 _directionFlags;
523  uint16 _steps;
524  uint32 _delayMSecTimes4800;
525 
526  uint64 _lastTickTime;
527 
528  Common::Point _velocity;
529 
530  Common::SharedPtr<ScheduledEvent> _scheduledEvent;
531 };
532 
533 class DragMotionModifier : public Modifier {
534 public:
535  bool load(ModifierLoaderContext &context, const Data::DragMotionModifier &data);
536 
537  bool respondsToEvent(const Event &evt) const override;
538  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
539  void disable(Runtime *runtime) override;
540 
541 #ifdef MTROPOLIS_DEBUG_ENABLE
542  const char *debugGetTypeName() const override { return "Drag Motion Modifier"; }
543  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
544 #endif
545 
546 private:
547  Common::SharedPtr<Modifier> shallowClone() const override;
548  const char *getDefaultName() const override;
549 
550  Event _enableWhen;
551  Event _disableWhen;
552 
554 };
555 
557 public:
559 
560  bool load(ModifierLoaderContext &context, const Data::VectorMotionModifier &data);
561 
562  bool respondsToEvent(const Event &evt) const override;
563  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
564  void disable(Runtime *runtime) override;
565 
566 #ifdef MTROPOLIS_DEBUG_ENABLE
567  const char *debugGetTypeName() const override { return "Vector Modifier"; }
568  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
569 #endif
570 
571 private:
572  Common::SharedPtr<Modifier> shallowClone() const override;
573  const char *getDefaultName() const override;
574  void linkInternalReferences(ObjectLinkingScope *scope) override;
575  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
576 
577  void trigger(Runtime *runtime);
578 
579  Event _enableWhen;
580  Event _disableWhen;
581 
582  DynamicValueSource _vec;
583 
584  AngleMagVector _resolvedVector;
585  uint16 _subpixelX;
586  uint16 _subpixelY;
587 
588  Common::SharedPtr<ScheduledEvent> _scheduledEvent;
589  uint64 _lastTickTime;
590 };
591 
593 public:
594  bool load(ModifierLoaderContext &context, const Data::SceneTransitionModifier &data);
595 
596  bool respondsToEvent(const Event &evt) const override;
597  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
598  void disable(Runtime *runtime) override;
599 
600 #ifdef MTROPOLIS_DEBUG_ENABLE
601  const char *debugGetTypeName() const override { return "Scene Transition Modifier"; }
602  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
603 #endif
604 
605 private:
606  Common::SharedPtr<Modifier> shallowClone() const override;
607  const char *getDefaultName() const override;
608 
609  Event _enableWhen;
610  Event _disableWhen;
611 
612  uint32 _duration; // 6000000 is maximum
613  uint16 _steps;
614  SceneTransitionTypes::SceneTransitionType _transitionType;
615  SceneTransitionDirections::SceneTransitionDirection _transitionDirection;
616 };
617 
619 public:
622 
623  bool load(ModifierLoaderContext &context, const Data::ElementTransitionModifier &data);
624 
625  bool respondsToEvent(const Event &evt) const override;
626  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
627  void disable(Runtime *runtime) override;
628 
629  enum TransitionType {
630  kTransitionTypeRectangularIris,
631  kTransitionTypeOvalIris,
632  kTransitionTypeZoom,
633  kTransitionTypeFade,
634  };
635 
636  enum RevealType {
637  kRevealTypeReveal,
638  kRevealTypeConceal,
639  };
640 
641 #ifdef MTROPOLIS_DEBUG_ENABLE
642  const char *debugGetTypeName() const override { return "Element Transition Modifier"; }
643  SupportStatus debugGetSupportStatus() const override { return kSupportStatusPartial; }
644 #endif
645 
646 private:
647  Common::SharedPtr<Modifier> shallowClone() const override;
648  const char *getDefaultName() const override;
649 
650  void continueTransition(Runtime *runtime);
651  void completeTransition(Runtime *runtime);
652 
653  void setTransitionProgress(uint32 steps, uint32 maxSteps);
654 
655  Event _enableWhen;
656  Event _disableWhen;
657 
658  uint32 _rate; // Steps per second
659  uint16 _steps;
660  TransitionType _transitionType;
661  RevealType _revealType;
662 
663  uint64 _transitionStartTime;
664  uint32 _currentStep;
665 
666  Common::SharedPtr<ScheduledEvent> _scheduledEvent;
667 };
668 
670 public:
673 
674  bool load(ModifierLoaderContext &context, const Data::SharedSceneModifier &data);
675 
676  bool respondsToEvent(const Event &evt) const override;
677  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
678  void disable(Runtime *runtime) override;
679 
680 #ifdef MTROPOLIS_DEBUG_ENABLE
681  const char *debugGetTypeName() const override { return "Shared Scene Modifier"; }
682  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
683 #endif
684 
685 private:
686  Common::SharedPtr<Modifier> shallowClone() const override;
687  const char *getDefaultName() const override;
688 
689  Event _executeWhen;
690 
691  uint32 _targetSectionGUID;
692  uint32 _targetSubsectionGUID;
693  uint32 _targetSceneGUID;
694 };
695 
697 public:
698  bool load(ModifierLoaderContext &context, const Data::IfMessengerModifier &data);
699 
700  bool respondsToEvent(const Event &evt) const override;
701  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
702  void disable(Runtime *runtime) override {}
703 
704 #ifdef MTROPOLIS_DEBUG_ENABLE
705  const char *debugGetTypeName() const override { return "If Messenger Modifier"; }
706  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
707 #endif
708 
709 private:
710  struct RunEvaluateAndSendCoroutine {
711  CORO_DEFINE_RETURN_TYPE(void);
712  CORO_DEFINE_PARAMS_3(IfMessengerModifier *, self, Runtime *, runtime, Common::SharedPtr<MessageProperties>, msg);
713  };
714 
715  Common::SharedPtr<Modifier> shallowClone() const override;
716  const char *getDefaultName() const override;
717  void linkInternalReferences(ObjectLinkingScope *scope) override;
718  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
719 
720  Event _when;
721  MessengerSendSpec _sendSpec;
722 
725 };
726 
728 public:
731 
732  bool load(ModifierLoaderContext &context, const Data::TimerMessengerModifier &data);
733 
734  bool respondsToEvent(const Event &evt) const override;
735  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
736  void disable(Runtime *runtime) override;
737 
738  void linkInternalReferences(ObjectLinkingScope *outerScope) override;
739  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
740 
741 #ifdef MTROPOLIS_DEBUG_ENABLE
742  const char *debugGetTypeName() const override { return "Timer Messenger Modifier"; }
743  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
744 #endif
745 
746 private:
747  Common::SharedPtr<Modifier> shallowClone() const override;
748  const char *getDefaultName() const override;
749 
750  void trigger(Runtime *runtime);
751 
752  Event _executeWhen;
753  Event _terminateWhen;
754  MessengerSendSpec _sendSpec;
755  uint32 _milliseconds;
756  bool _looping;
757  DynamicValue _incomingData;
758 
759  Common::SharedPtr<ScheduledEvent> _scheduledEvent;
760  Common::WeakPtr<RuntimeObject> _triggerSource;
761 };
762 
764 public:
767 
768  bool load(ModifierLoaderContext &context, const Data::BoundaryDetectionMessengerModifier &data);
769 
770  bool respondsToEvent(const Event &evt) const override;
771  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
772  void disable(Runtime *runtime) override;
773 
774  void linkInternalReferences(ObjectLinkingScope *outerScope) override;
775  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
776 
777  void getCollisionProperties(Modifier *&modifier, uint &edgeFlags, bool &mustBeCompletelyOutside, bool &continuous) const override;
778  void triggerCollision(Runtime *runtime) override;
779 
780 #ifdef MTROPOLIS_DEBUG_ENABLE
781  const char *debugGetTypeName() const override { return "Boundary Detection Modifier"; }
782 #endif
783 
784 private:
785  Common::SharedPtr<Modifier> shallowClone() const override;
786  const char *getDefaultName() const override;
787 
788  enum ExitTriggerMode {
789  kExitTriggerExiting,
790  kExitTriggerOnceExited,
791  };
792 
793  enum DetectionMode {
794  kContinuous,
795  kOnFirstDetection,
796  };
797 
798  Event _enableWhen;
799  Event _disableWhen;
800  ExitTriggerMode _exitTriggerMode;
801  DetectionMode _detectionMode;
802  bool _detectTopEdge;
803  bool _detectBottomEdge;
804  bool _detectLeftEdge;
805  bool _detectRightEdge;
806  MessengerSendSpec _send;
807 
808  Runtime *_runtime;
809  bool _isActive;
810  DynamicValue _incomingData;
811  Common::WeakPtr<RuntimeObject> _triggerSource;
812 };
813 
815 public:
818 
819  bool load(ModifierLoaderContext &context, const Data::CollisionDetectionMessengerModifier &data);
820 
821  bool respondsToEvent(const Event &evt) const override;
822  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
823  void disable(Runtime *runtime) override;
824 
825  void linkInternalReferences(ObjectLinkingScope *scope) override;
826  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
827 
828 #ifdef MTROPOLIS_DEBUG_ENABLE
829  const char *debugGetTypeName() const override { return "Collision Detection Messenger Modifier"; }
830  SupportStatus debugGetSupportStatus() const override { return kSupportStatusPartial; }
831 #endif
832 
833 private:
834  Common::SharedPtr<Modifier> shallowClone() const override;
835  const char *getDefaultName() const override;
836 
837  struct EnableTaskData {
838  };
839 
840  struct DisableTaskData {
841  };
842 
843  VThreadState enableTask(const EnableTaskData &taskData);
844  VThreadState disableTask(const DisableTaskData &taskData);
845 
846  void getCollisionProperties(Modifier *&modifier, bool &collideInFront, bool &collideBehind, bool &excludeParents) const override;
847  void triggerCollision(Runtime *runtime, Structural *collidingElement, bool wasInContact, bool isInContact, bool &outShouldStop) override;
848 
849  enum DetectionMode {
850  kDetectionModeFirstContact,
851  kDetectionModeWhileInContact,
852  kDetectionModeExiting,
853  };
854 
855  Event _enableWhen;
856  Event _disableWhen;
857  MessengerSendSpec _sendSpec;
858 
859  DetectionMode _detectionMode;
860  bool _detectInFront;
861  bool _detectBehind;
862  bool _ignoreParent;
863  bool _sendToCollidingElement; // ... instead of to send spec destination, but send spec with/flags still apply!
864  bool _sendToOnlyFirstCollidingElement;
865 
866  Runtime *_runtime;
867  bool _isActive;
868 
869  DynamicValue _incomingData;
870  Common::WeakPtr<RuntimeObject> _triggerSource;
871 };
872 
874 public:
877 
878  bool isKeyboardMessenger() const override;
879 
880  bool load(ModifierLoaderContext &context, const Data::KeyboardMessengerModifier &data);
881 
882  bool respondsToEvent(const Event &evt) const override;
883  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
884  void disable(Runtime *runtime) override;
885 
886  bool checkKeyEventTrigger(Runtime *runtime, Common::EventType evtType, bool repeat, const Common::KeyState &keyEvt, Common::String &outChar) const;
887  void dispatchMessage(Runtime *runtime, const Common::String &charStr);
888 
889 #ifdef MTROPOLIS_DEBUG_ENABLE
890  const char *debugGetTypeName() const override { return "Keyboard Messenger Modifier"; }
891  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
892 #endif
893 
894 private:
895  Common::SharedPtr<Modifier> shallowClone() const override;
896  const char *getDefaultName() const override;
897 
898  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
899  void linkInternalReferences(ObjectLinkingScope *scope) override;
900 
901  enum KeyCodeType {
902  kAny = 0x00,
903  kHome = 0x01,
904  kEnter = 0x03,
905  kEnd = 0x04,
906  kHelp = 0x05,
907  kBackspace = 0x08,
908  kTab = 0x09,
909  kPageUp = 0x0b,
910  kPageDown = 0x0c,
911  kReturn = 0x0d,
912  kEscape = 0x1b,
913  kArrowLeft = 0x1c,
914  kArrowRight = 0x1d,
915  kArrowUp = 0x1e,
916  kArrowDown = 0x1f,
917  kDelete = 0x7f,
918  kMacRomanChar = 0xff,
919  };
920 
921  Event _send;
922 
923  bool _onDown : 1;
924  bool _onUp : 1;
925  bool _onRepeat : 1;
926  bool _keyModControl : 1;
927  bool _keyModCommand : 1;
928  bool _keyModOption : 1;
929  bool _isEnabled : 1;
930  KeyCodeType _keyCodeType;
931  char _macRomanChar;
932 
933  MessengerSendSpec _sendSpec;
934 };
935 
936 class TextStyleModifier : public Modifier {
937 public:
938  bool load(ModifierLoaderContext &context, const Data::TextStyleModifier &data);
939 
940  bool respondsToEvent(const Event &evt) const override;
941  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
942  void disable(Runtime *runtime) override;
943 
944 #ifdef MTROPOLIS_DEBUG_ENABLE
945  const char *debugGetTypeName() const override { return "Text Style Modifier"; }
946 #endif
947 
948 private:
949  Common::SharedPtr<Modifier> shallowClone() const override;
950  const char *getDefaultName() const override;
951 
952  uint16 _macFontID;
953  uint16 _size;
954  ColorRGB8 _textColor;
955  ColorRGB8 _backgroundColor;
956  TextAlignment _alignment;
957  TextStyleFlags _styleFlags;
958  Event _applyWhen;
959  Event _removeWhen;
960  Common::String _fontFamilyName;
961 };
962 
963 class GraphicModifier : public Modifier {
964 public:
965  bool load(ModifierLoaderContext &context, const Data::GraphicModifier &data);
966 
967  bool respondsToEvent(const Event &evt) const override;
968  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
969  void disable(Runtime *runtime) override;
970 
971 #ifdef MTROPOLIS_DEBUG_ENABLE
972  const char *debugGetTypeName() const override { return "Graphic Modifier"; }
973  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
974 #endif
975 
976 private:
977  Common::SharedPtr<Modifier> shallowClone() const override;
978  const char *getDefaultName() const override;
979 
980  Event _applyWhen;
981  Event _removeWhen;
982 
983  VisualElementRenderProperties _renderProps;
984 };
985 
987 public:
989 
990  bool load(ModifierLoaderContext &context, const Data::ImageEffectModifier &data);
991 
992  bool respondsToEvent(const Event &evt) const override;
993  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
994  void disable(Runtime *runtime) override;
995 
996 #ifdef MTROPOLIS_DEBUG_ENABLE
997  const char *debugGetTypeName() const override { return "Image Effect Modifier"; }
998  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
999 #endif
1000 
1001 private:
1002  enum Type {
1003  kTypeUnknown = 0,
1004 
1005  kTypeInvert = 1,
1006  kTypeSelectedBevels,
1007  kTypeDeselectedBevels,
1008  kTypeToneDown,
1009  kTypeToneUp,
1010  };
1011 
1012  struct ApplyTaskData {
1013  ApplyTaskData() : runtime(nullptr) {}
1014 
1015  Runtime *runtime;
1016  };
1017 
1018  struct RemoveTaskData {
1019  RemoveTaskData() : runtime(nullptr) {}
1020 
1021  Runtime *runtime;
1022  };
1023 
1024  Common::SharedPtr<Modifier> shallowClone() const override;
1025  const char *getDefaultName() const override;
1026 
1027  VThreadState applyTask(const ApplyTaskData &taskData);
1028  VThreadState removeTask(const RemoveTaskData &taskData);
1029 
1030  Event _applyWhen;
1031  Event _removeWhen;
1032  Type _type;
1033  uint16 _bevelWidth;
1034  uint16 _toneAmount;
1035  bool _includeBorders;
1036 };
1037 
1038 class ReturnModifier : public Modifier {
1039 public:
1040  ReturnModifier();
1041 
1042  bool load(ModifierLoaderContext &context, const Data::ReturnModifier &data);
1043 
1044  bool respondsToEvent(const Event &evt) const override;
1045  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
1046  void disable(Runtime *runtime) override;
1047 
1048 #ifdef MTROPOLIS_DEBUG_ENABLE
1049  const char *debugGetTypeName() const override { return "Return Modifier"; }
1050  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
1051 #endif
1052 
1053 private:
1054  Common::SharedPtr<Modifier> shallowClone() const override;
1055  const char *getDefaultName() const override;
1056 
1057  Event _executeWhen;
1058 };
1059 
1060 class CursorModifierV1 : public Modifier {
1061 public:
1062  CursorModifierV1();
1063 
1064  bool load(ModifierLoaderContext &context, const Data::CursorModifierV1 &data);
1065 
1066  bool respondsToEvent(const Event &evt) const override;
1067  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
1068  void disable(Runtime *runtime) override;
1069 
1070 #ifdef MTROPOLIS_DEBUG_ENABLE
1071  const char *debugGetTypeName() const override { return "Cursor Modifier V1"; }
1072  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
1073 #endif
1074 
1075 private:
1076  enum {
1077  kCursor_Inactive,
1078  kCursor_Interact,
1079  kCursor_HandGrabBW,
1080  kCursor_HandOpenBW,
1081  kCursor_HandPointUp,
1082  kCursor_HandPointRight,
1083  kCursor_HandPointLeft,
1084  kCursor_HandPointDown,
1085  kCursor_HandGrabColor,
1086  kCursor_HandOpenColor,
1087  kCursor_Arrow,
1088  kCursor_Pencil,
1089  kCursor_Smiley,
1090  kCursor_Wait,
1091  kCursor_Hidden,
1092  };
1093 
1094  Common::SharedPtr<Modifier> shallowClone() const override;
1095  const char *getDefaultName() const override;
1096 
1097  Event _applyWhen;
1098  uint32 _cursorIndex;
1099 };
1100 
1101 // Compound variable modifiers are not true variable modifiers.
1102 // They aren't treated as values by Miniscript and they aren't
1103 // treated as unique objects by aliases. The only way that
1104 // they behave like variable modifiers is that it's legal to
1105 // put them inside of CompoundVariableModifiers.
1107 public:
1108  bool load(ModifierLoaderContext &context, const Data::CompoundVariableModifier &data);
1109 
1110  void disable(Runtime *runtime) override;
1111 
1112  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1113 
1114  IModifierContainer *getChildContainer() override;
1115 
1116  bool isCompoundVariable() const override { return true; }
1117 
1118 #ifdef MTROPOLIS_DEBUG_ENABLE
1119  const char *debugGetTypeName() const override { return "Compound Variable Modifier"; }
1120  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1121 #endif
1122 
1123 private:
1124  class SaveLoad : public ModifierSaveLoad {
1125  public:
1126  SaveLoad(Runtime *runtime, CompoundVariableModifier *modifier);
1127 
1128  void saveInternal(Common::WriteStream *stream) const override;
1129  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1130  void commitLoad() const override;
1131 
1132  private:
1133  struct ChildSaveLoad {
1134  ChildSaveLoad();
1135 
1136  Modifier *modifier;
1138  };
1139 
1140  Common::Array<ChildSaveLoad> _childrenSaveLoad;
1141 
1142  //CompoundVariableModifier *_modifier;
1143  };
1144 
1145  Common::SharedPtr<Modifier> shallowClone() const override;
1146  const char *getDefaultName() const override;
1147 
1148  const Common::Array<Common::SharedPtr<Modifier> > &getModifiers() const override;
1149  void appendModifier(const Common::SharedPtr<Modifier> &modifier) override;
1150  void removeModifier(const Modifier *modifier) override;
1151  void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
1152 
1153  bool readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) override;
1154  bool readAttributeIndexed(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib, const DynamicValue &index) override;
1155  MiniscriptInstructionOutcome writeRefAttribute(MiniscriptThread *thread, DynamicValueWriteProxy &writeProxy, const Common::String &attrib) override;
1156  MiniscriptInstructionOutcome writeRefAttributeIndexed(MiniscriptThread *thread, DynamicValueWriteProxy &writeProxy, const Common::String &attrib, const DynamicValue &index) override;
1157 
1158  Modifier *findChildByName(Runtime *runtime, const Common::String &name) const;
1159 
1161 };
1162 
1164 public:
1166 
1167  bool load(ModifierLoaderContext &context, const Data::BooleanVariableModifier &data);
1168 
1169  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1170  void varGetValue(DynamicValue &dest) const override;
1171 
1172 #ifdef MTROPOLIS_DEBUG_ENABLE
1173  const char *debugGetTypeName() const override { return "Boolean Variable Modifier"; }
1174  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1175  void debugInspect(IDebugInspectionReport *report) const override;
1176 #endif
1177 
1178 private:
1179  Common::SharedPtr<Modifier> shallowClone() const override;
1180  const char *getDefaultName() const override;
1181 };
1182 
1184 public:
1185  friend class BooleanVariableModifier;
1186 
1188 
1189  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1190 
1191  Common::SharedPtr<VariableStorage> clone() const override;
1192 
1193 private:
1194  class SaveLoad : public ModifierSaveLoad {
1195  public:
1196  explicit SaveLoad(BooleanVariableStorage *modifier);
1197 
1198  private:
1199  void commitLoad() const override;
1200  void saveInternal(Common::WriteStream *stream) const override;
1201  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1202 
1203  BooleanVariableStorage *_storage;
1204  bool _value;
1205  };
1206 
1207  bool _value;
1208 };
1209 
1211 public:
1213 
1214  bool load(ModifierLoaderContext &context, const Data::IntegerVariableModifier &data);
1215 
1216  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1217  void varGetValue(DynamicValue &dest) const override;
1218 
1219 #ifdef MTROPOLIS_DEBUG_ENABLE
1220  const char *debugGetTypeName() const override { return "Integer Variable Modifier"; }
1221  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1222  void debugInspect(IDebugInspectionReport *report) const override;
1223 #endif
1224 
1225 private:
1226  Common::SharedPtr<Modifier> shallowClone() const override;
1227  const char *getDefaultName() const override;
1228 };
1229 
1231 public:
1232  friend class IntegerVariableModifier;
1233 
1235 
1236  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1237 
1238  Common::SharedPtr<VariableStorage> clone() const override;
1239 
1240 private:
1241  class SaveLoad : public ModifierSaveLoad {
1242  public:
1243  explicit SaveLoad(IntegerVariableStorage *storage);
1244 
1245  private:
1246  void commitLoad() const override;
1247  void saveInternal(Common::WriteStream *stream) const override;
1248  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1249 
1250  IntegerVariableStorage *_storage;
1251  int32 _value;
1252  };
1253 
1254  int32 _value;
1255 };
1256 
1258 public:
1260 
1261  bool load(ModifierLoaderContext &context, const Data::IntegerRangeVariableModifier &data);
1262 
1263  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1264  void varGetValue(DynamicValue &dest) const override;
1265 
1266  bool readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) override;
1267  MiniscriptInstructionOutcome writeRefAttribute(MiniscriptThread *thread, DynamicValueWriteProxy &result, const Common::String &attrib) override;
1268 
1269 #ifdef MTROPOLIS_DEBUG_ENABLE
1270  const char *debugGetTypeName() const override { return "Integer Range Variable Modifier"; }
1271  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1272  void debugInspect(IDebugInspectionReport *report) const override;
1273 #endif
1274 
1275 private:
1276  Common::SharedPtr<Modifier> shallowClone() const override;
1277  const char *getDefaultName() const override;
1278 };
1279 
1281 public:
1282  friend class IntegerRangeVariableModifier;
1283 
1285 
1286  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1287 
1288  Common::SharedPtr<VariableStorage> clone() const override;
1289 
1290 private:
1291  class SaveLoad : public ModifierSaveLoad {
1292  public:
1293  explicit SaveLoad(IntegerRangeVariableStorage *storage);
1294 
1295  private:
1296  void commitLoad() const override;
1297  void saveInternal(Common::WriteStream *stream) const override;
1298  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1299 
1300  IntegerRangeVariableStorage *_storage;
1301  IntRange _range;
1302  };
1303 
1304  IntRange _range;
1305 };
1306 
1308 public:
1310 
1311  bool load(ModifierLoaderContext &context, const Data::VectorVariableModifier &data);
1312 
1313  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1314  void varGetValue(DynamicValue &dest) const override;
1315 
1316  bool readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) override;
1317  MiniscriptInstructionOutcome writeRefAttribute(MiniscriptThread *thread, DynamicValueWriteProxy &result, const Common::String &attrib) override;
1318 
1319 #ifdef MTROPOLIS_DEBUG_ENABLE
1320  const char *debugGetTypeName() const override { return "Vector Variable Modifier"; }
1321  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1322  void debugInspect(IDebugInspectionReport *report) const override;
1323 #endif
1324 
1325 private:
1326  Common::SharedPtr<Modifier> shallowClone() const override;
1327  const char *getDefaultName() const override;
1328 };
1329 
1331  friend class VectorVariableModifier;
1332 
1334 
1335  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1336 
1337  Common::SharedPtr<VariableStorage> clone() const override;
1338 
1339 private:
1340  class SaveLoad : public ModifierSaveLoad {
1341  public:
1342  explicit SaveLoad(VectorVariableStorage *storage);
1343 
1344  private:
1345  void commitLoad() const override;
1346  void saveInternal(Common::WriteStream *stream) const override;
1347  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1348 
1349  VectorVariableStorage *_storage;
1350  AngleMagVector _vector;
1351  };
1352 
1353  AngleMagVector _vector;
1354 };
1355 
1357 public:
1359 
1360  bool load(ModifierLoaderContext &context, const Data::PointVariableModifier &data);
1361 
1362  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1363  void varGetValue(DynamicValue &dest) const override;
1364 
1365  bool readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) override;
1366  MiniscriptInstructionOutcome writeRefAttribute(MiniscriptThread *thread, DynamicValueWriteProxy &writeProxy, const Common::String &attrib) override;
1367 
1368 #ifdef MTROPOLIS_DEBUG_ENABLE
1369  const char *debugGetTypeName() const override { return "Point Variable Modifier"; }
1370  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1371  void debugInspect(IDebugInspectionReport *report) const override;
1372 #endif
1373 
1374 private:
1375  Common::SharedPtr<Modifier> shallowClone() const override;
1376  const char *getDefaultName() const override;
1377 };
1378 
1380 public:
1381  friend class PointVariableModifier;
1382 
1384 
1385  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1386 
1387  Common::SharedPtr<VariableStorage> clone() const override;
1388 
1389 private:
1390  class SaveLoad : public ModifierSaveLoad {
1391  public:
1392  explicit SaveLoad(PointVariableStorage *storage);
1393 
1394  private:
1395  void commitLoad() const override;
1396  void saveInternal(Common::WriteStream *stream) const override;
1397  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1398 
1399  PointVariableStorage *_storage;
1400  Common::Point _value;
1401  };
1402 
1403  Common::Point _value;
1404 };
1405 
1407 public:
1409 
1410  bool load(ModifierLoaderContext &context, const Data::FloatingPointVariableModifier &data);
1411 
1412  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1413  void varGetValue(DynamicValue &dest) const override;
1414 
1415 #ifdef MTROPOLIS_DEBUG_ENABLE
1416  const char *debugGetTypeName() const override { return "Floating Point Variable Modifier"; }
1417  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1418  void debugInspect(IDebugInspectionReport *report) const override;
1419 #endif
1420 
1421 private:
1422  Common::SharedPtr<Modifier> shallowClone() const override;
1423  const char *getDefaultName() const override;
1424 };
1425 
1427 public:
1428  friend class FloatingPointVariableModifier;
1429 
1431 
1432  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1433 
1434  Common::SharedPtr<VariableStorage> clone() const override;
1435 
1436 private:
1437  class SaveLoad : public ModifierSaveLoad {
1438  public:
1439  explicit SaveLoad(FloatingPointVariableStorage *storage);
1440 
1441  private:
1442  void commitLoad() const override;
1443  void saveInternal(Common::WriteStream *stream) const override;
1444  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1445 
1446  FloatingPointVariableStorage *_storage;
1447  double _value;
1448  };
1449 
1450  double _value;
1451 };
1452 
1454 public:
1456 
1457  bool load(ModifierLoaderContext &context, const Data::StringVariableModifier &data);
1458 
1459  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1460  void varGetValue(DynamicValue &dest) const override;
1461 
1462 #ifdef MTROPOLIS_DEBUG_ENABLE
1463  const char *debugGetTypeName() const override { return "String Variable Modifier"; }
1464  SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
1465  void debugInspect(IDebugInspectionReport *report) const override;
1466 #endif
1467 
1468 private:
1469  Common::SharedPtr<Modifier> shallowClone() const override;
1470  const char *getDefaultName() const override;
1471 };
1472 
1474 public:
1475  friend class StringVariableModifier;
1476 
1478 
1479  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1480 
1481  Common::SharedPtr<VariableStorage> clone() const override;
1482 
1483 private:
1484  class SaveLoad : public ModifierSaveLoad {
1485  public:
1486  explicit SaveLoad(StringVariableStorage *storage);
1487 
1488  private:
1489  void commitLoad() const override;
1490  void saveInternal(Common::WriteStream *stream) const override;
1491  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1492 
1493  StringVariableStorage *_storage;
1494  Common::String _value;
1495  };
1496 
1497  Common::String _value;
1498 };
1499 
1501 public:
1503 
1504  bool load(ModifierLoaderContext &context, const Data::ObjectReferenceVariableModifierV1 &data);
1505 
1506  bool varSetValue(MiniscriptThread *thread, const DynamicValue &value) override;
1507  void varGetValue(DynamicValue &dest) const override;
1508 
1509  bool respondsToEvent(const Event &evt) const override;
1510  VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
1511 
1512  bool readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) override;
1513 
1514 #ifdef MTROPOLIS_DEBUG_ENABLE
1515  const char *debugGetTypeName() const override { return "Object Reference Variable Modifier V1"; }
1516  SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
1517 #endif
1518 
1519 private:
1520  Common::SharedPtr<Modifier> shallowClone() const override;
1521  const char *getDefaultName() const override;
1522 
1523  Event _setToSourcesParentWhen;
1524 };
1525 
1527 public:
1528  friend class ObjectReferenceVariableModifierV1;
1529 
1531 
1532  Common::SharedPtr<ModifierSaveLoad> getSaveLoad(Runtime *runtime) override;
1533 
1534  Common::SharedPtr<VariableStorage> clone() const override;
1535 
1536 private:
1537  class SaveLoad : public ModifierSaveLoad {
1538  public:
1539  explicit SaveLoad(ObjectReferenceVariableV1Storage *storage);
1540 
1541  private:
1542  void commitLoad() const override;
1543  void saveInternal(Common::WriteStream *stream) const override;
1544  bool loadInternal(Common::ReadStream *stream, uint32 saveFileVersion) override;
1545 
1548  };
1549 
1551 };
1552 
1553 } // End of namespace MTropolis
1554 
1555 #endif
Definition: runtime.h:816
Definition: runtime.h:2034
Definition: data.h:1755
Definition: str.h:59
Definition: runtime.h:469
Definition: data.h:1184
Definition: modifiers.h:266
Definition: runtime.h:330
Definition: modifier_factory.h:30
Definition: modifiers.h:986
Definition: ptr.h:115
Definition: runtime.h:925
Definition: stream.h:77
Definition: data.h:1209
Definition: modifiers.h:132
Definition: modifiers.h:1038
Definition: modifiers.h:482
Definition: array.h:52
EventType
Definition: events.h:49
Definition: modifiers.h:963
Definition: runtime.h:2195
Definition: render.h:53
Definition: modifiers.h:1280
Definition: data.h:1767
Definition: modifiers.h:1453
Definition: runtime.h:440
Definition: runtime.h:1575
Definition: modifiers.h:1230
Definition: data.h:1115
Definition: modifiers.h:533
Definition: runtime.h:3035
Definition: modifiers.h:592
Definition: miniscript.h:421
Definition: modifiers.h:1106
Definition: modifiers.h:1473
Definition: runtime.h:544
Definition: modifiers.h:1330
Definition: modifiers.h:618
Definition: data.h:1004
Definition: runtime.h:369
Definition: modifiers.h:240
Definition: modifiers.h:1257
Definition: runtime.h:1307
Definition: runtime.h:2432
Definition: modifiers.h:873
Definition: modifiers.h:1406
Definition: runtime.h:2118
Definition: data.h:1162
Definition: modifiers.h:1163
Definition: modifiers.h:184
Definition: modifiers.h:106
Definition: debug.h:59
Definition: modifiers.h:556
Definition: rect.h:45
Definition: modifiers.h:215
Definition: runtime.h:1108
Definition: runtime.h:3124
Definition: data.h:1659
Definition: actions.h:25
Definition: modifiers.h:289
Definition: modifiers.h:323
Definition: modifiers.h:360
Definition: modifiers.h:1379
Definition: modifiers.h:1307
Definition: keyboard.h:294
Definition: stream.h:385
Definition: modifiers.h:727
Definition: modifiers.h:669
Definition: modifiers.h:1183
Definition: modifiers.h:41
Definition: modifiers.h:696
Definition: runtime.h:3011
Definition: ptr.h:159
Definition: modifiers.h:936
Definition: runtime.h:2427
Definition: data.h:1683
Definition: modifiers.h:157
Definition: modifiers.h:1210
Definition: modifiers.h:1356
Definition: runtime.h:3116
Definition: modifiers.h:1060
Definition: modifiers.h:1426