From ed5dee43efb45e4d824ece375d4706fe6a930d9f Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 4 Mar 2019 17:04:03 +0100 Subject: [PATCH] [c][cpp] Fix for #1290, do not carry over time when timeScale of a track entry taht's being replaced by a new one is 0. --- spine-c/spine-c/src/spine/AnimationState.c | 2 +- spine-cpp/spine-cpp/src/spine/AnimationState.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-c/spine-c/src/spine/AnimationState.c b/spine-c/spine-c/src/spine/AnimationState.c index 890d3dae2..ca3abe557 100644 --- a/spine-c/spine-c/src/spine/AnimationState.c +++ b/spine-c/spine-c/src/spine/AnimationState.c @@ -280,7 +280,7 @@ void spAnimationState_update (spAnimationState* self, float delta) { float nextTime = current->trackLast - next->delay; if (nextTime >= 0) { next->delay = 0; - next->trackTime = (nextTime / current->timeScale + delta) * next->timeScale; + next->trackTime = current->timeScale == 0 ? 0 : (nextTime / current->timeScale + delta) * next->timeScale; current->trackTime += currentDelta; _spAnimationState_setCurrent(self, i, next, 1); while (next->mixingFrom) { diff --git a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp index 65016dadf..849d50649 100644 --- a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp +++ b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp @@ -334,7 +334,7 @@ void AnimationState::update(float delta) { float nextTime = current._trackLast - next->_delay; if (nextTime >= 0) { next->_delay = 0; - next->_trackTime = (nextTime / current._timeScale + delta) * next->_timeScale; + next->_trackTime = current._timeScale == 0 ? 0 : (nextTime / current._timeScale + delta) * next->_timeScale; current._trackTime += currentDelta; setCurrent(i, next, true); while (next->_mixingFrom != NULL) {