Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. oid FakeLagPrediction(C_BaseEntity *pBaseEntity)
  2. {
  3. if (!pBaseEntity)
  4. return;
  5.  
  6. for (int Index = 1; Index <= g_pGlobals->maxEntities; Index++)
  7. {
  8. C_BaseEntity *pIndex = (C_BaseEntity*)entitylist->GetClientEntity(Index);
  9. if (pIndex == pBaseEntity || !pIndex) continue;
  10. if (!pIndex->IsDormant() || pIndex->GetHealth() > 0 || pIndex->m_iTeamNum == pBaseEntity->m_iTeamNum) continue;
  11.  
  12. float flSimTime = pIndex->GetSimulationTime();
  13.  
  14. if (m_pPlayerlist[Index].old_flTickCount == flSimTime)
  15. {
  16. m_pPlayerlist[Index].flLostTick += 1.0f;
  17. }
  18. else
  19. {
  20. m_pPlayerlist[Index].flLostTick = 0.0f;
  21. }
  22.  
  23. m_pPlayerlist[Index].old_flTickCount = flSimTime;
  24.  
  25. if (m_pPlayerlist[Index].flLostTick >= 15.0f) m_pPlayerlist[Index].flLostTick = 0;
  26. }
  27. }
  28.  
  29. void ExtraPolation(C_BaseEntity *pBaseEntity, static Vector m_vecPosition, Vector &vEyePos, int Index)
  30. {
  31. C_BaseEntity *pEntity = (C_BaseEntity*)entitylist->GetClientEntity(Index);
  32. Vector vOld[65];
  33. Vector vOldMe;
  34. Vector vAccel[65];
  35. Vector vMyAccel;
  36. Vector vecEnemyVelocity = pEntity->GetVelocity();
  37. Vector vMyVel = pBaseEntity->GetVelocity();
  38. Vector vDelta = vecEnemyVelocity - vOld[Index];
  39.  
  40. vOld[Index] = vecEnemyVelocity;
  41. if (vDelta != Vector(0.0f, 0.0f, 0.0f))
  42. {
  43. vAccel[Index] = vDelta;
  44. }
  45.  
  46. Vector vDeltaMe = vMyVel - vOldMe;
  47. vOldMe = vMyVel;
  48.  
  49. if (vDeltaMe != Vector(0.0f, 0.0f, 0.0f))
  50. {
  51. vMyAccel = vDeltaMe;
  52. }
  53.  
  54. float flTick = g_pGlobals->interval_per_tick;
  55. int iFakeLagCmd = m_pPlayerlist[Index].flLostTick;
  56.  
  57. if (iFakeLagCmd > 5.0f)
  58. {
  59. flTick += g_pGlobals->interval_per_tick * m_pPlayerlist[Index].flLostTick;
  60.  
  61. if (vAccel[Index] != Vector(0.0f, 0.0f, 0.0f) || vMyAccel != Vector(0.0f, 0.0f, 0.0f))
  62. {
  63. Vector vDivide;
  64. VectorDivide((vAccel[Index] - vMyAccel) * sqrt(flTick) + (vecEnemyVelocity - vMyVel) * flTick + m_vecPosition - vEyePos, 0.5f, vDivide);
  65. m_vecPosition -= vDivide;
  66. g_pCVar->FindVar("cl_interpolate")->SetValue("0.695");
  67. g_pCVar->FindVar("cl_updaterate")->SetValue("1048576");
  68. g_pCVar->FindVar("cl_cmdrate")->SetValue("1048576");
  69. }
  70. }
  71.  
  72. if (iFakeLagCmd <= 5.0f && iFakeLagCmd > 1.0f)
  73. {
  74. flTick += g_pGlobals->interval_per_tick * m_pPlayerlist[Index].flLostTick;
  75.  
  76. if (vAccel[Index] != Vector(0.0f, 0.0f, 0.0f) || vMyAccel != Vector(0.0f, 0.0f, 0.0f))
  77. {
  78. Vector vDivide;
  79. VectorDivide((vAccel[Index] - vMyAccel) * sqrt(flTick) + (vecEnemyVelocity - vMyVel) * flTick + m_vecPosition - vEyePos, 0.5f, vDivide);
  80. m_vecPosition -= vDivide;
  81. g_pCVar->FindVar("cl_interpolate")->SetValue("0.7");
  82. g_pCVar->FindVar("cl_updaterate")->SetValue("66");
  83. g_pCVar->FindVar("cl_cmdrate")->SetValue("66");
  84. }
  85. }
  86.  
  87. if (iFakeLagCmd == 1.0f)
  88. {
  89. if (vAccel[Index] != Vector(0.0f, 0.0f, 0.0f) || vMyAccel != Vector(0.0f, 0.0f, 0.0f))
  90. {
  91. Vector vDivide;
  92. VectorDivide((vAccel[Index] - vMyAccel) * sqrt(flTick) + (vecEnemyVelocity - vMyVel) * flTick + m_vecPosition - vEyePos, 0.5f, vDivide);
  93. m_vecPosition += vDivide;
  94. g_pCVar->FindVar("cl_updaterate")->SetValue("67");
  95. g_pCVar->FindVar("cl_cmdrate")->SetValue("67");
  96. g_pCVar->FindVar("cl_interpolate")->SetValue("1");
  97. }
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement