Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // i got the wrong reso last time lol
- void Hits(C_BaseEntity* pEnt)
- {
- auto NetChannel = g_pEngine->GetNetChannelInfo();
- if (!NetChannel)
- return;
- static float predTime[65];
- static bool init[65];
- if (Globals::Shot[pEnt->EntIndex()])
- {
- if (init[pEnt->EntIndex()])
- {
- g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
- predTime[pEnt->EntIndex()] = g_pGlobalVars->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(g_pEngine->GetNetChannel()->m_nChokedPackets);
- init[pEnt->EntIndex()] = false;
- }
- if (g_pGlobalVars->curtime > predTime[pEnt->EntIndex()] && !Globals::Hit[pEnt->EntIndex()])
- {
- Globals::MissedShots[pEnt->EntIndex()] += 1;
- Globals::Shot[pEnt->EntIndex()] = false;
- }
- else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && Globals::Hit[pEnt->EntIndex()])
- Globals::Shot[pEnt->EntIndex()] = false;
- }
- else
- init[pEnt->EntIndex()] = true;
- Globals::Hit[pEnt->EntIndex()] = false;
- }
- void Resolver::Main()
- {
- if (!CFG.Resolver);
- return;
- if (!Globals::LocalPlayer->IsAlive())
- return;
- if (!Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->IsKnifeorNade())
- return;
- for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive()
- || pPlayerEntity->IsDormant()
- || pPlayerEntity == Globals::LocalPlayer
- || pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam())
- {
- UseFreestandAngle[i] = false;
- continue;
- }
- if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
- UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
- if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
- {
- bool Autowalled = false, HitSide1 = false, HitSide2 = false;
- float angToLocal = g_Math.CalcAngle(Globals::LocalPlayer->GetOrigin(), pPlayerEntity->GetOrigin()).y;
- Vector ViewPoint = Globals::LocalPlayer->GetOrigin() + Vector(0, 0, 90);
- Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector Origin = pPlayerEntity->GetOrigin();
- Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
- Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
- for (int side = 0; side < 2; side++)
- {
- Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
- Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
- if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint))
- {
- switch (side)
- {
- case 0:
- HitSide1 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = 90;
- break;
- case 1:
- {
- HitSide2 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = -90;
- }
- Autowalled = true;
- }
- else
- {
- for (int side = 0; side< 2; side++)
- {
- Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
- if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2))
- {
- switch (side)
- {
- case 0:
- HitSide1 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = 90;
- break;
- case 1:
- HitSide2 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = -90;
- break;
- }
- Autowalled = true;
- }
- }
- }
- }
- if (Autowalled)
- {
- if (HitSide1 && HitSide2)
- UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
- else
- UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
- }
- }
- }
- }
- void Resolver::FS(ClientFrameStage_t stage)
- {
- if (!Globals::LocalPlayer || !g_pEngine->IsInGame())
- return;
- static bool wasDormant[65];
- for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive())
- continue;
- if (pPlayerEntity->IsDormant())
- {
- wasDormant[i] = true;
- continue;
- }
- if (stage == FRAME_RENDER_START)
- {
- HandleHits(pPlayerEntity);
- AnimationFix(pPlayerEntity);
- }
- if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
- HandleBackUpResolve(pPlayerEntity);
- }
- if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != Globals::LocalPlayer)
- {
- auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
- auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);
- for (auto index = 0; index < VarMapSize; index++)
- *reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
- }
- wasDormant[i] = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement