Skip to content

Commit

Permalink
[animations] fix bypass of 'CCSGOPlayerAnimState::Update()' method ch…
Browse files Browse the repository at this point in the history
…ecks

* closes #238
  • Loading branch information
rollraw committed Sep 22, 2023
1 parent 68ac1c2 commit 88759f3
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions base/features/animationcorrection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,19 @@ static void UpdatePlayer(CCSPlayer* pPlayer, AnimationUpdateObject_t& updateObje
// perform update when client had just received data from the server
if (nLastServerUpdateTick != I::Globals->nTickCount && flSimulationTime != pPlayer->GetOldSimulationTime())
{
// make sure it will guaranteed process update whenever we want
// can only happen on new game / inject a cheat while in game
if (pAnimationState->nLastUpdateFrame == I::Globals->nFrameCount)
{
pAnimationState->nLastUpdateFrame -= 1;
pAnimationState->flLastUpdateTime -= I::Globals->flIntervalPerTick;
}

// @todo: recheck everything and if it's not used somewhere in those calls, just set this directly through 'SetupBones()' call argument, since it's rebuilt now, it should work just fine
// force server update based time measurement values
I::Globals->flCurrentTime = flSimulationTime;
I::Globals->flFrameTime = I::Globals->flIntervalPerTick;

// make sure it will guaranteed process update whenever we want
// can only happen on new game / inject a cheat while in game
if (pAnimationState->nLastUpdateFrame == I::Globals->nFrameCount)
pAnimationState->nLastUpdateFrame--;

// force 'C_CSPlayer::UpdateClientSideAnimation()' to call 'CCSGOPlayerAnimState::Update()'
const bool bOldIsClientSideAnimation = pPlayer->IsClientSideAnimation();
pPlayer->IsClientSideAnimation() = true;
Expand Down Expand Up @@ -262,16 +265,19 @@ static void UpdateLocal(CCSPlayer* pLocal, AnimationUpdateObject_t& updateObject
if (nLastServerUpdateTick != I::Globals->nTickCount)
{
#pragma region animation_update_local_server
// make sure it will guaranteed process update whenever we want
// can only happen on new game / inject a cheat while in game
if (pAnimationState->nLastUpdateFrame == I::Globals->nFrameCount)
{
pAnimationState->nLastUpdateFrame -= 1;
pAnimationState->flLastUpdateTime -= I::Globals->flIntervalPerTick;
}

// @todo: recheck everything and if it's not used somewhere in those calls, just set this directly through 'SetupBones()' call argument, since it's rebuilt now, it should work just fine
// force server based time measurement values
I::Globals->flCurrentTime = flServerTime;
I::Globals->flFrameTime = I::Globals->flIntervalPerTick;

// make sure it will guaranteed process update whenever we want
// can only happen on new game / inject a cheat while in game
if (pAnimationState->nLastUpdateFrame == I::Globals->nFrameCount)
--pAnimationState->nLastUpdateFrame;

// perform animation update every frame
#if 0
/*
Expand Down

0 comments on commit 88759f3

Please sign in to comment.