Advertisement
Guest User

Anim Local Fix

a guest
Nov 15th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. if (pEnt == Globals::LocalPlayer) {
  2. auto *player_animation_state = pEnt->AnimState();
  3. static AnimationLayer backup_layers[15];
  4. if (!backup_layers)
  5. {
  6. std::memcpy(backup_layers, Globals::LocalPlayer->GetAnimOverlays4(), (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
  7. }
  8.  
  9. static float proper_abs = Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw;
  10. static float sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
  11. //static std::array<float, 24> sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
  12. static int oldtickcount = 0;
  13.  
  14. if (Globals::LocalPlayer->AnimState()->m_iLastClientSideAnimationUpdateFramecount == g_pGlobalVars->framecount)
  15. {
  16. Globals::LocalPlayer->AnimState()->m_iLastClientSideAnimationUpdateFramecount = g_pGlobalVars->framecount - 1;
  17. }
  18.  
  19. if (oldtickcount != CUserCmd().tick_count) // Only update animations each tick, though we are doing this each frame.
  20. {
  21. oldtickcount = CUserCmd().tick_count;
  22. std::memcpy(backup_layers, Globals::LocalPlayer->GetAnimOverlays4(), (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
  23. Globals::LocalPlayer->ClientAnimations(true); //just does stuff like set m_bClientSideAnimation and m_iLastAnimUpdateFrameCount
  24. Globals::LocalPlayer->UpdateState(Globals::LocalPlayer->AnimState(), Globals::pCmd->viewangles); Globals::LocalPlayer->SetAbsAngles(Vector(0, Globals::RealAngle.y, 0));
  25.  
  26. if (Globals::bSendPacket)
  27. {
  28. proper_abs = Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw;
  29. sent_pose_params = *Globals::LocalPlayer->m_flPoseParameter();
  30. }
  31.  
  32. Globals::LocalPlayer->ClientAnimations(false);
  33. Globals::LocalPlayer->AnimState()->m_flGoalFeetYaw = proper_abs;
  34. Globals::LocalPlayer->AnimState()->m_flUnknownFraction = 0.f; // Lol.
  35. std::memcpy(Globals::LocalPlayer->GetAnimOverlays4(), backup_layers, (sizeof(AnimationLayer) * Globals::LocalPlayer->GetNumAnimOverlays()));
  36. *Globals::LocalPlayer->m_flPoseParameter() = sent_pose_params;
  37. Globals::LocalPlayer->SetAbsAngles(Vector(0, proper_abs, 0));
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement