From 6bffa3a3f9ad1e82feed79948e75b4db5b770284 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Tue, 21 Jan 2025 23:51:16 +0100 Subject: [PATCH] fix animations possibly going nuts in the anim editor due to timer overflow handling --- BBGE/SkeletalSprite.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index 77235bc..badb045 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -2005,7 +2005,14 @@ void AnimationLayer::updateBones() unsigned nextidx = curidx + 1; if(nextidx > maxidx) + { + if(key1->t < timer) // past the last keyframe? just stay there (unless the timer wraps too) + { + key2 = key1; + break; + } nextidx = 0; + } key2 = &a->keyframes[nextidx]; if((key1->t <= timer && timer <= key2->t) || !maxidx) @@ -2021,8 +2028,6 @@ void AnimationLayer::updateBones() const float t2 = key2->t; assert(t1 <= t2); - - const float diff = t2-t1; float dt; if (diff != 0)