forked from ZEROWyt/Overwatch-2-TOPE-EXTERNAL-CHEAT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Target.hpp
92 lines (79 loc) · 1.84 KB
/
Target.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once
#include "includes.hpp";
namespace OW {
static Vector2 GetAimEnemy()
{
int TarGetIndex = -1;
Vector2 target = Vector2(0, 0);
Vector2 CrossHair = Vector2(GetSystemMetrics(SM_CXSCREEN) / 2.0f, GetSystemMetrics(SM_CYSCREEN) / 2.0f);
float origin = FLT_MAX;
if (TarGetIndex == -1)
{
if (Entity_t.size() > 0)
{
for (int i = 0; i < Entity_t.size(); i++)
{
if (Entitys[i].Live && Entitys[i].Team)
{
Vector2 Vec2{};
if (Config::prediction) {
if (!viewMatrix.WorldToScreen(Entitys[i].predict, &Vec2))
continue;
}
else {
if (!viewMatrix.WorldToScreen(Entitys[i].head, &Vec2))
continue;
}
Vector2 RealVe2 = Vector2(Vec2.X - CrossHair.X, Vec2.Y - CrossHair.Y);
float CrossDist = CrossHair.Distance(Vec2);
if (CrossDist < origin && CrossDist < Config::Fov)
{
target = RealVe2;
origin = CrossDist;
TarGetIndex = i;
}
else
{
TarGetIndex = -1;
}
}
else
{
TarGetIndex = -1;
}
}
}
}
else
{
if (Entitys[TarGetIndex].Live && Entitys[TarGetIndex].Team)
{
Vector2 Vec2{};
if (Config::prediction) {
if (!viewMatrix.WorldToScreen(Entitys[TarGetIndex].predict, &Vec2))
return { 0 , 0 };
}
else {
if (!viewMatrix.WorldToScreen(Entitys[TarGetIndex].center, &Vec2))
return { 0 , 0 };
}
Vector2 RealVe2 = Vector2(Vec2.X - CrossHair.X, Vec2.Y - CrossHair.Y);
float CrossDist = CrossHair.Distance(Vec2);
if (CrossDist < origin && CrossDist < Config::Fov)
{
target = RealVe2;
origin = CrossDist;
}
else
{
TarGetIndex = -1;
}
}
else
{
TarGetIndex = -1;
}
}
return target;
}
}