diff --git a/Globals.cpp b/Globals.cpp index e07dc4b..6c65706 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -1441,7 +1441,7 @@ bool SingletonGlobalVars::LockFromExecuting(ModuleAddresses* modules, bool& isAd //-------------------------------------------------------------// void SingletonGlobalVars::NewRound(AddressesList& addressesList, bool& newRound) { - int newMatch = *(int*)(addressesList.inMatch); + int newMatch = *(int*)(addressesList.inMatch);// if (!(newRound) && newMatch) { newRound = true; @@ -1451,8 +1451,9 @@ void SingletonGlobalVars::NewRound(AddressesList& addressesList, bool& newRound) } //-------------------------------------------------------------// -void SingletonGlobalVars::FindMaxId(const int maxPlayers, AddressesList& addressesList, int maxId) +unsigned int SingletonGlobalVars::FindMaxId(const int maxPlayers, AddressesList& addressesList) { + unsigned int maxId = 0; for (int i = 0; i < maxPlayers; i++) { int bufferId = *(int*)(addressesList.entBase + i * addressesList.playerOffset); @@ -1480,7 +1481,7 @@ void SingletonGlobalVars::FillPlayerData(const int& maxPlayers, AddressesList& a //names attacker if (ents.size()) - for (std::shared_ptr& player : ents) + for (auto& player : ents) { //fill names if (allPlayerNames.size()) diff --git a/aim.cpp b/aim.cpp index 0c5459d..bc0baca 100644 --- a/aim.cpp +++ b/aim.cpp @@ -13,14 +13,15 @@ #include "ent.h" #include "aim.h" #include "memory.h" +#include constexpr float kModelHeight = 64.118f; constexpr float kHeadAdjustment = 1.9f; constexpr float kCrouchAdjustment = 3.0f; constexpr float kOnGround = 2.0f; constexpr float kCrouchHeightAdjustment = -35.0f; -constexpr float kDegreesToRad = PI / 180.0f; -constexpr float kRadToDegrees = 180.0f/ PI; +constexpr float kDegreesToRad = std::numbers::pi_v / 180.0f; +constexpr float kRadToDegrees = 180.0f/ std::numbers::pi_v; constexpr float kDefaultDistAdjustment = 920.0; constexpr float kDistanceMultiplier = 900.0f; @@ -35,17 +36,16 @@ int iterator = 0; bool Aim::IsOnGround(int stance) const { - bool isFallen = false; if (stance < 50 || stance == 1234 || stance == 1257 || stance == 1256 || stance == 1258) { - isFallen = true; + return true; } - return isFallen; + return false; } //-------------------------------------------------------------// @@ -322,12 +322,12 @@ float Aim::AngleBetweenEnemyX(float X, float Y) const if (((X < 0) && (Y > 0)) || ((X < 0) && (Y < 0))) { angle = atan(Y / X); - angle += (float)PI; + angle += std::numbers::pi_v; } else if ((X > 0) && (Y < 0)) - angle = (float)(2 * PI + atan(Y / X)); + angle = 2 * std::numbers::pi_v + atan(Y / X); else - angle = (float)atan(Y / X); + angle = atan(Y / X); float finalAngle = (float)((kRadToDegrees) * angle); return finalAngle; @@ -608,7 +608,7 @@ std::shared_ptr Aim::FindClosestToCrosshair(std::vector &enemy) +void Aim::Pblocks(std::shared_ptr &enemy)// { Weapons weapons; const float pbPitch = 25; @@ -721,7 +721,7 @@ void Aim::Pblocks(std::shared_ptr &enemy) } //-------------------------------------------------------------// -std::shared_ptr Aim::ChooseTarget(std::shared_ptr &chosenTarget, const bool &isTk, bool &isAim) +std::shared_ptr Aim::ChooseTarget(std::shared_ptr &chosenTarget, const bool isTk, bool &isAim) { std::vector> bufferEnts; std::vector> bufferEntsVis; diff --git a/aim.h b/aim.h index 4712d57..59f9d5f 100644 --- a/aim.h +++ b/aim.h @@ -92,7 +92,7 @@ class Aim //choose target - std::shared_ptr ChooseTarget(std::shared_ptr &chosenTarget, const bool &isTk, bool& isAim); + std::shared_ptr ChooseTarget(std::shared_ptr &chosenTarget, const bool isTk, bool& isAim); //lock on diff --git a/ent.h b/ent.h index 0c6bbc2..02a73cc 100644 --- a/ent.h +++ b/ent.h @@ -162,7 +162,7 @@ struct PlayerNames /////////////////////////////////////////////////////////////// // class Ent - entity (player) -class Ent +class Ent//Entity { public: int color1; @@ -170,7 +170,7 @@ class Ent int id; int surface; int saberAnim; - int numWeapon; + unsigned int numWeapon; int stance; int stance2; int hp; @@ -204,8 +204,10 @@ class Ent bool correctColor3; bool correctColor4; - const char* className; + //name.c_str() + std::string name; + std::string shortName; Info2d info2d; diff --git a/nothingSuspicious.vcxproj b/nothingSuspicious.vcxproj index f074e42..12107cc 100644 --- a/nothingSuspicious.vcxproj +++ b/nothingSuspicious.vcxproj @@ -79,7 +79,7 @@ true - C:\Users\ооррр\Desktop\epicHax + .\x64 false @@ -127,6 +127,7 @@ true Use pch.h + stdcpp20 Windows diff --git a/vec.cpp b/vec.cpp index ecaa63b..8dcf4a1 100644 --- a/vec.cpp +++ b/vec.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "vec.h" +#include float DotProduct(const vec3_t vec1, const vec3_t vec2) @@ -25,7 +26,7 @@ void VecSub(vec3_t in, vec3_t added) } //-------------------------------------------------------------// -void VectorSubtract(const vec3_t vec1, const vec3_t vec2, vec3_t vecOut) +void VectorSubtract(const vec3_t& vec1, const vec3_t& vec2, vec3_t& vecOut) { vecOut[0] = vec1[0] - vec2[0]; vecOut[1] = vec1[1] - vec2[1]; @@ -33,7 +34,7 @@ void VectorSubtract(const vec3_t vec1, const vec3_t vec2, vec3_t vecOut) } //-------------------------------------------------------------// -void VecDivByNum(vec3_t in, float numDiv) +void VecDivByNum(vec3_t& in, float numDiv) { in[0] = in[0] / numDiv; in[1] = in[1] / numDiv; @@ -103,7 +104,7 @@ void AngleVectors(float yaw, float pitch, float roll, vec3_t forward, vec3_t rig static float sr, sp, sy, cr, cp, cy; // static to help MS compiler fp bugs - float angleDegrees = (float)(PI * 2 / 360); + float angleDegrees = std::numbers::pi_v * 2.0 / 360.0; angle = yaw * angleDegrees; sy = sinf(angle); diff --git a/vec.h b/vec.h index af9f744..5f2f78e 100644 --- a/vec.h +++ b/vec.h @@ -1,8 +1,4 @@ #pragma once -#include - -constexpr float PI = 3.14159265358979323846; - typedef float vec3_t[3]; typedef float vec2_t[2]; @@ -17,10 +13,10 @@ void VecAdd(vec3_t in, vec3_t added); void VecSub(vec3_t in, vec3_t added); //VectorSubstract - substract vectors end result into vecOut -void VectorSubtract(const vec3_t vec1, const vec3_t vec2, vec3_t vecOut); +void VectorSubtract(const vec3_t& vec1, const vec3_t& vec2, vec3_t& vecOut); //VecDivByNum divide vector by number -void VecDivByNum(vec3_t in, float numDiv); +void VecDivByNum(vec3_t& in, float numDiv); //VecNull - make a vector 0,0,0 void VecNull(vec3_t in);