-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMenu.cpp
342 lines (284 loc) · 11 KB
/
Menu.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
#include "Menu.hpp"
float vMatrix[16];
namespace CODWAW_SP {
void Draw3DBox(Vector3 Pos, float* Matrix, int Width, int Height, ImColor color, int Thickness);
namespace STYLES {
void InitStyle()
{
ImGuiStyle& style = ImGui::GetStyle();
ImVec4* colors = ImGui::GetStyle().Colors;
// STYLE PROPERTIES
style.WindowTitleAlign = ImVec2(0.5f, 0.5f);
ImGui::StyleColorsClassic();
// Custom Style Color Example
//colors[ImGuiCol_Text] = ImVec4(0.75f, 0.75f, 0.29f, 1.00f);
// COLORS
if (g_Menu->dbg_RAINBOW_THEME) {
colors[ImGuiCol_Separator] = ImVec4(g_Menu->dbg_RAINBOW);
colors[ImGuiCol_TitleBg] = ImVec4(0, 0, 0, 1.0f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0, 0, 0, 1.0f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0, 0, 0, 1.0f);
}
else {
// Revert to original style colors
}
}
}
namespace TABS {
void MAIN()
{
ImGui::Text("PLAYER");
ImGui::Spacing();
if (ImGui::Checkbox("INFINITE HEALTH", &g_GameData->bINFINITEHEALTH))
*(bool*)g_Hooks->ResolveOffset(g_GameData->offsets.GOD) = g_GameData->bINFINITEHEALTH;
ImGui::SliderFloat("FOV", &*(float*)g_Hooks->ResolveOffset(g_GameData->offsets.FOV), 65, 120, "%.0f");
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
ImGui::Text("WEAPON");
ImGui::Spacing();
if (ImGui::Checkbox("INFINITE AMMO", &g_GameData->bINFINITEAMMO)) {
switch (g_GameData->bINFINITEAMMO) {
case (TRUE):
g_Hooks->Nop((BYTE*)g_Hooks->ResolveOffset(g_GameData->offsets.AMMO), 7);
break;
case (FALSE):
g_Hooks->Patch((BYTE*)g_Hooks->ResolveOffset(g_GameData->offsets.AMMO), (BYTE*)"\x89\x94\x8F\xFC\x05\x00\x00", 7);
break;
}
}
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
ImGui::Text("ENVIRONMENT");
ImGui::Spacing();
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
ImGui::Text("VISUALS");
ImGui::Spacing();
ImGui::Checkbox("ESP", &g_GameData->bESP);
if (g_GameData->bESP) {
ImGui::SameLine();
ImGui::SetNextItemWidth(100);
ImGui::Combo("POSITION", &g_Menu->m_dbg_drawpos, "Heaven\0Hell\0Corner\0Center\0");
}
ImGui::Checkbox("CROSSHAIR", &g_Menu->m_dbgCrosshair);
if (g_Menu->m_dbgCrosshair)
{
// SIZE
ImGui::Text("CROSSHAIR SIZE: ");
ImGui::SameLine();
ImGui::SetNextItemWidth(75);
ImGui::SliderFloat("##SIZE ", &g_Menu->dbg_crosshair_radius, 1, 100, "%.2f");
ImGui::Spacing();
ImGui::Text("CROSSHAIR SEGMENTS: ");
ImGui::SameLine();
ImGui::SetNextItemWidth(75);
ImGui::SliderInt("##SIZE2 ", &g_Menu->dbg_crosshair_segments, 0, 12, "%.2f");
ImGui::Spacing();
ImGui::Text("CROSSHAIR THICKNESS: ");
ImGui::SameLine();
ImGui::SetNextItemWidth(75);
ImGui::SliderFloat("##SIZE3 ", &g_Menu->dbg_crosshair_thickness, 0, 10, "%.2f");
ImGui::Separator();
}
}
void ABOUT()
{
ImGui::Text("[DX9] ImGui INTERNAL MENU (PREVIEW)");
ImGui::Text("BUILD VERSION: v1.0");
ImGui::Text("BUILD DATE: 5/30/2022");
ImGui::Checkbox("RGB MODE", &g_Menu->dbg_RAINBOW_THEME);
ImGui::Checkbox("SHOW IMGUI DEMO", &g_GameVariables->m_ShowDemo);
if (ImGui::Checkbox("SHOW DEBUG CONSOLE", &g_GameVariables->m_ShowConsole)) {
switch (g_GameVariables->m_ShowConsole) {
case(TRUE):
ShowWindow(g_Console->g_hWnd, SW_SHOW);
break;
case(FALSE):
ShowWindow(g_Console->g_hWnd, SW_HIDE);
break;
}
}
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
if (ImGui::Button("UNHOOK DLL", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) g_Killswitch = TRUE;
}
}
void Menu::Draw()
{
if (g_GameVariables->m_ShowMenu)
MainMenu();
if (g_GameVariables->m_ShowHud)
HUD(&g_GameVariables->m_ShowHud);
if (g_GameVariables->m_ShowDemo)
ImGui::ShowDemoWindow();
if (g_GameData->bESP)
ESP(m_dbg_drawpos);
if (m_dbgCrosshair)
ImGui::GetBackgroundDrawList()->AddCircle(ImGui::GetMainViewport()->GetCenter(), g_Menu->dbg_crosshair_radius, ImColor(255, 0, 0, 255), g_Menu->dbg_crosshair_segments, g_Menu->dbg_crosshair_thickness);
}
void Menu::MainMenu()
{
STYLES::InitStyle();
if (dbg_RAINBOW_THEME) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(g_Menu->dbg_RAINBOW));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(g_Menu->dbg_RAINBOW));
ImGui::PushStyleColor(ImGuiCol_BorderShadow, ImVec4(g_Menu->dbg_RAINBOW));
}
if (!ImGui::Begin("CoD::WaW Zombies", &g_GameVariables->m_ShowMenu, 96))
{
ImGui::End();
return;
}
if (dbg_RAINBOW_THEME) {
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
}
if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None))
{
if (ImGui::BeginTabItem("MAIN"))
{
TABS::MAIN();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("ABOUT"))
{
TABS::ABOUT();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::End();
}
void Menu::HUD(bool* p_open)
{
// Here you can draw a secondary window to show the user what menu items they have active
// This makes it easier on the user , include a method to show and hide the HUD
}
void Menu::Loops()
{
/// Code inside this function body will execute every 1ms
// Best used for constant writes and for anything that you need written while the menu is not shown
// NO DRAWING INSIDE THE LOOP
if (g_GameData->bINFINITEHEALTH) {
}
if (g_GameData->bINFINITEAMMO) {
}
}
void Menu::ESP(byte Pos)
{
/// <summary>
/// Establish Colors
ImColor cLines{};
ImColor cText = { 255, 255, 255, 255 };
if (dbg_RAINBOW_THEME)
cLines = dbg_RAINBOW;
else
cLines = { 255, 0, 255, 200 };
//
int dist = 0x88;
// Window Dimensions & Position
float X = *(float*)g_Hooks->ResolveOffset(g_GameData->offsets.ScreenX);
float Y = *(float*)g_Hooks->ResolveOffset(g_GameData->offsets.ScreenY);
Vector2 pos = { ImGui::GetMainViewport()->GetCenter().x, ImGui::GetMainViewport()->GetCenter().y };
/// <summary>
/// Establish Position to draw from
ImVec2 drawPosition{};
switch (Pos) {
// Heaven
case(0):
drawPosition = { pos.x, 0 };
break;
// Hell
case(1):
drawPosition = { pos.x, Y };
break;
// Corner
case(2):
drawPosition = { 0, 0 };
break;
// Center
case(3):
drawPosition = { pos.x, pos.y };
break;
}
uintptr_t ViewMatrix = g_Hooks->ResolveOffset(g_GameData->offsets.ViewMatrix);
memcpy(&vMatrix, (BYTE*)ViewMatrix, sizeof(vMatrix));
for (int i = 0; i < 40; i++) {
if (i == NULL) continue;
// Get Entity
g_GameData->EntObject = (EntityObject*)*(uintptr_t*)g_Hooks->ResolveOffset(g_GameData->offsets.EntArrayPTR + i * dist);
if (g_GameData->EntObject == NULL)
continue;
// Get Health
if (g_GameData->EntObject->Health <= NULL)
continue;
// Get Validity
if (g_GameData->EntObject->Valid != 16)
continue;
std::string HP = std::to_string(g_GameData->EntObject->Health);
Vector2 screen;
if (!g_D3D9Window->WorldToScreen(g_GameData->EntObject->FeetPos, screen, vMatrix, X, Y))
continue;
Vector2 head;
if (!g_D3D9Window->WorldToScreen(g_GameData->EntObject->HeadPos, head, vMatrix, X, Y))
continue;
// These 3 lines define our head height
float vhead = head.y - screen.y;
float width = vhead / 2;
float center = width / -2;
ImGui::GetBackgroundDrawList()->AddLine(drawPosition, ImVec2(screen.x, screen.y), cLines, 1);
ImGui::GetBackgroundDrawList()->AddText(ImVec2(screen.x, screen.y), cText, HP.c_str());
Draw3DBox(g_GameData->EntObject->FeetPos, vMatrix, X, Y, cLines, 1);
//ImGui::GetBackgroundDrawList()->AddRect(ImVec2(screen.x + center, screen.y), ImVec2(screen.x - center, head.y), cLines);
}
}
void Draw3DBox(Vector3 Pos, float* Matrix, int Width, int Height, ImColor color, int Thickness)
{
// BOX TOP DIMENSIONS
Vector3 top_front_left = Vector3{ Pos.x + 10, Pos.y - 10, Pos.z + 55 };
ImVec2 top_front_left_2D;
Vector3 top_front_right = Vector3{ Pos.x + 10, Pos.y + 10, Pos.z + 55 };
ImVec2 top_front_right_2D;
Vector3 top_bottom_left = Vector3{ Pos.x - 10, Pos.y + 10, Pos.z + 55 };
ImVec2 top_bottom_left_2D;
Vector3 top_bottom_right = Vector3{ Pos.x - 10, Pos.y - 10, Pos.z + 55 };
ImVec2 top_bottom_right_2D;
// Get World To Screen Position for Top Half of Box
g_D3D9Window->WorldToScreen(top_front_left, (Vector2&)top_front_left_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(top_front_right, (Vector2&)top_front_right_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(top_bottom_left, (Vector2&)top_bottom_left_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(top_bottom_right, (Vector2&)top_bottom_right_2D, Matrix, Width, Height);
// BOX BOTTOM DIMENSIONS
Vector3 bottom_front_left = Vector3{ Pos.x + 10, Pos.y - 10, Pos.z };
ImVec2 bottom_front_left_2D;
Vector3 bottom_front_right = Vector3{ Pos.x + 10, Pos.y + 10, Pos.z };
ImVec2 bottom_front_right_2D;
Vector3 bottom_rear_left = Vector3{ Pos.x - 10, Pos.y + 10, Pos.z };
ImVec2 bottom_rear_left_2D;
Vector3 bottom_rear_right = Vector3{ Pos.x - 10, Pos.y - 10, Pos.z };
ImVec2 bottom_rear_right_2D;
// Get World To Screen Position for Lower Half of Box
g_D3D9Window->WorldToScreen(bottom_front_left, (Vector2&)bottom_front_left_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(bottom_front_right, (Vector2&)bottom_front_right_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(bottom_rear_left, (Vector2&)bottom_rear_left_2D, Matrix, Width, Height);
g_D3D9Window->WorldToScreen(bottom_rear_right, (Vector2&)bottom_rear_right_2D, Matrix, Width, Height);
// DRAW 3D BOXES
ImGui::GetBackgroundDrawList()->AddLine(top_bottom_left_2D, top_front_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(top_front_left_2D, top_front_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(top_front_left_2D, top_bottom_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(top_bottom_left_2D, top_bottom_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_rear_left_2D, bottom_front_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_front_right_2D, bottom_front_left_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_front_left_2D, bottom_rear_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_rear_right_2D, bottom_rear_left_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_rear_right_2D, top_bottom_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_rear_left_2D, top_bottom_left_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_front_right_2D, top_front_right_2D, color, Thickness);
ImGui::GetBackgroundDrawList()->AddLine(bottom_front_left_2D, top_front_left_2D, color, Thickness);
}
}