diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 4cf15ff8292..d2b16477fd5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -286,7 +286,12 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } } @@ -307,7 +312,12 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if (!Is_Hierarchy_Valid()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } } @@ -805,7 +815,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) ModeInterp.PrevFrame1 = AnimatedSoundMgrClass::Trigger_Sound(ModeInterp.Motion1, ModeInterp.PrevFrame1, ModeInterp.Frame1, HTree->Get_Transform(ModeInterp.Motion1->Get_Embedded_Sound_Bone_Index())); } - break; + break; case MULTIPLE_ANIM: { @@ -1025,19 +1035,13 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the current frame (only works in "SINGLE_ANIM" mode!) // - if (CurMotionMode == SINGLE_ANIM) { + WWASSERT(CurMotionMode == SINGLE_ANIM); - // - // Update the frame number and sync time - // - ModeAnim.PrevFrame = ModeAnim.Frame; - ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - - // - // Force the hierarchy to be recalculated - // - Set_Hierarchy_Valid (false); - } + // + // Update the frame number and sync time + // + ModeAnim.PrevFrame = ModeAnim.Frame; + ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); } diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index b93b1bc775b..99e14f61aa5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -113,7 +113,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass // // Simple bone evaluation methods for when the caller doesn't want - // to update the heirarchy, but needs to know the transform of + // to update the hierarchy, but needs to know the transform of // a bone at a given frame. // virtual bool Simple_Evaluate_Bone(int boneindex, Matrix3D *tm) const; @@ -153,14 +153,14 @@ class Animatable3DObjClass : public CompositeRenderObjClass void Combo_Update( const Matrix3D & root, HAnimComboClass *anim); - // flag to kep track of whether the hierarchy tree transforms are currently valid + // flag to keep track of whether the hierarchy tree transforms are currently valid bool Is_Hierarchy_Valid(void) const { return IsTreeValid; } void Set_Hierarchy_Valid(bool onoff) const { IsTreeValid = onoff; } - // Progress anims for single anim (loop and once) + // Progress animations for single anim (loop and once) void Single_Anim_Progress( void ); - // Release any anims + // Release any animations void Release( void ); protected: diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp index 15e089a0bab..1c5d4483a40 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.cpp @@ -286,7 +286,12 @@ void Animatable3DObjClass::Render(RenderInfoClass & rinfo) return; } - if (!Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid() || Are_Sub_Object_Transforms_Dirty()) { Update_Sub_Object_Transforms(); } } @@ -307,7 +312,12 @@ void Animatable3DObjClass::Special_Render(SpecialRenderInfoClass & rinfo) { if (HTree == NULL) return; - if (!Is_Hierarchy_Valid()) { + // + // Force the hierarchy to be recalculated for single animations. + // + const bool isSingleAnim = CurMotionMode == SINGLE_ANIM && ModeAnim.AnimMode != ANIM_MODE_MANUAL; + + if (isSingleAnim || !Is_Hierarchy_Valid()) { Update_Sub_Object_Transforms(); } } @@ -804,7 +814,7 @@ void Animatable3DObjClass::Update_Sub_Object_Transforms(void) ModeInterp.PrevFrame1 = AnimatedSoundMgrClass::Trigger_Sound(ModeInterp.Motion1, ModeInterp.PrevFrame1, ModeInterp.Frame1, HTree->Get_Transform(ModeInterp.Motion1->Get_Embedded_Sound_Bone_Index())); } - break; + break; case MULTIPLE_ANIM: { @@ -1033,19 +1043,13 @@ void Animatable3DObjClass::Single_Anim_Progress (void) // // Update the current frame (only works in "SINGLE_ANIM" mode!) // - if (CurMotionMode == SINGLE_ANIM) { + WWASSERT(CurMotionMode == SINGLE_ANIM); - // - // Update the frame number and sync time - // - ModeAnim.PrevFrame = ModeAnim.Frame; - ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); - - // - // Force the hierarchy to be recalculated - // - Set_Hierarchy_Valid (false); - } + // + // Update the frame number and sync time + // + ModeAnim.PrevFrame = ModeAnim.Frame; + ModeAnim.Frame = Compute_Current_Frame(&ModeAnim.animDirection); } diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h index 437480caf16..5f0aa7c8d6e 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animobj.h @@ -113,7 +113,7 @@ class Animatable3DObjClass : public CompositeRenderObjClass // // Simple bone evaluation methods for when the caller doesn't want - // to update the heirarchy, but needs to know the transform of + // to update the hierarchy, but needs to know the transform of // a bone at a given frame. // virtual bool Simple_Evaluate_Bone(int boneindex, Matrix3D *tm) const; @@ -153,14 +153,14 @@ class Animatable3DObjClass : public CompositeRenderObjClass void Combo_Update( const Matrix3D & root, HAnimComboClass *anim); - // flag to kep track of whether the hierarchy tree transforms are currently valid + // flag to keep track of whether the hierarchy tree transforms are currently valid bool Is_Hierarchy_Valid(void) const { return IsTreeValid; } void Set_Hierarchy_Valid(bool onoff) const { IsTreeValid = onoff; } - // Progress anims for single anim (loop and once) + // Progress animations for single anim (loop and once) void Single_Anim_Progress( void ); - // Release any anims + // Release any animations void Release( void ); protected: