forked from alimb2/Ayyware-Full-Fixed-Updated-2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ESP.cpp
612 lines (515 loc) · 17.6 KB
/
ESP.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
// Don't take credits for this ;) Joplin / Manhhao are the first uploaders ;)
#include "ESP.h"
#include "Interfaces.h"
#include "RenderManager.h"
void CEsp::Init()
{
BombCarrier = nullptr;
}
// Yeah dude we're defo gunna do some sick moves for the esp yeah
void CEsp::Move(CUserCmd *pCmd,bool &bSendPacket)
{
}
// Main ESP Drawing loop
void CEsp::Draw()
{
IClientEntity *pLocal = hackManager.pLocal();
if (Menu::Window.MiscTab.OtherSpectators.GetState())
{
SpecList();
}
// Loop through all active entitys
for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
{
// Get the entity
IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
player_info_t pinfo;
// The entity isn't some laggy peice of shit or something
if (pEntity && pEntity != pLocal && !pEntity->IsDormant())
{
// Radar
if (Menu::Window.VisualsTab.OtherRadar.GetState())
{
DWORD m_bSpotted = NetVar.GetNetVar(0x839EB159);
*(char*)((DWORD)(pEntity) + m_bSpotted) = 1;
}
// Is it a player?!
if (Menu::Window.VisualsTab.FiltersPlayers.GetState() && Interfaces::Engine->GetPlayerInfo(i, &pinfo) && pEntity->IsAlive())
{
DrawPlayer(pEntity, pinfo);
}
// ~ Other ESP's here (items and shit) ~ //
ClientClass* cClass = (ClientClass*)pEntity->GetClientClass();
// Dropped weapons
if (Menu::Window.VisualsTab.FiltersWeapons.GetState() && cClass->m_ClassID != (int)CSGOClassID::CBaseWeaponWorldModel && ((strstr(cClass->m_pNetworkName, "Weapon") || cClass->m_ClassID == (int)CSGOClassID::CDEagle || cClass->m_ClassID == (int)CSGOClassID::CAK47)))
{
DrawDrop(pEntity, cClass);
}
// If entity is the bomb
if (Menu::Window.VisualsTab.FiltersC4.GetState())
{
if (cClass->m_ClassID == (int)CSGOClassID::CPlantedC4)
DrawBombPlanted(pEntity, cClass);
if (cClass->m_ClassID == (int)CSGOClassID::CC4)
DrawBomb(pEntity, cClass);
}
// If entity is a chicken
if (Menu::Window.VisualsTab.FiltersChickens.GetState())
{
if (cClass->m_ClassID == (int)CSGOClassID::CChicken)
DrawChicken(pEntity, cClass);
}
}
}
// Anti Flash
if (Menu::Window.VisualsTab.OtherNoFlash.GetState())
{
DWORD m_flFlashMaxAlpha = NetVar.GetNetVar(0xFE79FB98);
*(float*)((DWORD)pLocal + m_flFlashMaxAlpha) = 0;
}
}
void CEsp::SpecList()
{
IClientEntity *pLocal = hackManager.pLocal();
RECT scrn = Render::GetViewport();
int ayy = 0;
// Loop through all active entitys
for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); i++)
{
// Get the entity
IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
player_info_t pinfo;
// The entity isn't some laggy peice of shit or something
if (pEntity && pEntity != pLocal)
{
if (Interfaces::Engine->GetPlayerInfo(i, &pinfo) && !pEntity->IsAlive() && !pEntity->IsDormant())
{
HANDLE obs = pEntity->GetObserverTargetHandle();
if (obs)
{
IClientEntity *pTarget = Interfaces::EntList->GetClientEntityFromHandle(obs);
player_info_t pinfo2;
if (pTarget)
{
if (Interfaces::Engine->GetPlayerInfo(pTarget->GetIndex(), &pinfo2))
{
char buf[255]; sprintf_s(buf, "%s => %s", pinfo.name, pinfo2.name);
RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, buf);
Render::Clear(scrn.right - 260, (scrn.bottom / 2) + (16 * ayy), 260, 16, Color(0, 0, 0, 140));
Render::Text(scrn.right - TextSize.right - 4, (scrn.bottom / 2) + (16 * ayy), pTarget->GetIndex() == pLocal->GetIndex() ? Color(240, 70, 80, 255) : Color(255, 255, 255, 255), Render::Fonts::ESP, buf);
ayy++;
}
}
}
}
}
}
Render::Outline(scrn.right - 261, (scrn.bottom / 2) - 1, 262, (16 * ayy) + 2, Color(23, 23, 23, 255));
Render::Outline(scrn.right - 260, (scrn.bottom / 2), 260, (16 * ayy), Color(90, 90, 90, 255));
}
// Yeah m8
void CEsp::DrawPlayer(IClientEntity* pEntity, player_info_t pinfo)
{
ESPBox Box;
Color Color;
// Show own team false? well gtfo teammate lol
if (Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() && (pEntity->GetTeamNum() == hackManager.pLocal()->GetTeamNum()))
return;
if (GetBox(pEntity, Box))
{
Color = GetPlayerColor(pEntity);
/*if (Menu::Window.VisualsTab.OptionsGlow.GetState())
{
int TeamNum = pEntity->GetTeamNum();
if (TeamNum == TEAM_CS_T)
{
DrawGlow(pEntity, 255, 0, 0, 160);
}
else if (TeamNum == TEAM_CS_CT)
{
DrawGlow(pEntity, 0, 0, 255, 160);
}
}*/
if (Menu::Window.VisualsTab.OptionsBox.GetState())
DrawBox(Box, Color);
if (Menu::Window.VisualsTab.OptionsName.GetState())
DrawName(pinfo, Box);
if (Menu::Window.VisualsTab.OptionsHealth.GetState())
DrawHealth(pEntity, Box);
if (Menu::Window.VisualsTab.OptionsInfo.GetState() || Menu::Window.VisualsTab.OptionsWeapon.GetState())
DrawInfo(pEntity, Box);
if (Menu::Window.VisualsTab.OptionsAimSpot.GetState())
DrawCross(pEntity);
if (Menu::Window.VisualsTab.OptionsSkeleton.GetState())
DrawSkeleton(pEntity);
}
}
// glow shit
/*struct Glowobject
{
IClientEntity* pEntity;
Vector Color;
float Alpha;
byte PAD[16];
bool RenderWhenOccluded;
bool RenderWhenUnOccluded;
bool FullBloomRender;
byte PAD2[17];
};
// simple sexy glow
void CEsp::DrawGlow(IClientEntity *pEntity, int r, int g, int b, int a)
{
static uintptr_t Module = (uintptr_t)GetModuleHandle("client_panorama.dll");
Glowobject* GlowManager = *(Glowobject**)(Module + 0x4B71C6C);
if (GlowManager)
{
Glowobject* GlowObject = &GlowManager[pEntity->GetGlowIndex()];
if (GlowObject)
{
GlowObject->RenderWhenOccluded = 1;
GlowObject->RenderWhenUnOccluded = 0;
float glowr = (1 / 255.0f)*r;
float glowg = (1 / 255.0f)*g;
float glowb = (1 / 255.0f)*b;
float glowa = (1 / 255.0f)*a;
GlowObject->Color = Vector((1 / 255.0f)*r, (1 / 255.0f)*g, (1 / 255.0f)*b);
GlowObject->Alpha = (1 / 255.0f)*a;
}
}
}*/
// Gets the 2D bounding box for the entity
// Returns false on failure nigga don't fail me
bool CEsp::GetBox(IClientEntity* pEntity, CEsp::ESPBox &result)
{
// Variables
Vector vOrigin, min, max, sMin, sMax, sOrigin,
flb, brt, blb, frt, frb, brb, blt, flt;
float left, top, right, bottom;
// Get the locations
vOrigin = pEntity->GetOrigin();
min = pEntity->collisionProperty()->GetMins() + vOrigin;
max = pEntity->collisionProperty()->GetMaxs() + vOrigin;
// Points of a 3d bounding box
Vector points[] = { Vector(min.x, min.y, min.z),
Vector(min.x, max.y, min.z),
Vector(max.x, max.y, min.z),
Vector(max.x, min.y, min.z),
Vector(max.x, max.y, max.z),
Vector(min.x, max.y, max.z),
Vector(min.x, min.y, max.z),
Vector(max.x, min.y, max.z) };
// Get screen positions
if (!Render::WorldToScreen(points[3], flb) || !Render::WorldToScreen(points[5], brt)
|| !Render::WorldToScreen(points[0], blb) || !Render::WorldToScreen(points[4], frt)
|| !Render::WorldToScreen(points[2], frb) || !Render::WorldToScreen(points[1], brb)
|| !Render::WorldToScreen(points[6], blt) || !Render::WorldToScreen(points[7], flt))
return false;
// Put them in an array (maybe start them off in one later for speed?)
Vector arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
// Init this shit
left = flb.x;
top = flb.y;
right = flb.x;
bottom = flb.y;
// Find the bounding corners for our box
for (int i = 1; i < 8; i++)
{
if (left > arr[i].x)
left = arr[i].x;
if (bottom < arr[i].y)
bottom = arr[i].y;
if (right < arr[i].x)
right = arr[i].x;
if (top > arr[i].y)
top = arr[i].y;
}
// Width / height
result.x = left;
result.y = top;
result.w = right - left;
result.h = bottom - top;
return true;
}
// Get an entities color depending on team and vis ect
Color CEsp::GetPlayerColor(IClientEntity* pEntity)
{
int TeamNum = pEntity->GetTeamNum();
bool IsVis = GameUtils::IsVisible(hackManager.pLocal(), pEntity, (int)CSGOHitboxID::Head);
Color color;
if (TeamNum == TEAM_CS_T)
{
if (IsVis)
color = Color(235, 200, 0, 255);
else
color = Color(235, 50, 0, 255);
}
else
{
if (IsVis)
color = Color(120, 210, 26, 255);
else
color = Color(15, 110, 220, 255);
}
return color;
}
// 2D Esp box
void CEsp::DrawBox(CEsp::ESPBox size, Color color)
{
//if (PlayerBoxes->GetStringIndex() == 1)
//{
// Full Box
//Render::Clear(size.x, size.y, size.w, size.h, color);
//Render::Clear(size.x - 1, size.y - 1, size.w + 2, size.h + 2, Color(10, 10, 10, 150));
//Render::Clear(size.x + 1, size.y + 1, size.w - 2, size.h - 2, Color(10, 10, 10, 150));
//}
//else
{
// Corner Box
int VertLine = (((float)size.w) * (0.20f));
int HorzLine = (((float)size.h) * (0.20f));
Render::Clear(size.x, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - VertLine, size.y - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - VertLine, size.y + size.h - 1, VertLine, 1, Color(10, 10, 10, 150));
Render::Clear(size.x - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - 1, size.y, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x + size.w - 1, size.y + size.h - HorzLine, 1, HorzLine, Color(10, 10, 10, 150));
Render::Clear(size.x, size.y, VertLine, 1, color);
Render::Clear(size.x + size.w - VertLine, size.y, VertLine, 1, color);
Render::Clear(size.x, size.y + size.h, VertLine, 1, color);
Render::Clear(size.x + size.w - VertLine, size.y + size.h, VertLine, 1, color);
Render::Clear(size.x, size.y, 1, HorzLine, color);
Render::Clear(size.x, size.y + size.h - HorzLine, 1, HorzLine, color);
Render::Clear(size.x + size.w, size.y, 1, HorzLine, color);
Render::Clear(size.x + size.w, size.y + size.h - HorzLine, 1, HorzLine, color);
}
}
// Unicode Conversions
static wchar_t* CharToWideChar(const char* text)
{
size_t size = strlen(text) + 1;
wchar_t* wa = new wchar_t[size];
mbstowcs_s(NULL, wa, size/4, text, size);
return wa;
}
// Player name
void CEsp::DrawName(player_info_t pinfo, CEsp::ESPBox size)
{
RECT nameSize = Render::GetTextSize(Render::Fonts::ESP, pinfo.name);
Render::Text(size.x + (size.w / 2) - (nameSize.right / 2), size.y - 16,
Color(255, 255, 255, 255), Render::Fonts::ESP, pinfo.name);
}
// Draw a health bar. For Tf2 when a bar is bigger than max health a second bar is displayed
void CEsp::DrawHealth(IClientEntity* pEntity, CEsp::ESPBox size)
{
ESPBox HealthBar = size;
HealthBar.y += (HealthBar.h + 6);
HealthBar.h = 4;
float HealthValue = pEntity->GetHealth();
float HealthPerc = HealthValue / 100.f;
float Width = (size.w * HealthPerc);
HealthBar.w = Width;
// -- Main Bar -- //
Vertex_t Verts[4];
Verts[0].Init(Vector2D(HealthBar.x, HealthBar.y));
Verts[1].Init(Vector2D(HealthBar.x + size.w + 5, HealthBar.y));
Verts[2].Init(Vector2D(HealthBar.x + size.w, HealthBar.y + 5));
Verts[3].Init(Vector2D(HealthBar.x - 5, HealthBar.y + 5));
Render::PolygonOutline(4, Verts, Color(10, 10, 10, 255), Color(255, 255, 255, 170));
Vertex_t Verts2[4];
Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 4, HealthBar.y + 1));
Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 5));
Verts2[3].Init(Vector2D(HealthBar.x - 4, HealthBar.y + 5));
Color c = GetPlayerColor(pEntity);
Render::Polygon(4, Verts2, c);
Verts2[0].Init(Vector2D(HealthBar.x + 1, HealthBar.y + 1));
Verts2[1].Init(Vector2D(HealthBar.x + HealthBar.w + 2, HealthBar.y + 1));
Verts2[2].Init(Vector2D(HealthBar.x + HealthBar.w, HealthBar.y + 2));
Verts2[3].Init(Vector2D(HealthBar.x - 2, HealthBar.y + 2));
Render::Polygon(4, Verts2, Color(255, 255, 255, 40));
}
// Cleans the internal class name up to something human readable and nice
std::string CleanItemName(std::string name)
{
std::string Name = name;
// Tidy up the weapon Name
if (Name[0] == 'C')
Name.erase(Name.begin());
// Remove the word Weapon
auto startOfWeap = Name.find("Weapon");
if (startOfWeap != std::string::npos)
Name.erase(Name.begin() + startOfWeap, Name.begin() + startOfWeap + 6);
return Name;
}
// Anything else: weapons, class state? idk
void CEsp::DrawInfo(IClientEntity* pEntity, CEsp::ESPBox size)
{
std::vector<std::string> Info;
// Player Weapon ESP
IClientEntity* pWeapon = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)pEntity->GetActiveWeaponHandle());
if (Menu::Window.VisualsTab.OptionsWeapon.GetState() && pWeapon)
{
ClientClass* cClass = (ClientClass*)pWeapon->GetClientClass();
if (cClass)
{
// Draw it
Info.push_back(CleanItemName(cClass->m_pNetworkName));
}
}
// Bomb Carrier
if (Menu::Window.VisualsTab.OptionsInfo.GetState() && pEntity == BombCarrier)
{
Info.push_back("Bomb Carrier");
}
static RECT Size = Render::GetTextSize(Render::Fonts::Default, "Hi");
int i = 0;
for (auto Text : Info)
{
Render::Text(size.x + size.w + 3, size.y + (i*(Size.bottom + 2)), Color(255, 255, 255, 255), Render::Fonts::ESP, Text.c_str());
i++;
}
}
// Little cross on their heads
void CEsp::DrawCross(IClientEntity* pEntity)
{
Vector cross = pEntity->GetHeadPos(), screen;
static int Scale = 2;
if (Render::WorldToScreen(cross, screen))
{
Render::Clear(screen.x - Scale, screen.y - (Scale * 2), (Scale * 2), (Scale * 4), Color(20, 20, 20, 160));
Render::Clear(screen.x - (Scale * 2), screen.y - Scale, (Scale * 4), (Scale * 2), Color(20, 20, 20, 160));
Render::Clear(screen.x - Scale - 1, screen.y - (Scale * 2) - 1, (Scale * 2) - 2, (Scale * 4) - 2, Color(250, 250, 250, 160));
Render::Clear(screen.x - (Scale * 2) - 1, screen.y - Scale - 1, (Scale * 4) - 2, (Scale * 2) - 2, Color(250, 250, 250, 160));
}
}
// Draws a dropped CS:GO Item
void CEsp::DrawDrop(IClientEntity* pEntity, ClientClass* cClass)
{
Vector Box;
CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)pEntity;
IClientEntity* plr = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)Weapon->GetOwnerHandle());
if (!plr && Render::WorldToScreen(Weapon->GetOrigin(), Box))
{
if (Menu::Window.VisualsTab.OptionsBox.GetState())
{
Render::Outline(Box.x - 2, Box.y - 2, 4, 4, Color(255, 255, 255, 255));
Render::Outline(Box.x - 3, Box.y - 3, 6, 6, Color(10, 10, 10, 150));
}
if (Menu::Window.VisualsTab.OptionsInfo.GetState())
{
std::string ItemName = CleanItemName(cClass->m_pNetworkName);
RECT TextSize = Render::GetTextSize(Render::Fonts::ESP, ItemName.c_str());
Render::Text(Box.x - (TextSize.right / 2), Box.y - 16, Color(255, 255, 255, 255), Render::Fonts::ESP, ItemName.c_str());
}
}
}
// Draws a chicken
void CEsp::DrawChicken(IClientEntity* pEntity, ClientClass* cClass)
{
ESPBox Box;
if (GetBox(pEntity, Box))
{
player_info_t pinfo; strcpy_s(pinfo.name, "Chicken");
if (Menu::Window.VisualsTab.OptionsBox.GetState())
DrawBox(Box, Color(255,255,255,255));
if (Menu::Window.VisualsTab.OptionsName.GetState())
DrawName(pinfo, Box);
}
}
// Draw the planted bomb and timer
void CEsp::DrawBombPlanted(IClientEntity* pEntity, ClientClass* cClass)
{
// Null it out incase bomb has been dropped or planted
BombCarrier = nullptr;
Vector vOrig; Vector vScreen;
vOrig = pEntity->GetOrigin();
CCSBomb* Bomb = (CCSBomb*)pEntity;
if (Render::WorldToScreen(vOrig, vScreen))
{
float flBlow = Bomb->GetC4BlowTime();
float TimeRemaining = flBlow - (Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase());
char buffer[64];
sprintf_s(buffer, "Bomb: %.1f", TimeRemaining);
Render::Text(vScreen.x, vScreen.y, Color(250, 42, 42, 255), Render::Fonts::ESP, buffer);
}
}
// Draw the bomb if it's dropped, or store the player who's carrying
void CEsp::DrawBomb(IClientEntity* pEntity, ClientClass* cClass)
{
// Null it out incase bomb has been dropped or planted
BombCarrier = nullptr;
CBaseCombatWeapon *BombWeapon = (CBaseCombatWeapon *)pEntity;
Vector vOrig; Vector vScreen;
vOrig = pEntity->GetOrigin();
bool adopted = true;
HANDLE parent = BombWeapon->GetOwnerHandle();
if (parent || (vOrig.x == 0 && vOrig.y == 0 && vOrig.z == 0))
{
IClientEntity* pParentEnt = (Interfaces::EntList->GetClientEntityFromHandle(parent));
if (pParentEnt && pParentEnt->IsAlive())
{
BombCarrier = pParentEnt;
adopted = false;
}
}
if (adopted)
{
if (Render::WorldToScreen(vOrig, vScreen))
{
Render::Text(vScreen.x, vScreen.y, Color(112, 230, 20, 255), Render::Fonts::ESP, "Bomb");
}
}
}
void DrawBoneArray(int* boneNumbers, int amount, IClientEntity* pEntity, Color color)
{
Vector LastBoneScreen;
for (int i = 0; i < amount; i++)
{
Vector Bone = pEntity->GetBonePos(boneNumbers[i]);
Vector BoneScreen;
if (Render::WorldToScreen(Bone, BoneScreen))
{
if (i>0)
{
Render::Line(LastBoneScreen.x, LastBoneScreen.y, BoneScreen.x, BoneScreen.y, color);
}
}
LastBoneScreen = BoneScreen;
}
}
void DrawBoneTest(IClientEntity *pEntity)
{
for (int i = 0; i < 127; i++)
{
Vector BoneLoc = pEntity->GetBonePos(i);
Vector BoneScreen;
if (Render::WorldToScreen(BoneLoc, BoneScreen))
{
char buf[10];
_itoa_s(i, buf, 10);
Render::Text(BoneScreen.x, BoneScreen.y, Color(255, 255, 255, 180), Render::Fonts::ESP, buf);
}
}
}
void CEsp::DrawSkeleton(IClientEntity* pEntity)
{
studiohdr_t* pStudioHdr = Interfaces::ModelInfo->GetStudiomodel(pEntity->GetModel());
if (!pStudioHdr)
return;
Vector vParent, vChild, sParent, sChild;
for (int j = 0; j < pStudioHdr->numbones; j++)
{
mstudiobone_t* pBone = pStudioHdr->GetBone(j);
if (pBone && (pBone->flags & BONE_USED_BY_HITBOX) && (pBone->parent != -1))
{
vChild = pEntity->GetBonePos(j);
vParent = pEntity->GetBonePos(pBone->parent);
if (Render::WorldToScreen(vParent, sParent) && Render::WorldToScreen(vChild, sChild))
{
Render::Line(sParent[0], sParent[1], sChild[0], sChild[1], Color(255,255,255,255));
}
}
}
}