#include "Resolver.h"
#include "..\Aimbot\Aimbot.h"
#include "..\Aimbot\Autowall.h"
#include "..\Aimbot\LagComp.h"
#include "..\..\Utils\Utils.h"
#include "..\..\SDK\IVEngineClient.h"
#include "..\..\SDK\Hitboxes.h"
#include "..\..\SDK\PlayerInfo.h"
#include "..\..\Utils\Math.h"
#include "..\..\Menu\Menu.h"
#include "..\..\Menu\config.h"
ResolverMemes4u1337 g_ResolverMemes4u1337;
void ResolverMemes4u1337::AnimationFix1337(C_BaseEntity* pEnt)
{
auto pLocalEntity = g::LocalPlayer;
static float oldSimtime[65];
static float storedSimtime[65];
static float ShotTime[65];
static float SideTime[65][3];
static int LastDesyncSide[65];
static bool Delaying[65];
static AnimationLayer StoredLayers[64][15];
static C_AnimState1* StoredAnimState1[65];
static float StoredPosParams[65][24];
static Vector oldEyeAngles[65];
static float oldGoalfeetYaw[65];
float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
bool update = false;
bool shot = false;
static bool onetap_test[65]; //static bool jittering[65];
auto* AnimState1 = pEnt->AnimState1();
if (!AnimState1 || !pEnt->AnimOverlays() || !PosParams)
return;
auto RemapVal = [](float val, float A, float B, float C, float D) -> float
{
if (A == B)
return val >= B ? D : C;
return C + (D - C) * (val - A) / (B - A);
};
if (storedSimtime[pEnt->EntIndex()] != pEnt->GetSimulationTime())
{
onetap_test[pEnt->EntIndex()] = false;
pEnt->ClientAnimations(true);
pEnt->UpdateClientAnimation();
memcpy(StoredPosParams[pEnt->EntIndex()], PosParams, sizeof(float) * 24);
memcpy(StoredLayers[pEnt->EntIndex()], pEnt->AnimOverlays(), (sizeof(AnimationLayer) * pEnt->NumOverlays()));
oldGoalfeetYaw[pEnt->EntIndex()] = AnimState1->m_flGoalFeetYaw;
if (pEnt->GetActiveWeapon() && !pEnt->IsKnifeorNade())
{
if (ShotTime[pEnt->EntIndex()] != pEnt->GetActiveWeapon()->GetLastShotTime())
{
shot = true;
ShotTime[pEnt->EntIndex()] = pEnt->GetActiveWeapon()->GetLastShotTime();
}
else
shot = false;
}
else
{
shot = false;
ShotTime[pEnt->EntIndex()] = 0.f;
}
float angToLocal = g_Math.NormalizeYaw(g_Math.CalcAngle(pLocalEntity->GetOrigin(), pEnt->GetOrigin()).y);
float Back = g_Math.NormalizeYaw(angToLocal);
float DesyncFix = 0;
float Resim = g_Math.NormalizeYaw((0.24f / (pEnt->GetSimulationTime() - oldSimtime[pEnt->EntIndex()])) * (oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
if (Resim > 58.f)
Resim = 58.f;
if (Resim < -58.f)
Resim = -58.f;
if (pEnt->GetVelocity().Length2D() > 0.5f && !shot)
{
float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(g_Math.CalcAngle(Vector(0, 0, 0), pEnt->GetVelocity()).y) - g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState1->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim));
int CurrentSide = 0;
if (Delta < 0)
{
CurrentSide = 1;
SideTime[pEnt->EntIndex()][1] = g_pGlobalVars->curtime;
}
else if (Delta > 0)
{
CurrentSide = 2;
SideTime[pEnt->EntIndex()][2] = g_pGlobalVars->curtime;
}
if (LastDesyncSide[pEnt->EntIndex()] == 1)
{
Resim += (58.f - Resim);
DesyncFix += (58.f - Resim);
}
if (LastDesyncSide[pEnt->EntIndex()] == 2)
{
Resim += (-58.f - Resim);
DesyncFix += (-58.f - Resim);
}
if (LastDesyncSide[pEnt->EntIndex()] != CurrentSide)
{
Delaying[pEnt->EntIndex()] = true;
if (.5f < (g_pGlobalVars->curtime - SideTime[pEnt->EntIndex()][LastDesyncSide[pEnt->EntIndex()]]))
{
LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
Delaying[pEnt->EntIndex()] = false;
}
}
if (!Delaying[pEnt->EntIndex()])
LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
}
else if (!shot)
{
float Brute = UseFreestandAngle[pEnt->EntIndex()] ? g_Math.NormalizeYaw(Back + FreestandAngle[pEnt->EntIndex()]) : pEnt->GetLowerBodyYaw();
float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(Brute - g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState1->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60))) + Resim));
if (Delta > 58.f)
Delta = 58.f;
if (Delta < -58.f)
Delta = -58.f;
Resim += Delta;
DesyncFix += Delta;
if (Resim > 58.f)
Resim = 58.f;
if (Resim < -58.f)
Resim = -58.f;
}
float Equalized = g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState1->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim);
float JitterDelta = fabs(g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
if (JitterDelta >= 70.f && !shot)
onetap_test[pEnt->EntIndex()] = true;
if (pEnt != pLocalEntity && pEnt->GetTeam() != pLocalEntity->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && config::get().resolver_memes4u1337)
{
if (onetap_test[pEnt->EntIndex()])
AnimState1->m_flGoalFeetYaw = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y + DesyncFix);
else
AnimState1->m_flGoalFeetYaw = Equalized;
pEnt->SetLowerBodyYaw(AnimState1->m_flGoalFeetYaw);
}
StoredAnimState1[pEnt->EntIndex()] = AnimState1;
oldEyeAngles[pEnt->EntIndex()] = pEnt->GetEyeAngles();
oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];
storedSimtime[pEnt->EntIndex()] = pEnt->GetSimulationTime();
update = true;
}
pEnt->ClientAnimations(false);
if (pEnt != pLocalEntity && pEnt->GetTeam() != pLocalEntity->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && !config::get().resolver_memes4u1337)
pEnt->SetLowerBodyYaw(AnimState1->m_flGoalFeetYaw);
AnimState1 = StoredAnimState1[pEnt->EntIndex()];
memcpy((void*)PosParams, &StoredPosParams[pEnt->EntIndex()], (sizeof(float) * 24));
memcpy(pEnt->AnimOverlays(), StoredLayers[pEnt->EntIndex()], (sizeof(AnimationLayer) * pEnt->NumOverlays()));
if (pEnt != pLocalEntity && pEnt->GetTeam() != pLocalEntity->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && config::get().resolver_memes4u1337 && onetap_test[pEnt->EntIndex()])
pEnt->SetAbsAngles(Vector(0, pEnt->GetEyeAngles().y, 0));
else
pEnt->SetAbsAngles(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));
*reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA30) = g_pGlobalVars->framecount;
*reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA28) = 0;
}
float flAngleMod1(float flAngle)
{
return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
}
float ApproachAngle1(float target, float value, float speed)
{
target = flAngleMod1(target);
value = flAngleMod1(value);
float delta = target - value;
if (speed < 0)
speed = -speed;
if (delta < -180)
delta += 360;
else if (delta > 180)
delta -= 360;
if (delta > speed)
value += speed;
else if (delta < -speed)
value -= speed;
else
value = target;
return value;
}
void update_state(C_AnimState1* state, Vector angles) {
using Fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
static auto fn = reinterpret_cast<Fn>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 18 56 57 8B F9 F3 0F 11 54 24"));
fn(state, nullptr, 0.0f, angles[1], angles[0], nullptr);
}
void ResolverMemes4u1337::HandleBackUpResolve1337(C_BaseEntity* pEnt) {
if (!config::get().resolver_memes4u1337)
return;
if (pEnt->GetTeam() == g::LocalPlayer->GetTeam())
return;
const auto player_animation_state = pEnt->AnimState1();
if (!player_animation_state)
return;
if (g::MissedShots[pEnt->EntIndex()] > 2) {
switch (g::MissedShots[pEnt->EntIndex()] % 4) {
case 0: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 42; break;
case 1: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 44; break;
case 2: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 31; break;
case 3: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 28; break;
}
}
else {
float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
auto v48 = 0.f;
if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
{
v48 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
}
else
{
v48 = 0.0f;
}
float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
float flYawModifier = v49 + 1.0;
if (player_animation_state->m_fDuckAmount > 0.0)
{
float v53 = 0.0f;
if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
{
v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
}
else
{
v53 = 0.0f;
}
}
float flMaxYawModifier = player_animation_state->pad10[516] * flYawModifier;
float flMinYawModifier = player_animation_state->pad10[512] * flYawModifier;
float newFeetYaw = 0.f;
auto eyeYaw = player_animation_state->m_flEyeYaw;
auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
float eye_feet_delta = fabs(eyeYaw - lbyYaw);
if (eye_feet_delta <= flMaxYawModifier)
{
if (flMinYawModifier > eye_feet_delta)
{
newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
}
}
else
{
newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
}
float v136 = fmod(newFeetYaw, 360.0);
if (v136 > 180.0)
{
v136 = v136 - 360.0;
}
if (v136 < 180.0)
{
v136 = v136 + 360.0;
}
player_animation_state->m_flGoalFeetYaw = v136;
}
}
void ResolverMemes4u1337::HandleHits1337(C_BaseEntity* pEnt)
{
auto NetChannel = g_pEngine->GetNetChannelInfo();
if (!NetChannel)
return;
static float predTime[65];
static bool init[65];
if (g::Shot[pEnt->EntIndex()])
{
if (init[pEnt->EntIndex()])
{
g_ResolverMemes4u1337.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()] && !g::Hit[pEnt->EntIndex()])
{
g::MissedShots[pEnt->EntIndex()] += 1;
g::Shot[pEnt->EntIndex()] = false;
}
else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && g::Hit[pEnt->EntIndex()])
g::Shot[pEnt->EntIndex()] = false;
}
else
init[pEnt->EntIndex()] = true;
g::Hit[pEnt->EntIndex()] = false;
}
void ResolverMemes4u1337::OnCreateMove1337() // cancer v2
{
auto pLocalEntity = g::LocalPlayer;
if (!pLocalEntity->IsAlive())
return;
if (!pLocalEntity->GetActiveWeapon() || pLocalEntity->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 == pLocalEntity
|| pPlayerEntity->GetTeam() == pLocalEntity->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(pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
Vector ViewPoint = pLocalEntity->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))
{
if (side == 0)
{
HitSide1 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = 90;
}
else if (side == 1)
{
HitSide2 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = -90;
}
Autowalled = true;
}
else
{
for (int side222 = 0; side222 < 2; side222++)
{
Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2))
{
if (side222 == 0)
{
HitSide1 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = 90;
}
else if (side222 == 1)
{
HitSide2 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = -90;
}
Autowalled = true;
}
}
}
}
if (Autowalled)
{
if (HitSide1 && HitSide2)
UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
else
UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
}
}
}
}
void ResolverMemes4u1337::FrameStage1337(ClientFrameStage_t stage)
{
auto pLocalEntity = g::LocalPlayer;
if (pLocalEntity || !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)
{
HandleHits1337(pPlayerEntity);
AnimationFix1337(pPlayerEntity);
}
if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != pLocalEntity)
{
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;
}
}
//misc
float NormalizeYaw180(float yaw)
{
if (yaw > 180)
yaw -= (round(yaw / 360) * 360.f);
else if (yaw < -180)
yaw += (round(yaw / 360) * -360.f);
return yaw;
}
//misc
//resolver
void ResolverMemes4u1337::ResolverMEMES4U1337(C_BaseEntity* pEnt)
{
if (!config::get().resolver_memes4u1337)
return;
if (pEnt->GetTeam() == g::LocalPlayer->GetTeam())
return;
if (pEnt->GetTeam() == g::LocalPlayer->GetTeam())
return;
auto animstate = pEnt->AnimState();
const auto player_animation_state = pEnt->AnimState();
float flMaxYawModifier = player_animation_state->pad10[516] * flMaxYawModifier;
float flMinYawModifier = player_animation_state->pad10[512] * flMaxYawModifier;
float newFeetYaw = 1.f;
auto eyeYaw = player_animation_state->m_flEyeYaw;
auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
float eye_feet_delta = fabs(eyeYaw - lbyYaw);
if (!player_animation_state)
return;
float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
auto v28 = 0.f;
if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
{
v28 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 0.0f);
}
else
{
v28 = 0x3F800000;
}
float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v49;
float flYawModifier = v49 + 1.0;
if (player_animation_state->m_fDuckAmount > 0.0)
{
float v53 = 0.0f;
if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
{
v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
}
else
{
v53 = 0.0f;
}
}
if (eye_feet_delta <= flMaxYawModifier)
{
if (flMinYawModifier > eye_feet_delta)
{
newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
}
}
else
{
newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
}
float v136 = fmod(newFeetYaw, 360.0);
if (v136 > 180.0)
{
v136 = v136 - 360.0;
}
if (v136 < 180.0)
{
v136 = v136 + 360.0;
}
v28 = v49++;
{
float v9 = fabs(animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
float speedfraction = 0.0;
if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0)
speedfraction = 0.0;
else
speedfraction = animstate->m_flFeetSpeedForwardsOrSideWays;
float v2 = (animstate->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
float v18 = v2;
float v3 = v2 + 1.0;
float v23 = v3;
if (animstate->m_fDuckAmount > 0.0)
{
float v29 = 0.0;
if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
v29 = 0.0;
else
v29 = fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
}
if (g::LocalPlayer)
{
for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
{
if (pEnt)
{
float v28 = pEnt->GetEyeAngles().y == 0.0 ? -58 : 58;
if (v28)
return;
float v27 = pEnt->GetEyeAngles().y == 0.0 ? -89 : 89;
if (v27)
return;
float v26 = pEnt->GetEyeAngles().y == 0.0 ? -79 : 79;
if (v26)
return;
float v25 = pEnt->GetEyeAngles().y == 0.0 ? -125 : 125;
if (v25)
return;
float v24 = pEnt->GetEyeAngles().y == 0.0 ? -78 : 78;
if (v24)
return;
}
float v8 = 0;
float v7 = 0;
float v6 = 0;
for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++)
{
auto layer = pEnt->GetNumAnimOverlays();
if (!layer)
continue;
if (pEnt->GetSequence() == 979);
v6 = pEnt->GetLowerBodyYaw();
}
float v20 = (animstate->m_vVelocityX) * v23;
float a1 = (animstate->m_vVelocityY) * v23;
float v30 = 0.0;
float eye_angles_y = animstate->m_flEyeYaw;
float goal_feet_yaw = animstate->m_flGoalFeetYaw;
float v22 = fabs(eye_angles_y - goal_feet_yaw);
if (v20 < v22)
{
float v11 = fabs(v20);
v30 = eye_angles_y - v11;
}
else if (a1 > v22)
{
float v12 = fabs(a1);
v30 = v12 + eye_angles_y;
}
float v36 = std::fmodf((v30), 360.0);
if (v36 > 180.0)
v36 = v36 - 360.0;
if (v36 < 180.0)
v36 = v36 + 360.0;
animstate->m_flGoalFeetYaw = v36;
if (g::MissedShots[pEnt->EntIndex()] > 2)
{
int v19 = g::MissedShots[pEnt->EntIndex()] % 4;
switch (v19)
{
case 0:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
break;
case 1:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
break;
case 2:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
break;
case 3:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
break;
default:
return;
player_animation_state->m_flGoalFeetYaw = v136;
}
}
}
}
}
}
void ResolverMemes4u1337::FixPitch(C_BaseEntity * pEnt)
{
float last_simtime[64] = { 0.f };
float stored_pitch_1[64] = { 0.f };
float fixed_pitch[64] = { 0.f };
bool has_been_set[64] = { false };
const auto local = g::LocalPlayer;
if (!local)
return;
if (!config::get().resolver_memes4u1337) return;
for (auto i = 0; i < g_pEngine->GetMaxClients(); ++i)
{
const auto eye = pEnt->GetEyeAnglesPointer();
auto pitch = 0.f;
if (stored_pitch_1[i] == FLT_MAX || !has_been_set[i])
{
stored_pitch_1[i] = eye->x;
has_been_set[i] = true;
}
if (stored_pitch_1[i] - eye->x < 30 && stored_pitch_1[i] - eye->x > -30)
{
pitch = eye->x;
}
else
{
pitch = stored_pitch_1[i];
}
pEnt->GetEyeAnglesPointer()->x = pitch;
}
}
void ResolverMemes4u1337::LBYManipulation(C_BaseEntity* pEnt)
{
if (!config::get().resolver_memes4u1337)
return;
int index = pEnt->EntIndex();
static Vector Angle;
Angle = pEnt->GetEyeAngles();
AnimationLayer* anim = nullptr;
static float moving_lby[65];
static float moving_sim[65];
static float stored_lby[65];
static float old_lby[65];
static float lby_delta[65];
static float predicted_yaw[65];
static bool lby_changes[65];
static int shots_check[65];
static float angle_brute[65];
static float AtTargetAngle;
static float FixPitch;
static float FixPitch2;
static bool HitNS[65];
static Vector StoredAngle[65];
static Vector Hitstored[65];
static int StoredShots[65];
static int HitShots[65];
static int HitShotsStored[65];
int Missedshots[65];
if (stored_lby[index] != pEnt->GetLowerBodyYaw())
{
old_lby[index] = stored_lby[index];
lby_changes[index] = true;
stored_lby[index] = pEnt->GetLowerBodyYaw();
}
lby_delta[index] = NormalizeYaw180(stored_lby[index] - old_lby[index]);
if (lby_changes[index])
{
if ((pEnt->GetSimulationTime() - moving_sim[index]) > .22f)
predicted_yaw[index] = lby_delta[index];
lby_changes[index] = false;
}
if (stored_lby[index] != pEnt->GetLowerBodyYaw())
{
old_lby[index] = stored_lby[index];
Angle.y = pEnt->GetLowerBodyYaw();
lby_changes[index] = true;
stored_lby[index] = pEnt->GetLowerBodyYaw();
}
else if (abs(pEnt->GetVelocity().Length2D()) > 29.f && (pEnt->GetFlags() & FL_ONGROUND))
{
Angle.y = pEnt->GetLowerBodyYaw();
moving_lby[index] = pEnt->GetLowerBodyYaw();
moving_sim[index] = pEnt->GetSimulationTime();
lby_changes[index] = false;
predicted_yaw[index] = 0;
Missedshots[index] = 0;
angle_brute[index] = 0;
}
else if ((pEnt->GetFlags() & FL_ONGROUND))
{
if (shots_check[index] != Missedshots[index])
{
angle_brute[index] += predicted_yaw[index];
shots_check[index] = Missedshots[index];
}
Angle.y = NormalizeYaw180(angle_brute[index] + moving_lby[index]);
}
else
{
Angle.y = pEnt->GetLowerBodyYaw();
}
pEnt->SetEyeAngles(Angle);
}
#pragma once
#include "..\..\Utils\GlobalVars.h"
#include "..\..\SDK\CGlobalVarsBase.h"
#include "..\..\SDK\IClientMode.h"
#include <deque>
class ResolverMemes4u1337
{
public:
//bool
bool UseFreestandAngle[65];
//bool
//void
void HandleBackUpResolve1337(C_BaseEntity* pEnt);
void HandleHits1337(C_BaseEntity* pEnt);
void OnCreateMove1337();
void FrameStage1337(ClientFrameStage_t stage);
void ResolverMEMES4U1337(C_BaseEntity* pEnt);
void FixPitch(C_BaseEntity * pEnt);
void LBYManipulation(C_BaseEntity* pEnt);
//void
//float
float pitchHit[65];
float FreestandAngle[65];
//float
private:
void AnimationFix1337(C_BaseEntity* pEnt);
};
extern ResolverMemes4u1337 g_ResolverMemes4u1337;
ResolverRecode g_ResolverRecode;
void ResolverRecode::HandleHits(C_BaseEntity* pEnt) //def handle
{
auto NetChannel = g_pEngine-> GetNetChannelInfo ();
if (!NetChannel)
return;
static float predTime[65];
static bool init[65];
if (g::Shot[pEnt->EntIndex()])
{
if (init[pEnt->EntIndex()])
{
g_ResolverRecode.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()] && !g::Hit[pEnt->EntIndex()])
{
g::MissedShots[pEnt->EntIndex()] += 1;
g::Shot[pEnt->EntIndex()] = false;
}
else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && g::Hit[pEnt->EntIndex()])
g::Shot[pEnt->EntIndex()] = false;
}
else
init[pEnt->EntIndex()] = true;
g::Hit[pEnt->EntIndex()] = false;
}
void ResolverRecode::fix_local_player_animations()
{
auto local_player = g_pEntityList->GetClientEntity(g_pEngine->GetLocalPlayer());
if (!local_player)
return;
static float sim_time;
if (sim_time != local_player->GetSimulationTime())
{
auto state = local_player->AnimState(); if (!state) return;
const float curtime = g_pGlobalVars-> curtime;
const float frametime = g_pGlobalVars->frametime;
const float realtime = g_pGlobalVars->realtime;
const float absoluteframetime = g_pGlobalVars->absoluteframetime;
const float absoluteframestarttimestddev = g_pGlobalVars->absoluteframestarttimestddev;
const float interpolation_amount = g_pGlobalVars->interpolationAmount;
const float framecount = g_pGlobalVars->framecount;
const float tickcount = g_pGlobalVars->tickcount;
static auto host_timescale = g_pCvar->FindVar(("host_timescale"));
g_pGlobalVars->curtime = local_player->GetSimulationTime();
g_pGlobalVars->realtime = local_player->GetSimulationTime();
g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick * host_timescale->GetFloat();
g_pGlobalVars->absoluteframetime = g_pGlobalVars->intervalPerTick * host_timescale->GetFloat();
g_pGlobalVars->absoluteframestarttimestddev = local_player->GetSimulationTime() - g_pGlobalVars->intervalPerTick * host_timescale->GetFloat();
g_pGlobalVars->interpolationAmount = 0;
g_pGlobalVars->framecount = TICKS_TO_TIME(local_player->GetSimulationTime());
g_pGlobalVars->tickcount = TICKS_TO_TIME(local_player->GetSimulationTime());
int backup_flags = local_player->GetFlags();
AnimationLayer backup_layers[15];
std::memcpy(backup_layers, local_player->GetAnimOverlays4(), (sizeof(AnimationLayer) * 15));
if (state->m_iLastClientSideAnimationUpdateFramecount == g_pGlobalVars->framecount)
state->m_iLastClientSideAnimationUpdateFramecount = g_pGlobalVars->framecount - 1;
std::memcpy(local_player->GetAnimOverlays4(), backup_layers, (sizeof(AnimationLayer) * 15));
g_pGlobalVars-> curtime = curtime;
g_pGlobalVars->realtime = realtime;
g_pGlobalVars->frametime = frametime;
g_pGlobalVars->absoluteframetime = absoluteframetime;
g_pGlobalVars->absoluteframestarttimestddev = absoluteframestarttimestddev;
g_pGlobalVars->interpolationAmount = interpolation_amount;
g_pGlobalVars->framecount = framecount;
g_pGlobalVars->tickcount = tickcount;
sim_time = local_player->GetSimulationTime();
}
local_player->InvalidateBoneCache();
local_player->SetupBones(nullptr, -1, 0x7FF00, g_pGlobalVars->curtime);
}
float ResolverRecode::AngleNormalize(float angle)
{
angle = fmodf(angle, 360.0f);
if (angle > 180)
{
angle -= 360;
}
if (angle < -180)
{
angle += 360;
}
return angle;
}
float ResolverRecode::NormalizeYaw180(float yaw)
{
if (yaw > 180)
yaw -= (round(yaw / 360) * 360.f);
else if (yaw < -180)
yaw += (round(yaw / 360) * -360.f);
return yaw;
}
float ResolverRecode::angle_difference(float a, float b) {
auto diff = NormalizeYaw180(a - b);
if (diff < 180)
return diff;
return diff - 360;
}
float ResolverRecode::approach(float cur, float target, float inc) {
inc = abs(inc);
if (cur < target)
return min(cur + inc, target);
if (cur > target)
return max(cur - inc, target);
return target;
}
float ResolverRecode::approach_angle(float cur, float target, float inc) {
auto diff = angle_difference(target, cur);
return approach(cur, cur + diff, inc);
}
void ResolverRecode::FixAnims(C_BaseEntity* ent)
{
if (!g::pLocalEntity->IsAlive())
return;
auto animState = ent-> AnimState ();
static auto GetSmoothedVelocity = [](float min_delta, Vector a, Vector b) {
Vector delta = a - b;
float delta_length = delta.Length();
if (delta_length <= min_delta) {
Vector result;
if (-min_delta <= delta_length) {
return a;
}
else {
float iradius = 1.0f / (delta_length + FLT_EPSILON);
return b - ((delta * iradius) * min_delta);
}
}
else {
float iradius = 1.0f / (delta_length + FLT_EPSILON);
return b + ((delta * iradius) * min_delta);
}
};
float FakeGoalYaw;
float v25;
float v32;
v32 = ent->GetSimulationTime() - ent->GetOldSimulationTime();
v25 = std::clamp(animState->m_fLandingDuckAdditiveSomething + ent->m_fDuckSpeed(), 1.0f, 0.0f);
float v26 = animState-> m_fDuckAmount;
float v27 = v32 * 6.0f;
float v28;
// clamp
if ((v25 - v26) <= v27) {
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else {
v28 = v26 + v27;
}
Vector velocity = ent->GetVelocity();
float flDuckAmount = std::clamp(v28, 1.0f, 0.0f);
Vector animationVelocity = GetSmoothedVelocity(v32 * 2000.0f, velocity, animState->m_flVelocity());
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = (WeaponInfo_t*)g::pLocalEntity->GetActiveWeapon();
float flMaxMovementSpeed = 260.0f;
if (weapon) {
flMaxMovementSpeed = std::fmaxf(weapon->max_speed, 0.001f);
}
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = std::clamp(flRunningSpeed, 0.0f, 1.0f);
float flYawModifier = (((animState->m_bOnGround * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (flDuckAmount > 0.0f) {
float flDuckingSpeed = std::clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float m_flMaxBodyYaw = * (float *) (uintptr_t (animState) + 0x334) * flYawModifier;
float m_flMinBodyYaw = *(float*)(uintptr_t(animState) + 0x330) * flYawModifier;
float flEyeYaw = ent-> GetEyeAngles () .y;
float flEyeDiff = std::remainderf(flEyeYaw - FakeGoalYaw, 360.f);
if (flEyeDiff <= m_flMaxBodyYaw) {
if (m_flMinBodyYaw > flEyeDiff)
FakeGoalYaw = fabs(m_flMinBodyYaw) + flEyeYaw;
}
else {
FakeGoalYaw = flEyeYaw - fabs(m_flMaxBodyYaw);
}
FakeGoalYaw = std::remainderf(FakeGoalYaw, 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
FakeGoalYaw = g_ResolverRecode.approach_angle(
flEyeYaw,
FakeGoalYaw,
(animState-> m_bOnGround * 20.0f) + 30.0f)
* v32);
}
else {
FakeGoalYaw = g_ResolverRecode.approach_angle(
ent->GetLowerBodyYaw(),
FakeGoalYaw,
v32 * 100.0f);
}
float Left = flEyeYaw - m_flMinBodyYaw;
float Right = flEyeYaw - m_flMaxBodyYaw;
float fixyaw;
static bool swap = false;
static bool init = false;
if (GetKeyState(c_config::get().aa_recode.fake_inverter)) {
if (!swap) {
swap = true;
}
init = true;
}
else
{
if (swap)
{
swap = false;
}
init = false;
}
if (swap)
fixyaw = Right;
else
fixyaw = Left;
animState-> m_flGoalFeetYaw = fixyaw;
}
void ResolverRecode::resolve(C_BaseEntity* ent)
{
if (!g::pLocalEntity->IsAlive())
return;
auto animState = ent-> AnimState ();
static auto GetSmoothedVelocity = [](float min_delta, Vector a, Vector b) {
Vector delta = a - b;
float delta_length = delta.Length();
if (delta_length <= min_delta) {
Vector result;
if (-min_delta <= delta_length) {
return a;
}
else {
float iradius = 1.0f / (delta_length + FLT_EPSILON);
return b - ((delta * iradius) * min_delta);
}
}
else {
float iradius = 1.0f / (delta_length + FLT_EPSILON);
return b + ((delta * iradius) * min_delta);
}
};
float v25;
float v32;
v32 = ent->GetSimulationTime() - ent->GetOldSimulationTime();
v25 = std::clamp(animState->m_fLandingDuckAdditiveSomething + ent->m_fDuckSpeed(), 1.0f, 0.0f);
float v26 = animState-> m_fDuckAmount;
float v27 = v32 * 6.0f;
float v28;
// clamp
if ((v25 - v26) <= v27) {
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else {
v28 = v26 + v27;
}
Vector velocity = ent->GetVelocity();
float flDuckAmount = std::clamp(v28, 1.0f, 0.0f);
Vector animationVelocity = GetSmoothedVelocity(v32 * 2000.0f, velocity, animState->m_flVelocity());
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = (WeaponInfo_t*)g::pLocalEntity->GetActiveWeapon();
float flMaxMovementSpeed = 260.0f;
if (weapon) {
flMaxMovementSpeed = std::fmaxf(weapon->max_speed, 0.001f);
}
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = std::clamp(flRunningSpeed, 0.0f, 1.0f);
float flYawModifier = (((animState->m_bInHitGroundAnimation * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (flDuckAmount > 0.0f) {
float flDuckingSpeed = std::clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float m_flMaxBodyYaw = * (float *) (uintptr_t (animState) + 0x334) * flYawModifier;
float m_flMinBodyYaw = *(float*)(uintptr_t(animState) + 0x330) * flYawModifier;
float flEyeYaw = ent-> GetEyeAngles () .y;
float flEyeDiff = std::remainderf(flEyeYaw - g_ResolverRecode.resolverinfoo.fakegoalfeetyaw, 360.f);
if (flEyeDiff <= m_flMaxBodyYaw) {
if (m_flMinBodyYaw > flEyeDiff)
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw = fabs(m_flMinBodyYaw) + flEyeYaw;
}
else {
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw = flEyeYaw - fabs(m_flMaxBodyYaw);
}
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw = std::remainderf(g_ResolverRecode.resolverinfoo.fakegoalfeetyaw, 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw = g_ResolverRecode.approach_angle(
flEyeYaw,
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw,
(animState-> m_flGoalFeetYaw * 20.0f) + 30.0f)
* v32);
}
else {
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw = g_ResolverRecode.approach_angle(
ent->GetLowerBodyYaw(),
g_ResolverRecode.resolverinfoo.fakegoalfeetyaw,
v32 * 100.0f);
}
float Left = flEyeYaw - m_flMinBodyYaw;
float Right = flEyeYaw - m_flMaxBodyYaw;
float resolveYaw;
switch (g::MissedShots[ent->EntIndex()] % 3)
{
case 0:
resolveYaw = Left;
break;
case 1:
resolveYaw = g_ResolverRecode.resolverinfoo.fakegoalfeetyaw;
break;
case 2:
resolveYaw = Right;
break;
}
animState-> m_flGoalFeetYaw = resolveYaw;
}
void ResolverRecode::FrameStage(ClientFrameStage_t stage)
{
if (!g::pLocalEntity || !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 (c_config::get().Resolver)
g_ResolverRecode.resolve(pPlayerEntity);
if (!pPlayerEntity
|| !pPlayerEntity->IsAlive())
continue;
if (pPlayerEntity->IsDormant())
{
wasDormant[i] = true;
continue;
}
if (pPlayerEntity == g::pLocalEntity)
{
g_ResolverRecode.FixAnims(pPlayerEntity);
}
if (stage == FRAME_RENDER_START)
{
if (pPlayerEntity == g::pLocalEntity) {
pPlayerEntity->ClientAnimations(true);
fix_local_player_animations();
pPlayerEntity->UpdateClientAnimation();
}
g_ResolverRecode.HandleHits(pPlayerEntity);
}
if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != g::pLocalEntity)
{
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;
}
}
#pragma once
#include "..\..\Utils\GlobalVars.h"
#include "..\..\SDK\CGlobalVarsBase.h"
#include "..\..\SDK\IClientMode.h"
#include <and>
struct resolver_info
{
AnimationLayer animation;
bool jitter_desync = false, high_delta = false, low_delta = false, static_desync = false, lby_changed = false;
float last_lby = FLT_MAX, lby_delta = FLT_MAX, last_eyes = FLT_MAX, eye_delta = FLT_MAX, eye_lby_delta = FLT_MAX, eyes = FLT_MAX;
};
struct resolverInfo2
{
public:
float fakegoalfeetyaw;
resolver_info current_tick;
resolver_info previous_tick;
};
class ResolverRecode
{
public:
void update_local_ghetto(C_BaseEntity* local);
bool UseFreestandAngle[65];
float FreestandAngle[65];
Vector absOriginBackup;
float pitchHit[65];
resolverInfo2 resolverinfoo;
resolverInfo2 __player[64];
int resolvetype;
void resolve(C_BaseEntity* ent);
void HandleHits(C_BaseEntity* pEnt);
void FixAnims(C_BaseEntity* ent);
void fix_local_player_animations();
float approach_angle(float cur, float target, float inc);
float approach(float cur, float target, float inc);
float NormalizeYaw180(float yaw);
float AngleNormalize(float angle);
float angle_difference(float a, float b);
void AnimationFix(C_BaseEntity* pEnt);
void FrameStage(ClientFrameStage_t stage);
};
extern ResolverRecode g_ResolverRecode;
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz