Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. /*
  2. struct
  3. ;
  4.  
  5. struct CValidTick {
  6. explicit operator CTickRecord() const;
  7.  
  8. explicit operator bool() const noexcept {
  9. return m_flSimulationTime > 0.f;
  10. }
  11.  
  12. float m_flPitch = 0.f;
  13. float m_flYaw = 0.f;
  14. float m_flSimulationTime = 0.f;
  15. IClientEntity* m_pEntity = nullptr;
  16. };
  17.  
  18. struct CTickRecord {
  19. CTickRecord() {}
  20. CTickRecord(IClientEntity* ent) {
  21. m_flLowerBodyYawTarget = ent->GetLowerBodyYaw();
  22. m_angEyeAngles = ent->GetEyeAngles();
  23. m_flCycle = ent->getCycle();
  24. m_flSimulationTime = ent->GetSimulationTime();
  25. m_nSequence = ent->getSequence();
  26. m_vecOrigin = ent->GetOrigin();
  27. m_vecVelocity = ent->GetVelocity();
  28. m_flPoseParameter = ent->getPoseParams();
  29.  
  30. m_angAbsAngles = ent->GetAbsAngles();
  31. m_vecAbsOrigin = ent->GetAbsOrigin();
  32. tickcount = 0;
  33. }
  34.  
  35. explicit operator bool() const noexcept {
  36. return m_flSimulationTime > 0.f;
  37. }
  38.  
  39. bool operator>(const CTickRecord& others) {
  40. return (m_flSimulationTime > others.m_flSimulationTime);
  41. }
  42. bool operator>=(const CTickRecord& others) {
  43. return (m_flSimulationTime >= others.m_flSimulationTime);
  44. }
  45. bool operator<(const CTickRecord& others) {
  46. return (m_flSimulationTime < others.m_flSimulationTime);
  47. }
  48. bool operator<=(const CTickRecord& others) {
  49. return (m_flSimulationTime <= others.m_flSimulationTime);
  50. }
  51. bool operator==(const CTickRecord& others) {
  52. return (m_flSimulationTime == others.m_flSimulationTime);
  53. }
  54.  
  55. float m_flLowerBodyYawTarget = 0.f;
  56. QAngle m_angEyeAngles = QAngle(0, 0, 0);
  57. float m_flCycle = 0.f;
  58. float m_flSimulationTime = 0.f;
  59. int m_nSequence = 0;
  60. Vector m_vecOrigin = Vector(0, 0, 0);
  61. Vector m_vecAbsOrigin = Vector(0, 0, 0);
  62. Vector m_vecVelocity = Vector(0, 0, 0);
  63. std::array<float, 24> m_flPoseParameter = {};
  64. QAngle m_angAbsAngles = QAngle(0, 0, 0);
  65. CValidTick validtick;
  66. int tickcount = 0;
  67. };
  68.  
  69. inline CValidTick::operator CTickRecord() const {
  70. CTickRecord rec(m_pEntity);
  71. rec.m_angEyeAngles.x = this->m_flPitch;
  72. rec.m_angEyeAngles.y = this->m_flYaw;
  73. rec.m_flSimulationTime = this->m_flSimulationTime;
  74. return rec;
  75. }
  76.  
  77. template<
  78.  
  79. class T,
  80. class Allocator = std::allocator<T>
  81. > class deque;
  82.  
  83. #pragma once
  84.  
  85. enum class ResolveMode : int {
  86. OFF = 0,
  87. FORCE,
  88. DELTA,
  89. STEADY,
  90. TICKMODULO,
  91. ALL
  92. };
  93.  
  94. class CResolveInfo {
  95. friend class CResolver;
  96. protected:
  97. deque<CTickRecord> m_sRecords;
  98. bool m_bEnemyShot; //priority
  99. bool m_bLowerBodyYawChanged;
  100. bool m_bBacktrackThisTick;
  101. };
  102.  
  103. #define Resolver CResolver::GetInstance()
  104.  
  105. class CResolver {
  106. friend class CLagcompensation;
  107. friend class CBacktracking;
  108.  
  109. //IMPLEMENT_SINGLETON(CResolver);
  110.  
  111. public:
  112. void StoreVars(IClientEntity* Entity);
  113. void StoreVars(IClientEntity* Entity, QAngle ang, float lby, float simtime, float tick);
  114.  
  115. void Resolve(IClientEntity* ent);
  116.  
  117. bool& LowerBodyYawChanged(IClientEntity* ent);
  118. bool& BacktrackThisTick(IClientEntity* ent);
  119.  
  120. private:
  121. CTickRecord GetShotRecord(IClientEntity*);
  122. bool HasStaticRealAngle(int index, float tolerance = 15.f);
  123. bool HasStaticRealAngle(const deque<CTickRecord>& l, float tolerance = 15.f);
  124. bool HasStaticYawDifference(const deque<CTickRecord>& l, float tolerance = 15.f);
  125. bool HasSteadyDifference(const deque<CTickRecord>& l, float tolerance = 15.f);
  126. int GetDifferentDeltas(const deque<CTickRecord>& l, float tolerance = 15.f);
  127. int GetDifferentLBYs(const deque<CTickRecord>& l, float tolerance = 15.f);
  128. float GetLBYByComparingTicks(const deque<CTickRecord>& l);
  129. float GetDeltaByComparingTicks(const deque<CTickRecord>& l);
  130. bool DeltaKeepsChanging(const deque<CTickRecord>& cur, float tolerance = 15.f);
  131. bool LBYKeepsChanging(const deque<CTickRecord>& cur, float tolerance = 15.f);
  132. bool IsEntityMoving(IClientEntity* ent);
  133.  
  134. private:
  135. std::array<CResolveInfo, 32> m_arrInfos;
  136. };
  137.  
  138.  
  139. const inline float GetDelta(float a, float b) {
  140.  
  141. while (a < -180.0f)
  142. a += 360.0f;
  143.  
  144. while (a > 180.0f)
  145. a -= 360.0f;
  146.  
  147. while (b < -180.0f)
  148. b += 360.0f;
  149.  
  150. while (b > 180.0f)
  151. b -= 360.0f;
  152.  
  153. return abs(a - b);
  154. }
  155.  
  156. const inline float LBYDelta(const CTickRecord& v) {
  157. return v.m_angEyeAngles.y - v.m_flLowerBodyYawTarget;
  158. }
  159.  
  160. const inline bool IsDifferent(float a, float b, float tolerance = 10.f) {
  161. return (GetDelta(a, b) > tolerance);
  162. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement