Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 7df5095

Browse files
authored
merge: from dev
Add aimbot fov, code refactor and fixes
2 parents bec97f9 + d6b308a commit 7df5095

27 files changed

+149
-51
lines changed

src/Destiny.ut.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<ClCompile Include="features\rcs.cpp" />
4040
<ClCompile Include="features\triggerbot.cpp" />
4141
<ClCompile Include="helpers\Console.cpp" />
42+
<ClCompile Include="helpers\math.cpp" />
4243
<ClCompile Include="helpers\Memory.cpp" />
4344
<ClCompile Include="helpers\offsets.cpp" />
4445
<ClCompile Include="helpers\utils.cpp" />
@@ -68,6 +69,7 @@
6869
<ClInclude Include="..\res\resource.h" />
6970
<ClInclude Include="features\Features.hpp" />
7071
<ClInclude Include="helpers\Console.hpp" />
72+
<ClInclude Include="helpers\math.hpp" />
7173
<ClInclude Include="helpers\Memory.hpp" />
7274
<ClInclude Include="helpers\offsets.hpp" />
7375
<ClInclude Include="helpers\utils.hpp" />

src/Destiny.ut.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
<ClCompile Include="helpers\Console.cpp">
136136
<Filter>src\helpers</Filter>
137137
</ClCompile>
138+
<ClCompile Include="helpers\math.cpp">
139+
<Filter>src\helpers</Filter>
140+
</ClCompile>
138141
</ItemGroup>
139142
<ItemGroup>
140143
<ClInclude Include="menu.hpp">
@@ -230,6 +233,9 @@
230233
<ClInclude Include="..\res\resource.h">
231234
<Filter>res</Filter>
232235
</ClInclude>
236+
<ClInclude Include="helpers\math.hpp">
237+
<Filter>src\helpers</Filter>
238+
</ClInclude>
233239
</ItemGroup>
234240
<ItemGroup>
235241
<Library Include="..\lib\glfw\lib\glfw3.lib">

src/features/aimbot.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#include "features.hpp"
2+
#include "../helpers/math.hpp"
3+
#include "../helpers/utils.hpp"
24
#include "../settings/globals.hpp"
35
#include "../sdk/Vector.hpp"
46
#include "../sdk/CEntity.hpp"
57

6-
#define M_PI 3.14159265358979323846f
78
#define KEY_DOWN 0x8000
89

910
CEntity getClosestEnemy()
1011
{
11-
CEntity entity{};
1212
float closest = FLT_MAX;
1313
int closestIndex = -1;
1414

1515
for (int i = 0; i < 64; ++i)
1616
{
17-
entity = g_Client.getEntityFromList(i);
17+
CEntity entity = g_Client.getEntityFromList(i);
1818

19-
if ((!entity) || (entity == g_LocalPlayer))
19+
if ((entity == NULL) || (entity == g_LocalPlayer))
2020
continue;
2121

2222
if ((!entity.isAlive()) || (entity.isDormant()))
@@ -37,7 +37,16 @@ CEntity getClosestEnemy()
3737
if ((!g_LocalPlayer.getFlags()) && (g_Options.Legit.Aimbot.InAir))
3838
continue;
3939

40-
const float distance = g_LocalPlayer.getOrigin().to(entity.getOrigin()).mag();
40+
Vector2 angles = math::CalculateAngle(g_LocalPlayer.getEyeLocation(), entity.getOrigin());
41+
Vector2 enemyPos{};
42+
if (!math::WorldToScreen(entity.getOrigin(), enemyPos))
43+
continue;
44+
45+
const SIZE windowSize = utils::getTargetSize();
46+
const float distance = std::sqrtf(std::powf(enemyPos.x - (windowSize.cx / 2.f), 2) + std::powf(enemyPos.y - (windowSize.cy / 2.f), 2));
47+
if (distance > g_Options.Legit.Aimbot.Fov)
48+
continue;
49+
4150
if (distance < closest)
4251
{
4352
closest = distance;
@@ -50,13 +59,8 @@ CEntity getClosestEnemy()
5059

5160
void aimAt(Vector3& target)
5261
{
53-
Vector3 myPos = g_LocalPlayer.getOrigin() + g_LocalPlayer.getViewOffset();
54-
Vector3 deltaVec = myPos.to(target);
55-
Vector2 newAngles{};
56-
5762
// Calculate new view angles
58-
newAngles.x = -std::asin(deltaVec.z / deltaVec.mag()) * (180.f / M_PI);
59-
newAngles.y = std::atan2(deltaVec.y, deltaVec.x) * (180.f / M_PI);
63+
Vector2 newAngles = math::CalculateAngle(g_LocalPlayer.getEyeLocation(), target);
6064

6165
// Add RCS if requested
6266
if (g_Options.Legit.RCS.Enable)
@@ -86,11 +90,11 @@ void features::legit::aimbot()
8690
return;
8791

8892
CWeaponEntity weapon = g_LocalPlayer.getActiveWeapon();
89-
if ((!weapon) || (!weapon.isGun()))
93+
if ((weapon == NULL) || (!weapon.isGun()))
9094
return;
9195

9296
CEntity entity = getClosestEnemy();
93-
if (!entity)
97+
if (entity == NULL)
9498
return;
9599

96100
Vector3 targetPos = entity.getBoneById(g_Options.Legit.Aimbot.TargetBone + 3);

src/features/autopistol.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ void features::misc::autopistol()
66
if (!g_Options.Misc.Helpers.AutoPistol)
77
return;
88

9-
if (!g_LocalPlayer)
9+
if (g_LocalPlayer == NULL)
1010
return;
1111

1212
if (g_Client.isMouseEnabled())
1313
return;
1414

1515
CWeaponEntity weapon = g_LocalPlayer.getActiveWeapon();
16-
if (!weapon)
17-
return;
18-
19-
if (!weapon.isPistol())
16+
if ((weapon == NULL) || (!weapon.isPistol()))
2017
return;
2118

2219
if (!GetAsyncKeyState(VK_LBUTTON))

src/features/chams.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ ClrRender_t getClrRenderByColor(const Color color)
1212

1313
void features::visuals::chams(CEntity& entity)
1414
{
15-
if (!entity)
15+
if (!g_Options.Visuals.Chams.Enable)
1616
return;
1717

18-
if (entity.isDormant())
19-
return;
20-
21-
if (!entity.isAlive())
22-
return;
23-
24-
if (entity == g_LocalPlayer)
25-
return;
26-
27-
const Color clrRenderColor = g_LocalPlayer.getTeamNum() == entity.getTeamNum() ? g_Options.Colors.Chams.Teammates : g_Options.Colors.Chams.Enemies;
18+
const Color clrRenderColor = (g_LocalPlayer.getTeamNum() == entity.getTeamNum() ? g_Options.Colors.Chams.Teammates : g_Options.Colors.Chams.Enemies);
2819
ClrRender_t clrRender = getClrRenderByColor(clrRenderColor);
2920

3021
entity.setClrRender(clrRender);

src/features/fov.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void features::misc::fov()
66
if (!g_Options.Misc.Helpers.Fov)
77
return;
88

9-
if (!g_LocalPlayer)
9+
if (g_LocalPlayer == NULL)
1010
return;
1111

1212
if (g_LocalPlayer.isScoped())

src/features/glow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ void setGlowStructByColor(GlowStruct_t& glowStruct, const Color& color)
1616

1717
void features::visuals::glow(CEntity& entity)
1818
{
19+
if (!g_Options.Visuals.Glow.Enable)
20+
return;
21+
1922
const int glowIndex = entity.getGlowIndex();
2023
const bool isSpotted = entity.isSpottedBy(g_LocalPlayer);
2124
const int health = entity.getHealth();

src/features/loop.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,18 @@
33

44
void features::visuals::loop()
55
{
6-
if (!g_Options.Visuals.EnableGlobal)
7-
return;
8-
96
if (!g_Engine.isConnected())
107
return;
118

129
for (int i = 0; i < 64; ++i)
1310
{
1411
CEntity entity = g_Client.getEntityFromList(i);
1512

16-
if (!entity)
17-
return;
18-
19-
if (entity.isDormant())
20-
return;
21-
22-
if (!entity.isAlive())
23-
return;
13+
if ((entity == NULL) || (entity == g_LocalPlayer))
14+
continue;
2415

25-
if (entity == g_LocalPlayer)
26-
return;
16+
if ((!entity.isAlive()) || (entity.isDormant()))
17+
continue;
2718

2819
radar(entity);
2920
glow(entity);

src/features/radar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33

44
void features::visuals::radar(CEntity& entity)
55
{
6-
entity.setSpotted(true);
6+
if (g_Options.Visuals.World.Radar)
7+
entity.setSpotted(true);
78
}

src/features/triggerbot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ void features::legit::triggerbot()
5757
return;
5858

5959
CEntity entity = getPlayerInCrosshair();
60-
if (!entity)
60+
if (entity == NULL)
6161
return;
6262

63-
if (!entity.isAlive())
63+
if ((!entity.isAlive()) || (entity.isDormant()))
6464
return;
6565

6666
if ((entity.getTeamNum() == g_LocalPlayer.getTeamNum()) && (!g_Options.Legit.Triggerbot.Deathmatch))

0 commit comments

Comments
 (0)