void Animations::UpdateLocalAnimations()
{
if (!g_cl.m_cmd || !g_cl.m_processing)
return;
CCSGOPlayerAnimState* state = g_cl.m_local->m_PlayerAnimState();
if (!state) {
return;
}
if (!g_csgo.m_cl) {
return;
}
// allow re-animating in the same frame.
if (state->m_iLastClientSideAnimationUpdateFramecount == g_csgo.m_globals->m_frame) {
state->m_iLastClientSideAnimationUpdateFramecount -= 1;
}
// update anim update delta as server build.
state->m_flUpdateTimeDelta = math::Max(0.0f, g_csgo.m_globals->m_curtime - state->m_flLastClientSideAnimationUpdateTime); // negative values possible when clocks on client and server go out of sync..
if (g_cl.m_animate) {
// get layers.
g_cl.m_local->GetAnimLayers(g_cl.m_real_layers);
// allow the game to update animations this tick.
g_cl.m_update = true;
// update animations.
game::UpdateAnimationState(state, g_cl.m_angle);
g_cl.m_local->UpdateClientSideAnimation();
// disallow the game from updating animations this tick.
g_cl.m_update = false;
// save data when our choke cycle resets.
if (!g_csgo.m_cl->iChokedCommands) {
g_cl.m_rotation.y = state->m_flGoalFeetYaw;
g_cl.m_local->GetPoseParameters(g_cl.m_real_poses);
}
// remove model sway.
g_cl.m_real_layers[12].m_weight = 0.f;
// make sure to only animate once per tick.
g_cl.m_animate = false;
}
// update our layers and poses with the saved ones.
g_cl.m_local->SetAnimLayers(g_cl.m_real_layers);
g_cl.m_local->SetPoseParameters(g_cl.m_real_poses);
// update our real rotation.
g_cl.m_local->SetAbsAngles(g_cl.m_rotation);
// build bones.
setup_bones(g_cl.m_local, g_cl.m_real_matrix, 0x7FF00, g_cl.m_local->m_flSimulationTime());
}