-
Автор темы
- #1
C++:
#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"
#include "..\..\SDK\CEntity.h"
#include "..\..\SDK\IBaseClientDll.h"
Resolver g_Resolver;
template<class T, class U>
inline T clamp(T in, U low, U high)
{
if (in <= low)
return low;
else if (in >= high)
return high;
else
return in;
}
void BotCheck(C_BaseEntity* ent)
{
}
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 AngleNormalize(float angle)
{
angle = fmodf(angle, 360.0f);
if (angle > 180)
{
angle -= 360;
}
if (angle < -180)
{
angle += 360;
}
return angle;
}
float ApproachAngle(float target, float value, float speed)
{
target = (target * 182.04445f) * 0.0054931641f;
value = (value * 182.04445f) * 0.0054931641f;
float delta = target - value;
// Speed is assumed to be positive
if (speed < 0)
speed = -speed;
if (delta < -180.0f)
delta += 360.0f;
else if (delta > 180.0f)
delta -= 360.0f;
if (delta > speed)
value += speed;
else if (delta < -speed)
value -= speed;
else
value = target;
return value;
}
void proper_brute(C_BaseEntity* ent)
{
if (!Globals::LocalPlayer->IsAlive())
return;
auto animState = ent->AnimState();
float m_flanimState->m_flGoalFeetYaw [65];
// Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw
Vector velocity = ent->GetVelocity();
float spd = velocity.LengthSqr();
if (spd > std::powf(1.2f * 260.0f, 2.f)) {
Vector velocity_normalized = velocity.Normalize();
velocity = velocity_normalized * (1.2f * 260.0f);
}
float v25 = clamp(ent->m_fDuckSpeed() + animState->m_fLandingDuckAdditiveSomething, 0.0f, 1.0f);
float v26 = animState->m_fDuckAmount;
float v27 = g_pClientState->m_nChokedCommands * 6.0f;
float v28;
// clamp
if ((v25 - v26) <= v27) {
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else {
v28 = v26 + v27;
}
float flDuckAmount = clamp(v28, 0.0f, 1.0f);
Vector animationVelocity = GetSmoothedVelocity(g_pClientState->m_nChokedCommands * 2000.0f, velocity, ent->GetVelocity());
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = ent->GetActiveWeapon();
float flMaxMovementSpeed = 260.0f;
if (weapon) {
flMaxMovementSpeed = std::fmaxf(weapon->GetCSWpnData()->max_speed, 0.001f);
}
float m_flGroundFraction = *(float*)(animState + 0x11C);
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = clamp(flRunningSpeed, 0.0f, 1.0f);
float flYawModifier = (((m_flGroundFraction * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (flDuckAmount > 0.0f) {
float flDuckingSpeed = clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float flMinBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x330)) * flYawModifier);
float flMaxBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x334)) * flYawModifier);
float flEyeYaw = ent->GetEyeAngles().y;
float flEyeDiff = std::remainderf(flEyeYaw - m_flFakeGoalFeetYaw[ent->EntIndex()], 360.f);
if (flEyeDiff <= flMaxBodyYaw) {
if (flMinBodyYaw > flEyeDiff)
m_flFakeGoalFeetYaw[ent->EntIndex()] = fabs(flMinBodyYaw) + flEyeYaw;
}
else {
m_flFakeGoalFeetYaw[ent->EntIndex()] = flEyeYaw - fabs(flMaxBodyYaw);
}
m_flFakeGoalFeetYaw[ent->EntIndex()] = std::remainderf(m_flFakeGoalFeetYaw[ent->EntIndex()], 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
m_flFakeGoalFeetYaw[ent->EntIndex()] = ApproachAngle(
flEyeYaw,
m_flFakeGoalFeetYaw[ent->EntIndex()],
((m_flGroundFraction * 20.0f) + 30.0f)
* g_pClientState->m_nChokedCommands);
}
else {
m_flFakeGoalFeetYaw[ent->EntIndex()] = ApproachAngle(
ent->GetLowerBodyYaw(),
m_flFakeGoalFeetYaw[ent->EntIndex()],
g_pClientState->m_nChokedCommands * 100.0f);
}
float Left = flEyeYaw + flMinBodyYaw;
float Right = flEyeYaw + flMaxBodyYaw;
float resolveYaw;
switch (Globals::MissedShots[ent->EntIndex()] % 3) {
case 0: // brute left side
resolveYaw = Left;
break;
case 1: // brute fake side
resolveYaw = m_flFakeGoalFeetYaw[ent->EntIndex()];
break;
case 2: // brute right side
resolveYaw = Right;
break;
default:
break;
}
animState->m_flGoalFeetYaw = resolveYaw;
}
void Resolver::AnimationFix(C_BaseEntity* pEnt)
{
if (!pEnt || !pEnt->IsAlive() || pEnt == Globals::LocalPlayer || pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
return;
if (!Globals::LocalPlayer || !Globals::LocalPlayer->IsAlive() || !Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->GetActiveWeapon()->GetAmmo() == 0)
return;
float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
auto* AnimState = pEnt->AnimState();
if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
return;
// backup
const float curtime = g_pGlobalVars->curtime;
const float frametime = g_pGlobalVars->frametime;
g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
g_pGlobalVars->curtime = pEnt->GetSimulationTime();
int backup_eflags = pEnt->m_iEFlags();
// SetLocalVelocity
pEnt->m_iEFlags() &= ~0x1000; // InvalidatePhysicsRecursive(VELOCITY_CHANGED); EFL_DIRTY_ABSVELOCITY = 0x1000
pEnt->SetAbsVelocity(pEnt->GetVelocity());
// invalidates prior animations
if (AnimState->m_iLastClientSideAnimationUpdateFramecount == g_pGlobalVars->framecount)
AnimState->m_iLastClientSideAnimationUpdateFramecount = g_pGlobalVars->framecount - 1;
pEnt->ClientAnimations(true);
// updates local animations + poses + calculates new abs angle based on eyeangles and other stuff
// call resolver
proper_brute(pEnt);
pEnt->UpdateClientAnimation();
pEnt->ClientAnimations(false);
// restore
pEnt->m_iEFlags() = backup_eflags;
g_pGlobalVars->curtime = curtime;
g_pGlobalVars->frametime = frametime;
pEnt->InvalidateBoneCache();
pEnt->SetupBones(nullptr, -1, 0x7FF00, g_pGlobalVars->curtime);
}
void HandleHits(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::OnCreateMove() // cancer v2
{
if (!c_config::get().aimbot_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))
{
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 Resolver::FrameStage(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);
proper_brute(pPlayerEntity);
AnimationFix(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;
}//
}
Код:
#include "Resolver.h"
#include "..\Aimbot\Aimbot.h"
#include "..\Aimbot\Autowall.h"
#include "..\Aimbot\LagComp.h"
#include "..\..\Utils\Utils.h"
#include "..\..\SDK\ICvar.h"
#include "../../SDK/CEntity.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"
Resolver g_Resolver;
void Resolver::AnimationFix(C_BaseEntity* pEnt)
{
if (pEnt == Globals::LocalPlayer) {
pEnt->ClientAnimations(true);
auto player_animation_state = pEnt->AnimState();
player_animation_state->m_flLeanAmount = 20;
player_animation_state->m_flCurrentTorsoYaw += 15;
pEnt->UpdateClientAnimation();
pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
pEnt->ClientAnimations(false);
}
else {
auto player_index = pEnt->EntIndex() - 1;
pEnt->ClientAnimations(true);
auto old_curtime = g_pGlobalVars->curtime;
auto old_frametime = g_pGlobalVars->frametime;
g_pGlobalVars->curtime = pEnt->GetSimulationTime();
g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
auto player_animation_state = pEnt->AnimState();
auto player_model_time = reinterpret_cast<int*>(player_animation_state + 112);
if (player_animation_state != nullptr && player_model_time != nullptr)
if (*player_model_time == g_pGlobalVars->framecount)
* player_model_time = g_pGlobalVars->framecount - 1;
pEnt->UpdateClientAnimation();
g_pGlobalVars->curtime = old_curtime;
g_pGlobalVars->frametime = old_frametime;
//pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
pEnt->ClientAnimations(false);
}
}
void enemy_anim_fix(C_BaseEntity* entity)
{
auto state = entity->AnimState(); if (!state) return;
auto index = entity->EntIndex();
static float sim_time[65];
if (sim_time[index] != entity->GetSimulationTime())
{
const float curtime = g_pGlobalVars->curtime;
const float frametime = g_pGlobalVars->frametime;
static auto host_timescale = g_pCvar->FindVar(("host_timescale"));
g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick * host_timescale->GetFloat();
g_pGlobalVars->curtime = entity->GetSimulationTime() + g_pGlobalVars->intervalPerTick;
Vector backup_velocity = entity->GetVelocity();
int backup_flags = entity->GetFlags();
Vector abs = entity->GetAbsAngles();
AnimationLayer backup_layers[15];
std::memcpy(backup_layers, entity->AnimOverlays(), (sizeof(AnimationLayer) * 15));
state->m_bOnGround ? backup_flags |= (1 << 0) : backup_flags &= ~(1 << 0);
backup_flags &= ~0x1000;
abs = entity->GetVelocity();
abs = entity->GetVelocity();
if (state->m_iLastClientSideAnimationUpdateFramecount == g_pGlobalVars->framecount)
state->m_iLastClientSideAnimationUpdateFramecount = g_pGlobalVars->framecount - 1;
entity->UpdateClientAnimation();
float lby_delta = entity->GetLowerBodyYaw() - entity->GetEyeAngles().y;
lby_delta = std::remainderf(lby_delta, 360.f);
lby_delta = std::clamp(lby_delta, -60.f, 60.f);
float feet_yaw = std::remainderf(entity->GetEyeAngles().y + lby_delta, 360.f);
if (feet_yaw < 0.f) {
feet_yaw += 360.f;
}
static float pitch, yaw = 0.f;
entity->AnimState()->m_flGoalFeetYaw = entity->AnimState()->m_flCurrentFeetYaw = feet_yaw;
std::memcpy(entity->AnimOverlays(), backup_layers, (sizeof(AnimationLayer) * 15));
g_pGlobalVars->curtime = curtime;
g_pGlobalVars->frametime = frametime;
sim_time[index] = entity->GetSimulationTime();
}
// entity->InvalidateBoneCache();
entity->SetupBones(nullptr, -1, 0x7FF00, g_pGlobalVars->curtime);
}
float flAngleMod(float flAngle)
{
return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
}
float ApproachAngle(float target, float value, float speed)
{
target = flAngleMod(target);
value = flAngleMod(value);
float delta = target - value;
// Speed is assumed to be positive
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;
}
/*
*/
float fl_approach_angle(float fl_target, float fl_value, float fl_speed)
{
auto fl_angle_mod = [](float fl_angle) -> float
{
return ((360.0f / 65536.0f) * ((int32_t)(fl_angle * (65536.0f / 360.0f)) & 65535));
};
float fl_adjusted_speed = fl_speed;
if (fl_adjusted_speed < 0.0f)
fl_adjusted_speed *= -1.0f;
float fl_angle_mod_target = fl_angle_mod(fl_target);
float fl_angle_mod_value = fl_angle_mod(fl_value);
float fl_delta = (fl_angle_mod_target - fl_angle_mod_value);
if (fl_delta >= -180.0f)
{
if (fl_delta >= 180.0f)
fl_delta -= 360.0f;
}
else
{
if (fl_delta <= -180.0f)
fl_delta += 360.0f;
}
float fl_return;
if (fl_delta <= fl_adjusted_speed)
{
if ((fl_adjusted_speed * -1.0f) <= fl_delta)
fl_return = fl_angle_mod_target;
else
fl_return = (fl_angle_mod_value - fl_adjusted_speed);
}
else
fl_return = (fl_angle_mod_value + fl_adjusted_speed);
return fl_return;
}
float Resolver::AngleNormalize(float angle)
{
angle = fmodf(angle, 360.0f);
if (angle > 180)
{
angle -= 360;
}
if (angle < -180)
{
angle += 360;
}
return angle;
}
float Resolver::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 Resolver::angle_difference(float a, float b) {
auto diff = NormalizeYaw180(a - b);
if (diff < 180)
return diff;
return diff - 360;
}
float Resolver::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 Resolver::approach_angle(float cur, float target, float inc) {
auto diff = angle_difference(target, cur);
return approach(cur, cur + diff, inc);
}
float server_goal_feet_yaw(C_BaseEntity* entity)
{
auto animstate = entity->AnimState();
if (!animstate)
return 0.f;
auto ground_fraction = *(float*)(animstate + 0x11C);
auto duck_ammount = *(float*)(animstate + 0xA4);
auto ducking_speed = max(0.f, min(1.f, *reinterpret_cast<float*> (animstate + 0xFC)));
auto running_speed = max(0.f, min(*reinterpret_cast<float*> (animstate + 0xF8), 1.f));
auto abs_velocity = *reinterpret_cast<Vector*> (uintptr_t(entity) + 0x94);
auto speed = std::fmin(abs_velocity.Length2D(), 260.0f);
auto goal_feet_yaw = animstate->m_flGoalFeetYaw;
auto angle_diff = [](float destAngle, float srcAngle) -> float
{
auto delta = 0.f;
delta = fmodf(destAngle - srcAngle, 360.0f);
if (destAngle > srcAngle)
{
if (delta >= 180)
delta -= 360;
}
else
{
if (delta <= -180)
delta += 360;
}
return delta;
};
auto eye_feet_delta = angle_diff(animstate->m_flEyeYaw, goal_feet_yaw);
auto flYawModifier = (((ground_fraction * -0.3f) - 0.2f) * running_speed) + 1.0f;
if (duck_ammount > 0.0f)
flYawModifier = flYawModifier + ((duck_ammount * ducking_speed) * (0.5f - flYawModifier));
auto flMaxYawModifier = flYawModifier * 58.f;
auto flMinYawModifier = flYawModifier * -58.f;
if (eye_feet_delta <= flMaxYawModifier)
{
if (flMinYawModifier > eye_feet_delta)
goal_feet_yaw = fabs(flMinYawModifier) + animstate->m_flEyeYaw;
}
else
goal_feet_yaw = animstate->m_flEyeYaw - fabs(flMaxYawModifier);
if (goal_feet_yaw > 5000 || goal_feet_yaw < -5000)
return 0.f;
g_Math.NormalizeYaw(goal_feet_yaw);
if (speed > 0.1f || fabs(abs_velocity.z) > 100.0f)
{
goal_feet_yaw = fl_approach_angle(
animstate->m_flEyeYaw,
goal_feet_yaw,
((ground_fraction * 20.0f) + 30.0f)
* animstate->m_flLastClientSideAnimationUpdateTime);
}
else
{
goal_feet_yaw = fl_approach_angle(
entity->GetLowerBodyYaw(),
goal_feet_yaw,
animstate->m_flLastClientSideAnimationUpdateTime * 100.0f);
}
if (goal_feet_yaw > 5000 || goal_feet_yaw < -5000)
return 0.f;
g_Math.NormalizeYaw(goal_feet_yaw);
return goal_feet_yaw;
}
void update_state(C_AnimState * 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 HandleBackUpResolve(C_BaseEntity * pEnt) {
if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
return;
const auto player_animation_state = pEnt->AnimState();
if (!player_animation_state)
return;
if (Globals::MissedShots[pEnt->EntIndex()] > 2) {
switch (Globals::MissedShots[pEnt->EntIndex()] % 4) {
case 0: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 45; break;
case 1: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 45; break;
case 2: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 30; break;
case 3: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 30; 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;
}
/*static int stored_yaw = 0;
if (pEnt->GetEyeAnglesPointer()->y != stored_yaw) {
if ((pEnt->GetEyeAnglesPointer()->y - stored_yaw > 120)) { // Arbitrary high angle value.
if (pEnt->GetEyeAnglesPointer()->y - stored_yaw > 120) {
pEnt->GetEyeAnglesPointer()->y = pEnt->GetEyeAnglesPointer()->y - (pEnt->GetEyeAnglesPointer()->y - stored_yaw);
}
stored_yaw = pEnt->GetEyeAnglesPointer()->y;
}
}*/
//if (pEnt->GetVelocity().Length2D() > 0.1f)
//{
// player_animation_state->m_flGoalFeetYaw = ApproachAngle(pEnt->GetLowerBodyYaw(), player_animation_state->m_flGoalFeetYaw, (player_animation_state->m_flStopToFullRunningFraction * 20.0f) + 30.0f *player_animation_state->m_flLastClientSideAnimationUpdateTime);
//}
//else
//{
// player_animation_state->m_flGoalFeetYaw = ApproachAngle(pEnt->GetLowerBodyYaw(), player_animation_state->m_flGoalFeetYaw, (m_flLastClientSideAnimationUpdateTimeDelta * 100.0f));
//}
//if (Globals::MissedShots[pEnt->EntIndex()] > 3) {
// switch (Globals::MissedShots[pEnt->EntIndex()] % 4) {
// case 0: pEnt->GetEyeAnglesPointer()->y = pEnt->GetEyeAnglesPointer()->y + 45; break;
// case 1: pEnt->GetEyeAnglesPointer()->y = pEnt->GetEyeAnglesPointer()->y - 45; break;
// case 2: pEnt->GetEyeAnglesPointer()->y = pEnt->GetEyeAnglesPointer()->y - 30; break;
// case 3: pEnt->GetEyeAnglesPointer()->y = pEnt->GetEyeAnglesPointer()->y + 30; break;
// }
//}
}
void HandleHits(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;
}
#include "../../SDK/CEntity.h"
void resolve(C_BaseEntity* ent)
{
if (!c_config::get().aimbot_resolver1)
return;
if (!Globals::LocalPlayer->IsAlive())
return;
if (ent != Globals::LocalPlayer)
enemy_anim_fix(ent);
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;
v25 = std::clamp(animState->m_fLandingDuckAdditiveSomething + ent->m_flDuckAmount(), 1.0f, 0.0f);
float v32;
v32 = ent->GetSimulationTime() - ent->GetOldSimulationTime();
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*)Globals::LocalPlayer->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 = (((*(float*)(uintptr_t(animState) + 0x11c) * -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_Resolver.resolverinfoo.fakegoalfeetyaw, 360.f);
if (flEyeDiff <= m_flMaxBodyYaw) {
if (m_flMinBodyYaw > flEyeDiff)
g_Resolver.resolverinfoo.fakegoalfeetyaw = fabs(m_flMinBodyYaw) + flEyeYaw;
}
else {
g_Resolver.resolverinfoo.fakegoalfeetyaw = flEyeYaw - fabs(m_flMaxBodyYaw);
}
g_Resolver.resolverinfoo.fakegoalfeetyaw = std::remainderf(g_Resolver.resolverinfoo.fakegoalfeetyaw, 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
g_Resolver.resolverinfoo.fakegoalfeetyaw = g_Resolver.approach_angle(
flEyeYaw,
g_Resolver.resolverinfoo.fakegoalfeetyaw,
((*(float*)(uintptr_t(animState) + 0x11c) * 20.0f) + 30.0f)
* v32);
}
else {
g_Resolver.resolverinfoo.fakegoalfeetyaw = g_Resolver.approach_angle(
ent->GetLowerBodyYaw(),
g_Resolver.resolverinfoo.fakegoalfeetyaw,
v32 * 100.0f);
}
float Left = flEyeYaw - m_flMinBodyYaw;
float Right = flEyeYaw - m_flMaxBodyYaw;
float resolveYaw;
switch (Globals::MissedShots[ent->EntIndex()] % 2)
{
case 0:
resolveYaw = Left;
break;
case 1:
resolveYaw = Right;
break;
}
animState->m_flGoalFeetYaw = resolveYaw;
}
void Resolver::OnCreateMove() // cancer v2
{
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))
{
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 Resolver::FrameStage(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;
}
}
C++:
#include "c_resolver.h"
#include "../utils/math.h"
#include "c_aimhelper.h"
#include "c_trace_system.h"
#include "../sdk/c_client_entity_list.h"
#include <random>
#include "c_esp.h"
c_resolver resolver;
void c_resolver::resolve(c_animation_system::animation* anim, c_base_entity* entity, c_cs_player* local, c_engine_client* engine, c_animation_system* data)
{
struct CFeetData
{
int m_fFlags;
c_qangle m_angEyeAngles;
float m_flDuckAmount;
float m_flLowerBodyYawTarget;
float m_flFeetCycle;
float m_flFeetYawRate;
};
struct CResolverData
{
bool m_bLeftDormancy;
c_animation_system m_aAnimationLayers[13];
float m_flFeetCycle;
float m_flFeetYawRate;
float m_flDuckAmount;
c_qangle m_angEyeAngles;
c_vector3d m_vecVelocity;
int m_nChoked;
};
struct CAnimationData
{
float m_flLeftAngle;
float m_flRightAngle;
bool m_bForcedVelocity;
};
CFeetData m_FeetData;
local->set_abs_origin(local->get_origin());
if (local->flags::on_ground)
{
local->get_anim_state()->on_ground = true;
local->get_anim_state()->in_hit_ground_animation = false;
}
if (!local)
{
local->get_anim_state()->feet_cycle = local->get_anim_state()->feet_cycle;
local->get_anim_state()->feet_yaw_rate = local->get_anim_state()->feet_yaw_rate;
}
float m_flBruteAngle;
if (!local)
{
int m_iside;
if (m_iside)
{
if (m_iside > 0)
{
if (!local)
m_flBruteAngle = 60.f;
}
else if (m_iside < 0)
{
if (!local)
m_flBruteAngle + 60.f;
}
}
}
}
void c_resolver::on_player_hurt(c_game_event* event)
{
if (!event || !config->Ragebot.enable)
return;
auto local = c_cs_player::get_local_player();
if (!local || !local->is_alive())
return;
const auto attacker = client_entity_list()->get_client_entity(
engine_client()->get_player_for_user_id(event->get_int(_("attacker"))));
const auto target = reinterpret_cast<c_cs_player*>(client_entity_list()->get_client_entity(
engine_client()->get_player_for_user_id(event->get_int(_("userid")))));
if (attacker && target && attacker == local && target->is_enemy())
{
static const auto hit_msg = __("Hit %s in %s for %d damage");
_rt(hit, hit_msg);
char msg[255];
const auto hitgroup = event->get_int("hitgroup");
const auto dmg = event->get_int("dmg_health");
switch (hitgroup)
{
case hitgroup_head:
sprintf_s(msg, hit, target->get_info().name, _("head"), dmg);
break;
case hitgroup_leftleg:
case hitgroup_rightleg:
sprintf_s(msg, hit, target->get_info().name, _("leg"), dmg);
break;
case hitgroup_stomach:
sprintf_s(msg, hit, target->get_info().name, _("stomach"), dmg);
break;
default:
sprintf_s(msg, hit, target->get_info().name, _("body"), dmg);
break;
}
_events.push_back(_event(msg));
int index = target->index();
resolver.missed_due_to_bad_resolve[index]--;
resolver.missed_due_to_bad_resolve[index] =
std::clamp(resolver.missed_due_to_bad_resolve[index], 0, 99);
}
}
void c_resolver::on_bullet_impact(c_game_event* event)
{
if (!event || !config->Ragebot.enable)
return;
auto local = c_cs_player::get_local_player();
if (!local || !local->is_alive())
return;
const auto target = reinterpret_cast<c_cs_player*>(client_entity_list()->get_client_entity(engine_client()->get_player_for_user_id(event->get_int(_("userid")))));
if (!target || target != local)
return;
c_vector3d pos(event->get_float(_("x")), event->get_float(_("y")), event->get_float(_("z")));
// this can still be improved by a lot.
// it doesnt account for the delay between the server, client and such.
auto missed_due_to_spread = [&](c_vector3d pos)
{
c_vector3d aim_eye_pos = resolver.last_eye_pos;
c_qangle impact_angle = math::calc_angle(aim_eye_pos, pos);
c_vector3d forward, right, up, new_angle, end;
math::angle_vectors(impact_angle, forward, right, up);
math::vector_angles(forward, new_angle);
// calculate end point of trace.
math::angle_vectors(new_angle, end);
if (resolver.last_shot_missed_index > 0)
{
if (!c_aimhelper::can_hit_hitbox(resolver.last_shot_missed_index,
resolver.last_eye_pos,
resolver.last_eye_pos + end.normalize() * 8192.f,
resolver.last_bones, resolver.last_hitbox))
{
resolver.missed_due_to_spread[resolver.last_shot_missed_index]++;
resolver.missed_due_to_spread[resolver.last_shot_missed_index] = std::clamp(resolver.missed_due_to_spread[resolver.last_shot_missed_index], 0, 99);
_events.push_back(_event("Missed due to bad resolve.")); //logging->info(_("Missed due to bad resolve.")); // game events.
}
else
{
resolver.missed_due_to_bad_resolve[resolver.last_shot_missed_index]++;
resolver.missed_due_to_bad_resolve[resolver.last_shot_missed_index] = std::clamp(resolver.missed_due_to_bad_resolve[resolver.last_shot_missed_index], 0, 99);
}
}
resolver.last_shot_missed_index = 0;
};
missed_due_to_spread(pos);
}
void c_resolver::on_round_start(c_game_event* event)
{
resolver.last_shot_missed_index = 0;
resolver.has_target = false;
std::fill(resolver.missed_due_to_bad_resolve, resolver.missed_due_to_bad_resolve +
ARRAYSIZE(resolver.missed_due_to_bad_resolve), 0);
std::fill(resolver.missed_due_to_spread, resolver.missed_due_to_spread +
ARRAYSIZE(resolver.missed_due_to_spread), 0);
}
void c_resolver::on_player_death(c_game_event* event)
{
if (!event || !config->Ragebot.enable)
return;
auto local = c_cs_player::get_local_player();
if (!local || !local->is_alive())
{
resolver.last_shot_missed_index = 0;
return;
}
int victim_id = event->get_int(_("userid"));
int killer_id = event->get_int(_("attacker"));
bool is_headshot = event->get_int(_("headshot"));
int victim_index = engine_client()->get_player_for_user_id(victim_id);
int killer_index = engine_client()->get_player_for_user_id(killer_id);
if (victim_index && killer_index && local)
{
resolver.missed_due_to_bad_resolve[victim_index] = 0;
resolver.missed_due_to_spread[victim_index] = 0;
}
}
bool c_resolver::get_target_freestand_yaw(c_cs_player* target, float* yaw)
{
float dmg_left = 0.f;
float dmg_right = 0.f;
static auto get_rotated_pos = [](c_vector3d start, float rotation, float distance)
{
float rad = deg2rad(rotation);
start.x += cos(rad) * distance;
start.y += sin(rad) * distance;
return start;
};
const auto local = c_cs_player::get_local_player();
if (!local || !target || !local->is_alive())
return false;
c_vector3d local_eye_pos = local->get_shoot_position();
c_vector3d eye_pos = target->get_shoot_position();
c_qangle angle = math::calc_angle(local_eye_pos, eye_pos);
auto backwards = angle.y;
c_vector3d pos_left = get_rotated_pos(eye_pos, angle.y + 90.f, 40.f);
c_vector3d pos_right = get_rotated_pos(eye_pos, angle.y + 90.f, -40.f);
const auto wall_left = trace_system->wall_penetration(local_eye_pos, pos_left,
nullptr, local);
const auto wall_right = trace_system->wall_penetration(local_eye_pos, pos_right,
nullptr, local);
if (wall_left.has_value())
dmg_left = wall_left.value().damage;
if (wall_right.has_value())
dmg_right = wall_right.value().damage;
// we can hit both sides, lets force backwards,cuz easier for anti aim.
if (fabsf(dmg_left - dmg_right) < 10.f)
{
*yaw = backwards;
return false;
}
bool direction = dmg_left > dmg_right;
*yaw = direction ? angle.y - 90.f : angle.y + 90.f;
return true;
}
float c_resolver::get_max_desync_delta(c_cs_player* player)
{
if (!player || !player->is_alive() || player->is_dormant_virt())
return 0.f;
auto animstate = uintptr_t(player->get_anim_state());
if (!animstate)
return 0.f;
float duckammount = *(float*)(animstate + 0xA4);
float speedfraction = std::max<float>(0, std::min(*reinterpret_cast<float*>(animstate + 0xF8), 1.f));
float speedfactor = speedfraction >= 0.f ? std::max<float>(0, std::min(1.f, *reinterpret_cast<float*> (animstate + 0xFC))) : speedfactor = 0.f;
float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999)* speedfraction;
float unk2 = unk1 + 1.f;
if (duckammount > 0)
unk2 += +((duckammount * speedfactor) * (0.5f - unk2));
auto retvalue = *(float*)(animstate + 0x334) * unk2;
if (retvalue > 1.f) // account for rounding errors
retvalue -= 1.f;
retvalue = std::clamp(retvalue, 28.f, 60.f);
return retvalue;
}
если что, 1 и 3 полностью спащены, а 2 почти мой
критика с объяснениями принимается
Последнее редактирование: