Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (pEnt == Globals::LocalPlayer) {
- auto *player_animation_state = pEnt->AnimState();
- static AnimationLayer backup_layers[15];
- if (!backup_layers)
- {
- std::memcpy(backup_layers, Globals::LocalPlayer->GetAnimOverlays4(), (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
- }
- static float proper_abs = Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw;
- static float sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
- //static std::array<float, 24> sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
- static int oldtickcount = 0;
- if (Globals::LocalPlayer->AnimState()->m_iLastClientSideAnimationUpdateFramecount == g_pGlobalVars->framecount)
- {
- Globals::LocalPlayer->AnimState()->m_iLastClientSideAnimationUpdateFramecount = g_pGlobalVars->framecount - 1;
- }
- if (oldtickcount != CUserCmd().tick_count) // Only update animations each tick, though we are doing this each frame.
- {
- oldtickcount = CUserCmd().tick_count;
- std::memcpy(backup_layers, Globals::LocalPlayer->GetAnimOverlays4(), (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
- Globals::LocalPlayer->ClientAnimations(true); //just does stuff like set m_bClientSideAnimation and m_iLastAnimUpdateFrameCount
- Globals::LocalPlayer->UpdateState(Globals::LocalPlayer->AnimState(), Globals::pCmd->viewangles); Globals::LocalPlayer->SetAbsAngles(Vector(0, Globals::RealAngle.y, 0));
- if (Globals::bSendPacket)
- {
- proper_abs = Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw;
- sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
- }
- Globals::LocalPlayer->ClientAnimations(false);
- Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw = proper_abs;
- Globals::LocalPlayer->AnimState()->m_flUnknownFraction = 0.f; // Lol.
- std::memcpy(Globals::LocalPlayer->GetAnimOverlays4(), backup_layers, (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
- *Globals::LocalPlayer->m_flPoseParameter() = sent_pose_params;
- Globals::LocalPlayer->SetAbsAngles(Vector(0, proper_abs, 0));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement