From 2de0a031c4fcc6a49a552f250405b5ac3107f5bf Mon Sep 17 00:00:00 2001 From: Armin Burgmeier Date: Sun, 11 Mar 2012 22:49:59 +0100 Subject: [PATCH] Fix loading mesh animations in scenario saves --- src/game/object/C4MeshAnimation.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/game/object/C4MeshAnimation.cpp b/src/game/object/C4MeshAnimation.cpp index a132c3c24..120f632d4 100644 --- a/src/game/object/C4MeshAnimation.cpp +++ b/src/game/object/C4MeshAnimation.cpp @@ -174,6 +174,18 @@ void C4ValueProviderLinear::CompileFunc(StdCompiler* pComp) pComp->Value(mkEnumAdaptT(Ending, Endings)); pComp->Separator(); pComp->Value(LastTick); + + // When a scenario is saved as scenario the FrameCounter will be reset + // upon scenario start. The LastTick variable is fixed here. + // TODO: A nicer solution would be to always set LastTick to + // Game.FrameCounter and to make sure that the Value is always up to + // date (current frame) when saving by running Execute(). This could + // even be done in the base class. + if(pComp->isCompiler()) + if(LastTick > Game.FrameCounter) + LastTick = 0; + + std::cout << Value.val << ", " << Begin.val << ", " << End.val << std::endl; } C4ValueProviderX::C4ValueProviderX(C4Object* object, C4Real pos, C4Real begin, C4Real end, int32_t length):