summaryrefslogtreecommitdiffstats
path: root/src/menu.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 13:53:45 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 13:53:45 +0100
commit12fde50efc7e1f1d123f9fc34ffef53d4387de2d (patch)
tree4de53807ce23df9b63598a0e3a12620ff19eb7cc /src/menu.cpp
parentNo spread: detect pellet draws from the FireBullets seed call (diff)
downloadhl2h-12fde50efc7e1f1d123f9fc34ffef53d4387de2d.tar.gz
hl2h-12fde50efc7e1f1d123f9fc34ffef53d4387de2d.zip
Add ESP, aim, view and movement batch
- ESP: alert state (IDLE/ALERT/COMBAT/SCRIPT), enemy weapon labels, hostile/ neutral/friendly colour pickers, off-screen direction arrows, and trigger_changelevel volumes with next/previous map labels. - Aim: silent aim reuses the Aimbot FOV, vischeck and bone settings; add optional aim-punch compensation for aimbot, silent aim, triggerbot and melee (server bullets add m_vecPunchAngle to the usercmd angles). - View: always-on Camera / display card with camera FOV (writes the client m_iDefaultFOV netvar), viewmodel FOV and monitor gamma (client cvars). - Movement: Jump assist card with auto crouch-jump and edge jump (point ground probe 0.12 s ahead). - Spread: Engine spread override toggle gates the direct RandomFloat zeroing; off leaves only the seed search. - Server: entity count/base/classname helpers, trigger_changelevel map name and world bounds via IServerUnknown/ICollideable. - Netvars: m_vecPunchAngle and m_iDefaultFOV.
Diffstat (limited to 'src/menu.cpp')
-rw-r--r--src/menu.cpp147
1 files changed, 121 insertions, 26 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index 00aa189..4e521f7 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -75,11 +75,20 @@ int g_aim_smooth = 5; // degrees per tick
75bool g_aim_vischeck = true; 75bool g_aim_vischeck = true;
76int g_aim_fov = 60; // angular distance from the crosshair 76int g_aim_fov = 60; // angular distance from the crosshair
77bool g_aim_fov_circle = true; 77bool g_aim_fov_circle = true;
78int g_silent_fov = 60; 78bool g_aim_punch = true; // compensate server aim punch
79bool g_spread_engine = true; // zero the pellet random draws, not just the seed
80bool g_auto_crouchjump = false;
81bool g_edge_jump = false;
82int g_fov_camera = 0; // 0 = game default
83int g_fov_viewmodel = 0; // 0 = game default (54)
84int g_gamma = 22; // mat_monitorgamma x10, stock 2.2
85int g_esp_col_hostile[3] = {255, 60, 60};
86int g_esp_col_neutral[3] = {220, 220, 220};
87int g_esp_col_friendly[3] = {60, 255, 60};
79 88
80// ESP sub-options. Defaults match the pre-option behaviour: everything on. 89// ESP sub-options. Defaults match the pre-option behaviour: everything on.
81bool g_esp_opt[ESP_OPT_COUNT] = {true, true, true, true, true, true, true, 90bool g_esp_opt[ESP_OPT_COUNT] = {true, true, true, true, true, true,
82 true}; 91 true, true, true, true, true};
83 92
84// --------------------------------------------------------------------------- 93// ---------------------------------------------------------------------------
85// config persistence (INI format) 94// config persistence (INI format)
@@ -185,21 +194,23 @@ void config_save() {
185 fprintf(f, "[jumpbug]\nactive=%d\nbind=%d\nassist=%d\n", 194 fprintf(f, "[jumpbug]\nactive=%d\nbind=%d\nassist=%d\n",
186 g_jumpbug.active, g_jumpbug.bind, (int)g_jumpbug_assist); 195 g_jumpbug.active, g_jumpbug.bind, (int)g_jumpbug_assist);
187 fprintf(f, "[melee]\nactive=%d\nbind=%d\n", g_melee.active, g_melee.bind); 196 fprintf(f, "[melee]\nactive=%d\nbind=%d\n", g_melee.active, g_melee.bind);
188 fprintf(f, "[spread]\nactive=%d\nbind=%d\nno_spread=%d\n", 197 fprintf(f, "[spread]\nactive=%d\nbind=%d\nno_spread=%d\nengine=%d\n",
189 g_spread.active, g_spread.bind, (int)g_spread_no_spread); 198 g_spread.active, g_spread.bind, (int)g_spread_no_spread,
199 (int)g_spread_engine);
190 fprintf(f, "[aimbot]\nactive=%d\nbind=%d\nsmooth=%d\nvischeck=%d\n" 200 fprintf(f, "[aimbot]\nactive=%d\nbind=%d\nsmooth=%d\nvischeck=%d\n"
191 "fov=%d\nfov_circle=%d\n" 201 "fov=%d\nfov_circle=%d\npunch=%d\n"
192 "bone_head=%d\nbone_torso=%d\nbone_larm=%d\nbone_rarm=%d\n" 202 "bone_head=%d\nbone_torso=%d\nbone_larm=%d\nbone_rarm=%d\n"
193 "bone_lleg=%d\nbone_rleg=%d\n", 203 "bone_lleg=%d\nbone_rleg=%d\n",
194 g_aimbot.active, g_aimbot.bind, g_aim_smooth, 204 g_aimbot.active, g_aimbot.bind, g_aim_smooth,
195 (int)g_aim_vischeck, g_aim_fov, (int)g_aim_fov_circle, 205 (int)g_aim_vischeck, g_aim_fov, (int)g_aim_fov_circle,
196 g_aim_bones[AIM_BONE_HEAD], g_aim_bones[AIM_BONE_TORSO], 206 (int)g_aim_punch, g_aim_bones[AIM_BONE_HEAD],
197 g_aim_bones[AIM_BONE_LARM], g_aim_bones[AIM_BONE_RARM], 207 g_aim_bones[AIM_BONE_TORSO], g_aim_bones[AIM_BONE_LARM],
198 g_aim_bones[AIM_BONE_LLEG], g_aim_bones[AIM_BONE_RLEG]); 208 g_aim_bones[AIM_BONE_RARM], g_aim_bones[AIM_BONE_LLEG],
209 g_aim_bones[AIM_BONE_RLEG]);
199 fprintf(f, "[triggerbot]\nactive=%d\nbind=%d\n", g_triggerbot.active, 210 fprintf(f, "[triggerbot]\nactive=%d\nbind=%d\n", g_triggerbot.active,
200 g_triggerbot.bind); 211 g_triggerbot.bind);
201 fprintf(f, "[silentaim]\nactive=%d\nbind=%d\nfov=%d\n", g_silentaim.active, 212 fprintf(f, "[silentaim]\nactive=%d\nbind=%d\n", g_silentaim.active,
202 g_silentaim.bind, g_silent_fov); 213 g_silentaim.bind);
203 fprintf(f, "[fullbright]\nactive=%d\nbind=%d\n", g_fullbright.active, 214 fprintf(f, "[fullbright]\nactive=%d\nbind=%d\n", g_fullbright.active,
204 g_fullbright.bind); 215 g_fullbright.bind);
205 fprintf(f, "[worldtint]\nactive=%d\nbind=%d\nworld=%d\nsky=%d\n" 216 fprintf(f, "[worldtint]\nactive=%d\nbind=%d\nworld=%d\nsky=%d\n"
@@ -223,13 +234,24 @@ void config_save() {
223 (int)g_item_crates, (int)g_item_distance, g_item_max_dist); 234 (int)g_item_crates, (int)g_item_distance, g_item_max_dist);
224 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" 235 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n"
225 "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n" 236 "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n"
226 "dmg=%d\n", 237 "dmg=%d\nalert=%d\nweapon=%d\narrows=%d\n"
238 "hr=%d\nhg=%d\nhb=%d\nnr=%d\nng=%d\nnb=%d\n"
239 "fr=%d\nfg=%d\nfb=%d\n",
227 g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], 240 g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL],
228 g_esp_opt[ESP_OPT_SHOW_HEALTHBAR], 241 g_esp_opt[ESP_OPT_SHOW_HEALTHBAR],
229 g_esp_opt[ESP_OPT_SHOW_HEALTHNUM], g_esp_opt[ESP_OPT_SHOW_NAME], 242 g_esp_opt[ESP_OPT_SHOW_HEALTHNUM], g_esp_opt[ESP_OPT_SHOW_NAME],
230 g_esp_opt[ESP_OPT_SHOW_SKELETON], g_esp_opt[ESP_OPT_SHOW_BOX], 243 g_esp_opt[ESP_OPT_SHOW_SKELETON], g_esp_opt[ESP_OPT_SHOW_BOX],
231 g_esp_opt[ESP_OPT_SHOW_SPEEDGRAPH], 244 g_esp_opt[ESP_OPT_SHOW_SPEEDGRAPH],
232 g_esp_opt[ESP_OPT_DAMAGE_TAGS]); 245 g_esp_opt[ESP_OPT_DAMAGE_TAGS], g_esp_opt[ESP_OPT_ALERT],
246 g_esp_opt[ESP_OPT_WEAPON], g_esp_opt[ESP_OPT_ARROWS],
247 g_esp_col_hostile[0], g_esp_col_hostile[1], g_esp_col_hostile[2],
248 g_esp_col_neutral[0], g_esp_col_neutral[1], g_esp_col_neutral[2],
249 g_esp_col_friendly[0], g_esp_col_friendly[1],
250 g_esp_col_friendly[2]);
251 fprintf(f, "[view]\nfov=%d\nvmfov=%d\ngamma=%d\n", g_fov_camera,
252 g_fov_viewmodel, g_gamma);
253 fprintf(f, "[movement]\ncrouchjump=%d\nedgejump=%d\n",
254 (int)g_auto_crouchjump, (int)g_edge_jump);
233 gui_config_write(f); 255 gui_config_write(f);
234 bool ok = ferror(f) == 0; 256 bool ok = ferror(f) == 0;
235 if (fflush(f) != 0) 257 if (fflush(f) != 0)
@@ -250,9 +272,9 @@ static bool config_load() {
250 return false; 272 return false;
251 char line[256]; 273 char line[256];
252 FeatureState *cur = nullptr; 274 FeatureState *cur = nullptr;
253 bool in_esp = false, in_bhop = false, in_aim = false, in_silent = false, 275 bool in_esp = false, in_bhop = false, in_aim = false,
254 in_jumpbug = false, in_spread = false, in_items = false, 276 in_jumpbug = false, in_spread = false, in_items = false,
255 in_tint = false, in_fog = false; 277 in_tint = false, in_fog = false, in_view = false, in_movement = false;
256 while (fgets(line, sizeof(line), f)) { 278 while (fgets(line, sizeof(line), f)) {
257 line[strcspn(line, "\r\n")] = 0; 279 line[strcspn(line, "\r\n")] = 0;
258 if (line[0] == '[') { 280 if (line[0] == '[') {
@@ -284,18 +306,23 @@ static bool config_load() {
284 cur = &g_triggerbot; 306 cur = &g_triggerbot;
285 else if (strstr(line, "[silentaim]")) 307 else if (strstr(line, "[silentaim]"))
286 cur = &g_silentaim; 308 cur = &g_silentaim;
309 else if (strstr(line, "[view]"))
310 cur = nullptr;
311 else if (strstr(line, "[movement]"))
312 cur = nullptr;
287 else 313 else
288 cur = nullptr; 314 cur = nullptr;
289 in_esp = (cur == &g_esp); 315 in_esp = (cur == &g_esp);
290 in_bhop = (cur == &g_bhop); 316 in_bhop = (cur == &g_bhop);
291 in_aim = (cur == &g_aimbot); 317 in_aim = (cur == &g_aimbot);
292 in_silent = (cur == &g_silentaim);
293 in_jumpbug = (cur == &g_jumpbug); 318 in_jumpbug = (cur == &g_jumpbug);
294 in_spread = (cur == &g_spread); 319 in_spread = (cur == &g_spread);
295 in_items = (cur == &g_item_esp); 320 in_items = (cur == &g_item_esp);
296 in_tint = (cur == &g_world_tint); 321 in_tint = (cur == &g_world_tint);
297 in_fog = (cur == &g_fog); 322 in_fog = (cur == &g_fog);
298 } else if (cur) { 323 in_view = strstr(line, "[view]") != nullptr;
324 in_movement = strstr(line, "[movement]") != nullptr;
325 } else if (cur || in_view || in_movement) {
299 char *eq = strchr(line, '='); 326 char *eq = strchr(line, '=');
300 if (!eq) 327 if (!eq)
301 continue; 328 continue;
@@ -307,8 +334,11 @@ static bool config_load() {
307 if (in_jumpbug && strcmp(key, "assist") == 0) { 334 if (in_jumpbug && strcmp(key, "assist") == 0) {
308 g_jumpbug_assist = atoi(val) != 0; 335 g_jumpbug_assist = atoi(val) != 0;
309 } 336 }
310 if (in_spread && strcmp(key, "no_spread") == 0) { 337 if (in_spread) {
311 g_spread_no_spread = atoi(val) != 0; 338 if (strcmp(key, "no_spread") == 0)
339 g_spread_no_spread = atoi(val) != 0;
340 else if (strcmp(key, "engine") == 0)
341 g_spread_engine = atoi(val) != 0;
312 } 342 }
313 if (in_items) { 343 if (in_items) {
314 if (strcmp(key, "health") == 0) 344 if (strcmp(key, "health") == 0)
@@ -357,13 +387,36 @@ static bool config_load() {
357 g_aim_fov = v; 387 g_aim_fov = v;
358 } else if (strcmp(key, "fov_circle") == 0) { 388 } else if (strcmp(key, "fov_circle") == 0) {
359 g_aim_fov_circle = atoi(val) != 0; 389 g_aim_fov_circle = atoi(val) != 0;
390 } else if (strcmp(key, "punch") == 0) {
391 g_aim_punch = atoi(val) != 0;
360 } 392 }
361 } 393 }
362 if (in_silent && strcmp(key, "fov") == 0) { 394 if (in_view) {
363 int v = atoi(val); 395 int *dst = nullptr;
364 if (v < 1) v = 1; 396 int lo = 0, hi = 0;
365 if (v > 180) v = 180; 397 if (strcmp(key, "fov") == 0) {
366 g_silent_fov = v; 398 dst = &g_fov_camera;
399 hi = 140;
400 } else if (strcmp(key, "vmfov") == 0) {
401 dst = &g_fov_viewmodel;
402 hi = 120;
403 } else if (strcmp(key, "gamma") == 0) {
404 dst = &g_gamma;
405 lo = 16;
406 hi = 30;
407 }
408 if (dst) {
409 int v = atoi(val);
410 if (v < lo) v = lo;
411 if (v > hi) v = hi;
412 *dst = v;
413 }
414 }
415 if (in_movement) {
416 if (strcmp(key, "crouchjump") == 0)
417 g_auto_crouchjump = atoi(val) != 0;
418 else if (strcmp(key, "edgejump") == 0)
419 g_edge_jump = atoi(val) != 0;
367 } 420 }
368 if (in_tint) { 421 if (in_tint) {
369 if (strcmp(key, "world") == 0) 422 if (strcmp(key, "world") == 0)
@@ -432,6 +485,31 @@ static bool config_load() {
432 g_esp_opt[ESP_OPT_SHOW_SPEEDGRAPH] = atoi(val) != 0; 485 g_esp_opt[ESP_OPT_SHOW_SPEEDGRAPH] = atoi(val) != 0;
433 else if (strcmp(key, "dmg") == 0) 486 else if (strcmp(key, "dmg") == 0)
434 g_esp_opt[ESP_OPT_DAMAGE_TAGS] = atoi(val) != 0; 487 g_esp_opt[ESP_OPT_DAMAGE_TAGS] = atoi(val) != 0;
488 else if (strcmp(key, "alert") == 0)
489 g_esp_opt[ESP_OPT_ALERT] = atoi(val) != 0;
490 else if (strcmp(key, "weapon") == 0)
491 g_esp_opt[ESP_OPT_WEAPON] = atoi(val) != 0;
492 else if (strcmp(key, "arrows") == 0)
493 g_esp_opt[ESP_OPT_ARROWS] = atoi(val) != 0;
494 else if (strcmp(key, "hr") == 0 || strcmp(key, "hg") == 0 ||
495 strcmp(key, "hb") == 0) {
496 int v = atoi(val);
497 if (v < 0) v = 0;
498 if (v > 255) v = 255;
499 g_esp_col_hostile[key[1] == 'r' ? 0 : key[1] == 'g' ? 1 : 2] = v;
500 } else if (strcmp(key, "nr") == 0 || strcmp(key, "ng") == 0 ||
501 strcmp(key, "nb") == 0) {
502 int v = atoi(val);
503 if (v < 0) v = 0;
504 if (v > 255) v = 255;
505 g_esp_col_neutral[key[1] == 'r' ? 0 : key[1] == 'g' ? 1 : 2] = v;
506 } else if (strcmp(key, "fr") == 0 || strcmp(key, "fg") == 0 ||
507 strcmp(key, "fb") == 0) {
508 int v = atoi(val);
509 if (v < 0) v = 0;
510 if (v > 255) v = 255;
511 g_esp_col_friendly[key[1] == 'r' ? 0 : key[1] == 'g' ? 1 : 2] = v;
512 }
435 } 513 }
436 if (strcmp(key, "active") == 0) 514 if (strcmp(key, "active") == 0)
437 cur->active = atoi(val) != 0; 515 cur->active = atoi(val) != 0;
@@ -513,7 +591,22 @@ void config_reset_defaults() {
513 g_aim_vischeck = true; 591 g_aim_vischeck = true;
514 g_aim_fov = 60; 592 g_aim_fov = 60;
515 g_aim_fov_circle = true; 593 g_aim_fov_circle = true;
516 g_silent_fov = 60; 594 g_aim_punch = true;
595 g_spread_engine = true;
596 g_auto_crouchjump = false;
597 g_edge_jump = false;
598 g_fov_camera = 0;
599 g_fov_viewmodel = 0;
600 g_gamma = 22;
601 g_esp_col_hostile[0] = 255;
602 g_esp_col_hostile[1] = 60;
603 g_esp_col_hostile[2] = 60;
604 g_esp_col_neutral[0] = 220;
605 g_esp_col_neutral[1] = 220;
606 g_esp_col_neutral[2] = 220;
607 g_esp_col_friendly[0] = 60;
608 g_esp_col_friendly[1] = 255;
609 g_esp_col_friendly[2] = 60;
517 config_save(); 610 config_save();
518} 611}
519 612
@@ -669,7 +762,9 @@ bool aimbot_vischeck_enabled() { return g_aim_vischeck; }
669 762
670int aimbot_fov() { return g_aim_fov; } 763int aimbot_fov() { return g_aim_fov; }
671 764
672int silentaim_fov() { return g_silent_fov; } 765bool aim_punch_enabled() { return g_aim_punch; }
766
767bool spread_engine_enabled() { return g_spread_engine; }
673 768
674bool aimbot_fov_circle() { return g_aim_fov_circle; } 769bool aimbot_fov_circle() { return g_aim_fov_circle; }
675 770