Advertisement
Guest User

Resolver

a guest
Apr 23rd, 2019
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1.         void CResolver::AnimationFix(SDK::CBaseEntity * pEnt)
  2.         {
  3.             //who needs structs or classes not me lol
  4.             static float oldSimtime[65];
  5.             static float storedSimtime[65];
  6.             static float ShotTime[65];
  7.             static float SideTime[65][3];
  8.             static int LastDesyncSide[65];
  9.             static bool Delaying[65];
  10.             static SDK::CAnimationLayer StoredLayers[64][15];
  11.             static SDK::CBaseAnimState * StoredAnimState[65];
  12.             static float StoredPosParams[65][24];
  13.             static Vector oldEyeAngles[65];
  14.             static float oldGoalfeetYaw[65];
  15.             float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
  16.             bool update = false;
  17.             bool shot = false;
  18.             auto& resolve_record = player_resolve_records[pEnt->GetIndex()];
  19.             static bool jittering[65];
  20.  
  21.             auto* AnimState = pEnt->GetAnimState();
  22.             if (!AnimState)
  23.                 return;
  24.             if (!AnimState || !pEnt->GetAnimOverlays() || !PosParams)
  25.                 return;
  26.  
  27.             auto RemapVal = [](float val, float A, float B, float C, float D) -> float
  28.             {
  29.                 if (A == B)
  30.                     return val >= B ? D : C;
  31.                 return C + (D - C) * (val - A) / (B - A);
  32.             };
  33.             //removed
  34.             if (jittering[pEnt->GetIndex()])
  35.                 resolve_record.resolve_type |= RESOLVE_TYPE_DESYNC2;
  36.             else if (is_slow_walking(pEnt))
  37.                 resolve_record.resolve_type |= RESOLVE_TYPE_ANTI_SLOWWALK;
  38.             else
  39.                 resolve_record.resolve_type |= RESOLVE_TYPE_DESYNC;
  40.             //removed
  41.         }
  42.         int shots[65];
  43.         int missed_shots[65];
  44.         int hit[65];
  45.         bool ShotFired[65];
  46.         bool Hit[65];
  47.         int MissedShots[65];
  48.         void CResolver::HandleHits(SDK::CBaseEntity * pEnt)
  49.         {
  50.             auto NetChannel = I::Engine->GetNetChannelInfo();
  51.  
  52.             if (!NetChannel)
  53.                 return;
  54.  
  55.             static float predTime[65];
  56.             static bool init[65];
  57.             int fired = shots[pEnt->GetIndex()];
  58.             int missed = missed_shots[pEnt->GetIndex()];
  59.  
  60.             if (ShotFired[pEnt->GetIndex()])
  61.             {
  62.                 if (init[pEnt->GetIndex()])
  63.                 {
  64.                     pitchHit[pEnt->GetIndex()] = pEnt->GetEyeAngles().x;
  65.                     predTime[pEnt->GetIndex()] = I::Globals->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(I::Engine->GetNetChannelInfo()->m_nChokedPackets);
  66.                     init[pEnt->GetIndex()] = false;
  67.                 }
  68.  
  69.                 if (I::Globals->curtime > predTime[pEnt->GetIndex()] && !Hit[pEnt->GetIndex()])
  70.                 {
  71.                     MissedShots[pEnt->GetIndex()] += 1;
  72.                     ShotFired[pEnt->GetIndex()] = false;
  73.                 }
  74.                 else if (I::Globals->curtime <= predTime[pEnt->GetIndex()] && Hit[pEnt->GetIndex()])
  75.                     ShotFired[pEnt->GetIndex()] = false;
  76.             }
  77.             else
  78.                 init[pEnt->GetIndex()] = true;
  79.  
  80.             Hit[pEnt->GetIndex()] = false;
  81.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement