Prechádzať zdrojové kódy

[c][cpp] Port fix to AnimationState, see #1092

badlogic 7 rokov pred
rodič
commit
9651e0bc53

+ 2 - 2
spine-c/spine-c/src/spine/AnimationState.c

@@ -733,11 +733,11 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
 				if (last->loop) {
 					delay += duration * (1 + (int) (last->trackTime / duration));
 				} else {
-					delay += duration;
+					delay += MAX(duration, last->trackTime);
 				}
 				delay -= spAnimationStateData_getMix(self->data, last->animation, animation);
 			} else
-				delay = 0;
+				delay = last->trackTime;
 		}
 	}
 

+ 2 - 2
spine-cpp/spine-cpp/src/spine/AnimationState.cpp

@@ -582,11 +582,11 @@ TrackEntry *AnimationState::addAnimation(int trackIndex, Animation *animation, b
 				if (last->_loop) {
 					delay += duration * (1 + (int) (last->_trackTime / duration));
 				} else {
-					delay += duration;
+					delay += MathUtil::max(duration, last->_trackTime);
 				}
 				delay -= _data->getMix(last->_animation, animation);
 			} else {
-				delay = 0;
+				delay = last->_trackTime;
 			}
 		}
 	}