-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawModelExecute.cpp
217 lines (196 loc) · 6.19 KB
/
DrawModelExecute.cpp
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#include "precompiled.h"
#include "CreateMove.h"
#include "CSGO_HX.h"
#include "Targetting.h"
#include "AutoWall.h"
#include "ThirdPerson.h"
#include "LocalPlayer.h"
#include "FarESP.h"
#include "ServerSide.h"
#include "CPlayerrecord.h"
#include "Adriel/stdafx.hpp"
DrawModelExecuteFn oDrawModelExecute;
/*void ForceMaterial(bool ignoreZ, Color clr, IMaterial* material)
{
if (!material)
return;
if (ignoreZ)
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, true);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, true);
}
else
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, false);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, false);
}
material->AlphaModulate((float)clr.a() / 255.f);
material->ColorModulate((float)clr.r() / 255.f, (float)clr.g() / 255.f, (float)clr.b() / 255.f);
Interfaces::ModelRender->ForcedMaterialOverride(material);
}
void ForceMaterial(bool ignoreZ, int r, int g, int b, int a, IMaterial* material)
{
if (!material)
return;
if (ignoreZ)
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, true);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, true);
}
else
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, false);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, false);
}
material->AlphaModulate((float)a / 255.f);
material->ColorModulate((float)r / 255.f, (float)g / 255.f, (float)b / 255.f);
Interfaces::ModelRender->ForcedMaterialOverride(material);
}
void ForceMaterialAlpha(bool ignoreZ, float a, IMaterial* material)
{
if (!material)
return;
if (ignoreZ)
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, true);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, true);
}
else
{
material->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false);
material->SetMaterialVarFlag(MATERIAL_VAR_ZNEARER, false);
material->SetMaterialVarFlag(MATERIAL_VAR_NOFOG, false);
}
material->AlphaModulate((float)a / 255.f);
Interfaces::ModelRender->ForcedMaterialOverride(material);
}
void ForceMaterialAlpha(int alpha, IMaterial* material)
{
if (!material)
return;
material->AlphaModulate(clamp((float)alpha / 255.f, 0.1f, 1.f));
Interfaces::ModelRender->ForcedMaterialOverride(material);
}*/
void __fastcall Hooks::DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld)
{
START_PROFILING
// update LocalPlayer
LocalPlayer.Get(&LocalPlayer);
// ingame and we exist
if (variable::get().visuals.b_enabled && Interfaces::EngineClient->IsInGame() && LocalPlayer.Entity)
{
// remove AUG/SG scope blur the right way
static bool prev_scope_blur = variable::get().visuals.b_no_scope;
static float prev_spawn_time = LocalPlayer.Entity->GetSpawnTime();
float spawn_time = LocalPlayer.Entity->GetSpawnTime();
// only change materials once to save CPU
if (g_Visuals.BlurMaterials.size() == 3 && (prev_scope_blur != variable::get().visuals.b_no_scope || spawn_time != prev_spawn_time))
{
for (auto mat : g_Visuals.BlurMaterials)
mat->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, variable::get().visuals.b_no_scope);
prev_scope_blur = variable::get().visuals.b_no_scope;
prev_spawn_time = spawn_time;
}
//if (variable::get().visuals.b_enabled)
{
// get model name
std::string _ModelName = Interfaces::ModelInfoClient->GetModelName(pInfo.pModel);
// arms chams
//if (_ModelName.find(XorStrCT("arms")) != std::string::npos)
if(IntFromChars(_ModelName, 24) == 'smra' && IntFromChars(_ModelName, 15) == 'om_v')
{
if (!variable::get().visuals.vf_arms.b_render && variable::get().visuals.vf_arms.b_enabled)
{
END_PROFILING
return;
}
}
// view-weapon chams
//else if (_ModelName.find(XorStrCT("weapons/v")) != std::string::npos)
else if (IntFromChars(_ModelName, 7) == 'paew' && _ModelName[15] == 'v')
{
if (!variable::get().visuals.vf_viewweapon.b_render && variable::get().visuals.vf_viewweapon.b_enabled)
{
END_PROFILING
return;
}
}
// bomb chams
else if (IntFromChars(_ModelName, 17) == '_dei')
{
if (!variable::get().visuals.vf_bomb.b_render && variable::get().visuals.vf_bomb.b_enabled)
{
END_PROFILING
return;
}
}
// thrown projectiles
else if (IntFromChars(_ModelName, 16) == '_qe_')
{
if (!variable::get().visuals.vf_projectile.b_render && variable::get().visuals.vf_projectile.b_enabled)
{
END_PROFILING
return;
}
}
// dropped weapon chams
else if (_ModelName[15] == 'w')
{
if (!variable::get().visuals.vf_weapon.b_render && variable::get().visuals.vf_weapon.b_enabled)
{
END_PROFILING
return;
}
}
// player chams
//else if (_ModelName.find(XorStrCT("play")) != std::string::npos)
else if(IntFromChars(_ModelName, 21) == 'yalp') // models/player/custom_player/*
{
CBaseEntity* entity = (CBaseEntity*)Interfaces::ClientEntList->GetClientEntity(pInfo.entity_index);
if (entity)
{
if (!entity->IsRagdoll())
{
if (!entity->IsLocalPlayer())
{
bool enemy = entity->IsEnemy(LocalPlayer.Entity);
if (enemy && !variable::get().visuals.pf_enemy.vf_main.b_render && variable::get().visuals.pf_enemy.vf_main.b_enabled)
{
END_PROFILING
return;
}
else if (!enemy && !variable::get().visuals.pf_teammate.vf_main.b_render && variable::get().visuals.pf_teammate.vf_main.b_enabled)
{
END_PROFILING
return;
}
}
else
{
if (!variable::get().visuals.pf_local_player.vf_main.b_render && variable::get().visuals.pf_local_player.vf_main.b_enabled)
{
END_PROFILING
return;
}
}
}
else
{
if (!variable::get().visuals.vf_ragdolls.b_render && variable::get().visuals.vf_ragdolls.b_enabled)
{
END_PROFILING
return;
}
}
}
}
}
}
oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
END_PROFILING
}