forked from KaylinOwO/projectnacl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanels.cpp
More file actions
143 lines (126 loc) · 3.8 KB
/
Panels.cpp
File metadata and controls
143 lines (126 loc) · 3.8 KB
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
#include "SDK.h"
#include "Panels.h"
#include "CDrawManager.h"
#include "Util.h"
#include "ESP.h"
#include "Menu.h"
#include "CDraw.h"
#include "Styles.h"
#include "Misc.h"
#include "CMat.h"
CScreenSize gScreenSize;
//===================================================================================
void __fastcall Hooked_PaintTraverse( PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
{
try
{
CBaseEntity* pLocal = gInts.EntList->GetClientEntity(me);
auto crosshair = gInts.cvar->FindVar("crosshair");
if (!strcmp("HudScope", gInts.Panels->GetName(vguiPanel)) && gESP.noscope.value)
{
if (pLocal->GetCond() & tf_cond::TFCond_Zoomed)
{
crosshair->SetValue(0);
}
else
{
crosshair->SetValue(1);
}
return;
}
VMTManager& hook = VMTManager::GetHook(pPanels);
hook.GetMethod<void(__thiscall*)(PVOID, unsigned int, bool, bool)>(gOffsets.iPaintTraverseOffset)(pPanels, vguiPanel, forceRepaint, allowForce); //Call the original.
static unsigned int vguiFocusOverlayPanel;
WindowStyle* style = new DefaultStyle();
if (vguiFocusOverlayPanel == NULL)
{ //FocusOverlayPanel
const char* szName = gInts.Panels->GetName(vguiPanel);
if( szName[0] == 'F' && szName[5] == 'O' && szName[12] == 'P' )
{
vguiFocusOverlayPanel = vguiPanel;
Intro();
}
}
if (vguiFocusOverlayPanel == vguiPanel )
{
if (gMisc.cscreenshots.value && gInts.Engine->IsTakingScreenshot() || gMisc.cscreenshots.value && GetAsyncKeyState(VK_F12) || gMisc.cscreenshots.value && GetAsyncKeyState(VK_SNAPSHOT))
return;
if (!gInts.Engine->IsInGame() && !gMenu.enabled)
style->WaterMark("Project NaCl", 20, 20);
gInts.Panels->SetTopmostPopup(vguiFocusOverlayPanel, true);
CScreenSize newSize;
gInts.Engine->GetScreenSize(newSize.iScreenWidth, newSize.iScreenWidth);
if (newSize.iScreenWidth != gScreenSize.iScreenWidth || newSize.iScreenHeight != gScreenSize.iScreenHeight)
{
gDraw.Reload();
gDrawManager.Reload();
}
if (GAME_TF2)
{
if (gMisc.purebypass.value || gESP.player_enabled.value)
{
bool check = false;
if (!gInts.Engine->IsInGame() && check == false)
{
void** pure_addr = nullptr;
if (!pure_addr)
{
pure_addr = *reinterpret_cast<void***>(gSignatures.GetEngineSignature("A1 ? ? ? ? 56 33 F6 85 C0") + 1);
} *
pure_addr = (void*)0;
check = true;
}
}
}
int iWidth, iHeight; //Resolution fix, so this can work in Fullscreen
gInts.Engine->GetScreenSize(iWidth, iHeight);
if (gScreenSize.iScreenWidth != iWidth || gScreenSize.iScreenHeight != iHeight)
gInts.Engine->GetScreenSize(gScreenSize.iScreenWidth, gScreenSize.iScreenHeight);
if (pLocal)
gESP.Run(pLocal);
gMenu.GetInput();
gMenu.Draw();
gInts.Panels->SetMouseInputEnabled(vguiPanel, gMenu.enabled);
gMenu.EndInput();
if (pLocal && GAME_TF2)
{
if (gInts.Engine->IsInGame() && gInts.Engine->IsConnected())
{
if (!gESP.noscope.value)
return;
if (pLocal->GetLifeState() == LIFE_ALIVE && pLocal->GetCond() & tf_cond::TFCond_Zoomed)
{
int width, height;
gInts.Engine->GetScreenSize(width, height);
gDrawManager.DrawLine(width / 2, 0, width / 2, height, Color(0, 0, 0, 255));
gDrawManager.DrawLine(0, height / 2, width, height / 2, Color(0, 0, 0, 255));
}
}
}
}
}
catch(...)
{
Log::Fatal("Failed PaintTraverse");
}
}
//===================================================================================
void Intro( void )
{
try
{
gDrawManager.Initialize(); //Initalize the drawing class.
gDraw.Init();
if (GAME_TF2)
gMat.Initialize();
else
gMat.InititalizeOther();
InitTextures();
gNetVars.Initialize();
gMenu.CreateGUI();
}
catch(...)
{
Log::Fatal("Failed Intro");
}
}