C_CSGOPlayerAnimState *state = player->GetPlayerAnimState();
if (state)
{
// backup
const float curtime = g_GlobalVars->curtime;
const float frametime = g_GlobalVars->frametime;
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
g_GlobalVars->curtime = player->m_flSimulationTime();
int backup_eflags = player->m_iEFlags();
// SetLocalVelocity
player->m_iEFlags() &= ~0x1000; // InvalidatePhysicsRecursive(VELOCITY_CHANGED); EFL_DIRTY_ABSVELOCITY = 0x1000
player->m_vecAbsVelocity() = player->m_vecVelocity();
// invalidates prior animations
if (state->m_iLastClientSideAnimationUpdateFramecount() == g_GlobalVars->framecount)
state->m_iLastClientSideAnimationUpdateFramecount() = g_GlobalVars->framecount - 1;
player->m_bClientSideAnimation() = true;
float Resolved = player->m_angEyeAngles().yaw;
switch (m_iMissedShots[player->EntIndex()] % 2)
{
case 1: Resolved += player->DesyncValue();
case 2: Resolved -= player->DesyncValue();
}
state->m_flGoalFeetYaw = Resolved;
// updates local animations + poses + calculates new abs angle based on eyeangles and other stuff
player->UpdateClientSideAnimation();
player->m_bClientSideAnimation() = false;
// restore
player->m_iEFlags() = backup_eflags;
g_GlobalVars->curtime = curtime;
g_GlobalVars->frametime = frametime;
player->InvalidateBoneCache();
player->SetupBones(nullptr, -1, 0x7FF00, g_GlobalVars->curtime);
}