Преглед на файлове

[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.

badlogic преди 6 години
родител
ревизия
ed5dee43ef
променени са 2 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 1 1
      spine-c/spine-c/src/spine/AnimationState.c
  2. 1 1
      spine-cpp/spine-cpp/src/spine/AnimationState.cpp

+ 1 - 1
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) {

+ 1 - 1
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) {