Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarNetworkedAnimator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarNetworkedAnimator.hpp')
-rw-r--r--source/game/StarNetworkedAnimator.hpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/source/game/StarNetworkedAnimator.hpp b/source/game/StarNetworkedAnimator.hpp
index 8265011..f3f6568 100644
--- a/source/game/StarNetworkedAnimator.hpp
+++ b/source/game/StarNetworkedAnimator.hpp
@@ -79,8 +79,13 @@ public:
// Returns whether a state change occurred. If startNew is true, always
// forces a state change and starts the state off at the beginning even if
// this state is already the current state.
- bool setState(String const& stateType, String const& state, bool startNew = false);
+ bool setState(String const& stateType, String const& state, bool startNew = false, bool reverse = false);
+ bool setLocalState(String const& stateType, String const& state, bool startNew = false, bool reverse = false);
String state(String const& stateType) const;
+ int stateFrame(String const& stateType) const;
+ float stateFrameProgress(String const& stateType) const;
+ float stateTimer(String const& stateType) const;
+ bool stateReverse(String const& stateType) const;
StringMap<AnimatedPartSet::Part> const& constParts() const;
StringMap<AnimatedPartSet::Part>& parts();
@@ -90,6 +95,7 @@ public:
// AnimatedPartSet for the given state or part. If the property does not
// exist, returns null.
Json stateProperty(String const& stateType, String const& propertyName) const;
+ Json stateNextProperty(String const& stateType, String const& propertyName) const;
Json partProperty(String const& partName, String const& propertyName) const;
// Returns the transformation from flipping and zooming that is applied to
@@ -120,6 +126,11 @@ public:
String const* globalTagPtr(String const& tagName) const;
void setPartTag(String const& partType, String tagName, String tagValue);
+ void setPartDrawables(String const& partName, List<Drawable> drawables);
+ void addPartDrawables(String const& partName, List<Drawable> drawables);
+
+ String applyPartTags(String const& partName, String apply);
+
void setProcessingDirectives(Directives const& directives);
void setZoom(float zoom);
bool flipped() const;
@@ -147,6 +158,13 @@ public:
void transformTransformationGroup(String const& transformationGroup, float a, float b, float c, float d, float tx, float ty);
void resetTransformationGroup(String const& transformationGroup);
+ void translateLocalTransformationGroup(String const& transformationGroup, Vec2F const& translation);
+ void rotateLocalTransformationGroup(String const& transformationGroup, float rotation, Vec2F const& rotationCenter = Vec2F());
+ void scaleLocalTransformationGroup(String const& transformationGroup, float scale, Vec2F const& scaleCenter = Vec2F());
+ void scaleLocalTransformationGroup(String const& transformationGroup, Vec2F const& scale, Vec2F const& scaleCenter = Vec2F());
+ void transformLocalTransformationGroup(String const& transformationGroup, float a, float b, float c, float d, float tx, float ty);
+ void resetLocalTransformationGroup(String const& transformationGroup);
+
bool hasParticleEmitter(String const& emitterName) const;
// Active particle emitters emit over time based on emission rate/variance.
void setParticleEmitterActive(String const& emitterName, bool active);
@@ -200,6 +218,7 @@ public:
// Run through the current animations until the final frame, including any
// transition animations.
void finishAnimations();
+ uint8_t version() const;
private:
struct RotationGroup {
@@ -216,14 +235,31 @@ private:
Mat3F affineTransform() const;
void setAffineTransform(Mat3F const& matrix);
+ Mat3F localAffineTransform() const;
+ void setLocalAffineTransform(Mat3F const& matrix);
+
+ Mat3F animationAffineTransform() const;
+ void setAnimationAffineTransform(Mat3F const& matrix);
+ void setAnimationAffineTransform(Mat3F const& mat1, Mat3F const& mat2, float progress);
+
bool interpolated;
+ Mat3F localTransform;
+
NetElementFloat xTranslation;
NetElementFloat yTranslation;
NetElementFloat xScale;
NetElementFloat yScale;
NetElementFloat xShear;
NetElementFloat yShear;
+
+ float xTranslationAnimation;
+ float yTranslationAnimation;
+ float xScaleAnimation;
+ float yScaleAnimation;
+ float xShearAnimation;
+ float yShearAnimation;
+
};
struct ParticleEmitter {
@@ -299,6 +335,8 @@ private:
struct StateInfo {
NetElementSize stateIndex;
NetElementEvent startedEvent;
+ bool wasUpdated;
+ NetElementBool reverse;
};
void setupNetStates();
@@ -306,7 +344,10 @@ private:
void netElementsNeedLoad(bool full) override;
void netElementsNeedStore() override;
+ Json mergeIncludes(Json config, Json includes, String relativePath);
+
String m_relativePath;
+ uint8_t m_animatorVersion;
AnimatedPartSet m_animatedParts;
OrderedHashMap<String, StateInfo> m_stateInfo;
@@ -327,6 +368,9 @@ private:
NetElementHashMap<String, String> m_globalTags;
StableStringMap<NetElementHashMap<String, String>> m_partTags;
+
+ HashMap<String,List<Drawable>> m_partDrawables;
+
mutable StringMap<std::pair<size_t, Drawable>> m_cachedPartDrawables;
};