void CMiscHacks::animation_fix()
{
if (interfaces::engine->IsConnected())
{
if (interfaces::engine->IsInGame())
{
if (hackManager.pLocal()->IsAlive())
{
if (hackManager.pLocal()->get_animation_state())
{
//start
auto OldCurtime = interfaces::globals->curtime;
auto OldFrametime = interfaces::globals->frametime;
auto OldFraction = hackManager.pLocal()->get_animation_state()->m_flUnknownFraction = 0; //FIXME nullptr crash
interfaces::globals->curtime = hackManager.pLocal()->GetSimulationTime();
interfaces::globals->frametime =
interfaces::globals->interval_per_tick *
interfaces::cvar->FindVar("host_timescale")->GetFloat();
CAnimationLayer Layers[15];
std::memcpy(Layers, hackManager.pLocal()->GetAnimOverlays(), (sizeof(CAnimationLayer) * hackManager.pLocal()->GetNumAnimOverlays()));
if (hackManager.pLocal()->get_animation_state())
hackManager.pLocal()->get_animation_state()->m_iLastClientSideAnimationUpdateFramecount = interfaces::globals->framecount - 1;
hackManager.pLocal()->client_side_animation() = true;
hackManager.pLocal()->UpdateClientSideAnimation();
hackManager.pLocal()->client_side_animation() = false;
//end
std::memcpy(hackManager.pLocal()->GetAnimOverlays(), Layers, (sizeof(CAnimationLayer) * hackManager.pLocal()->GetNumAnimOverlays()));
interfaces::globals->curtime = OldCurtime;
interfaces::globals->frametime = OldFrametime;
hackManager.pLocal()->get_animation_state()->m_flUnknownFraction = OldFraction;
//SkipAnimation(entity);
}
}
}
}
}