forked from danielkrupinski/Osiris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameData.h
186 lines (149 loc) · 4.71 KB
/
GameData.h
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#pragma once
#include <forward_list>
#include <mutex>
#include <string>
#include <utility>
#include <vector>
#include "SDK/matrix3x4.h"
#include "SDK/Entity.h"
#include "SDK/Vector.h"
#include "Texture.h"
#include "Memory.h"
struct LocalPlayerData;
struct PlayerData;
struct ObserverData;
struct WeaponData;
struct EntityData;
struct LootCrateData;
struct ProjectileData;
struct BombData;
struct InfernoData;
struct Matrix4x4;
class ClientInterfaces;
namespace GameData
{
void update(const ClientInterfaces& clientInterfaces, const EngineInterfaces& engineInterfaces, const OtherInterfaces& interfaces, const Memory& memory) noexcept;
void clearProjectileList() noexcept;
void clearTextures() noexcept;
void clearUnusedAvatars() noexcept;
class Lock {
public:
Lock() noexcept : lock{ mutex } {}
private:
std::scoped_lock<std::mutex> lock;
static inline std::mutex mutex;
};
// Lock-free
int getNetOutgoingLatency() noexcept;
// You have to acquire Lock before using these getters
const Matrix4x4& toScreenMatrix() noexcept;
const LocalPlayerData& local() noexcept;
const std::vector<PlayerData>& players() noexcept;
const PlayerData* playerByHandle(int handle) noexcept;
const std::vector<ObserverData>& observers() noexcept;
const std::vector<WeaponData>& weapons() noexcept;
const std::vector<EntityData>& entities() noexcept;
const std::vector<LootCrateData>& lootCrates() noexcept;
const std::forward_list<ProjectileData>& projectiles() noexcept;
const BombData& plantedC4() noexcept;
const std::vector<InfernoData>& infernos() noexcept;
}
struct LocalPlayerData {
void update(const Engine& engine) noexcept;
bool exists = false;
bool alive = false;
bool inReload = false;
bool shooting = false;
bool noScope = false;
float nextWeaponAttack = 0.0f;
int fov;
int handle;
float flashDuration;
Vector aimPunch;
Vector origin;
};
class Entity;
struct BaseData {
BaseData(const Entity& entity) noexcept;
float distanceToLocal;
Vector obbMins, obbMaxs;
matrix3x4 coordinateFrame;
};
struct EntityData final : BaseData {
EntityData(const Entity& entity) noexcept;
const char* name;
};
struct ProjectileData : BaseData {
ProjectileData(const ClientInterfaces& clientInterfaces, const Memory& memory, const Entity& projectile) noexcept;
void update(const Memory& memory, const Entity& projectile) noexcept;
constexpr auto operator==(int otherHandle) const noexcept
{
return handle == otherHandle;
}
bool exploded = false;
bool thrownByLocalPlayer = false;
bool thrownByEnemy = false;
int handle;
const char* name = nullptr;
std::vector<std::pair<float, Vector>> trajectory;
};
enum class Team;
struct PlayerData : BaseData {
PlayerData(const EngineInterfaces& engineInterfaces, const OtherInterfaces& interfaces, const Memory& memory, const Entity& entity) noexcept;
PlayerData(const PlayerData&) = delete;
PlayerData& operator=(const PlayerData&) = delete;
PlayerData(PlayerData&&) = default;
PlayerData& operator=(PlayerData&&) = default;
void update(const EngineInterfaces& engineInterfaces, const OtherInterfaces& interfaces, const Memory& memory, const Entity& entity) noexcept;
[[nodiscard]] ImTextureID getAvatarTexture() const noexcept;
[[nodiscard]] float fadingAlpha(const Memory& memory) const noexcept;
bool dormant;
bool enemy = false;
bool visible = false;
bool audible;
bool spotted;
bool inViewFrustum;
bool alive;
bool immune = false;
float flashDuration;
float lastContactTime = 0.0f;
int health;
int handle;
csgo::Team team;
std::string name;
Vector headMins, headMaxs;
Vector origin;
std::string activeWeapon;
std::vector<std::pair<Vector, Vector>> bones;
};
struct WeaponData : BaseData {
WeaponData(const OtherInterfaces& interfaces, const Entity& entity) noexcept;
int clip;
int reserveAmmo;
const char* group = "All";
const char* name = "All";
std::string displayName;
};
struct LootCrateData : BaseData {
LootCrateData(const Entity& entity) noexcept;
const char* name = nullptr;
};
struct ObserverData {
ObserverData(const Entity& entity, const Entity& obs, bool targetIsLocalPlayer) noexcept;
int playerHandle;
int targetHandle;
bool targetIsLocalPlayer;
};
struct BombData {
void update(const Memory& memory) noexcept;
float blowTime;
float timerLength;
int defuserHandle;
float defuseCountDown;
float defuseLength;
int bombsite;
};
struct InfernoData {
InfernoData(const Entity& inferno) noexcept;
std::vector<Vector> points;
};