summaryrefslogtreecommitdiffstats
path: root/src/menu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu.cpp')
-rw-r--r--src/menu.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index 020d2c5..521bf43 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -60,12 +60,16 @@ int g_fog_rgb[3] = {160, 170, 190};
60int g_fog_start = 200; 60int g_fog_start = 200;
61int g_fog_end = 3000; 61int g_fog_end = 3000;
62FeatureState g_skybox{false, 0}; // skybox.png image override 62FeatureState g_skybox{false, 0}; // skybox.png image override
63FeatureState g_projectiles{true, 0}; // grenade / rocket ESP
64bool g_proj_fuse = true;
65bool g_proj_radius = true;
63bool g_item_health = true; 66bool g_item_health = true;
64bool g_item_ammo = true; 67bool g_item_ammo = true;
65bool g_item_armor = true; 68bool g_item_armor = true;
66bool g_item_weapons = true; 69bool g_item_weapons = true;
67bool g_item_crates = true; 70bool g_item_crates = true;
68bool g_item_distance = true; 71bool g_item_distance = true;
72bool g_item_usable = true;
69int g_item_max_dist = 5000; 73int g_item_max_dist = 5000;
70 74
71// Aimbot bone checklist. Head defaults on (v1 behaviour). 75// Aimbot bone checklist. Head defaults on (v1 behaviour).
@@ -227,11 +231,16 @@ void config_save() {
227 g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable); 231 g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable);
228 fprintf(f, "[skybox]\nactive=%d\nbind=%d\n", g_skybox.active, 232 fprintf(f, "[skybox]\nactive=%d\nbind=%d\n", g_skybox.active,
229 g_skybox.bind); 233 g_skybox.bind);
234 fprintf(f, "[projectiles]\nactive=%d\nbind=%d\nfuse=%d\nradius=%d\n",
235 g_projectiles.active, g_projectiles.bind, (int)g_proj_fuse,
236 (int)g_proj_radius);
230 fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" 237 fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n"
231 "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n", 238 "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n"
239 "usable=%d\n",
232 g_item_esp.active, g_item_esp.bind, (int)g_item_health, 240 g_item_esp.active, g_item_esp.bind, (int)g_item_health,
233 (int)g_item_ammo, (int)g_item_armor, (int)g_item_weapons, 241 (int)g_item_ammo, (int)g_item_armor, (int)g_item_weapons,
234 (int)g_item_crates, (int)g_item_distance, g_item_max_dist); 242 (int)g_item_crates, (int)g_item_distance, g_item_max_dist,
243 (int)g_item_usable);
235 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" 244 fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n"
236 "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n" 245 "healthnum=%d\nname=%d\nskeleton=%d\nbox=%d\nspeedgraph=%d\n"
237 "dmg=%d\nalert=%d\nweapon=%d\narrows=%d\n" 246 "dmg=%d\nalert=%d\nweapon=%d\narrows=%d\n"
@@ -274,7 +283,8 @@ static bool config_load() {
274 FeatureState *cur = nullptr; 283 FeatureState *cur = nullptr;
275 bool in_esp = false, in_bhop = false, in_aim = false, 284 bool in_esp = false, in_bhop = false, in_aim = false,
276 in_jumpbug = false, in_spread = false, in_items = false, 285 in_jumpbug = false, in_spread = false, in_items = false,
277 in_tint = false, in_fog = false, in_view = false, in_movement = false; 286 in_tint = false, in_fog = false, in_view = false, in_movement = false,
287 in_proj = false;
278 while (fgets(line, sizeof(line), f)) { 288 while (fgets(line, sizeof(line), f)) {
279 line[strcspn(line, "\r\n")] = 0; 289 line[strcspn(line, "\r\n")] = 0;
280 if (line[0] == '[') { 290 if (line[0] == '[') {
@@ -300,6 +310,8 @@ static bool config_load() {
300 cur = &g_fog; 310 cur = &g_fog;
301 else if (strstr(line, "[skybox]")) 311 else if (strstr(line, "[skybox]"))
302 cur = &g_skybox; 312 cur = &g_skybox;
313 else if (strstr(line, "[projectiles]"))
314 cur = &g_projectiles;
303 else if (strstr(line, "[aimbot]")) 315 else if (strstr(line, "[aimbot]"))
304 cur = &g_aimbot; 316 cur = &g_aimbot;
305 else if (strstr(line, "[triggerbot]")) 317 else if (strstr(line, "[triggerbot]"))
@@ -322,6 +334,7 @@ static bool config_load() {
322 in_fog = (cur == &g_fog); 334 in_fog = (cur == &g_fog);
323 in_view = strstr(line, "[view]") != nullptr; 335 in_view = strstr(line, "[view]") != nullptr;
324 in_movement = strstr(line, "[movement]") != nullptr; 336 in_movement = strstr(line, "[movement]") != nullptr;
337 in_proj = (cur == &g_projectiles);
325 } else if (cur || in_view || in_movement) { 338 } else if (cur || in_view || in_movement) {
326 char *eq = strchr(line, '='); 339 char *eq = strchr(line, '=');
327 if (!eq) 340 if (!eq)
@@ -353,6 +366,8 @@ static bool config_load() {
353 g_item_crates = atoi(val) != 0; 366 g_item_crates = atoi(val) != 0;
354 else if (strcmp(key, "distance") == 0) 367 else if (strcmp(key, "distance") == 0)
355 g_item_distance = atoi(val) != 0; 368 g_item_distance = atoi(val) != 0;
369 else if (strcmp(key, "usable") == 0)
370 g_item_usable = atoi(val) != 0;
356 else if (strcmp(key, "max_dist") == 0) { 371 else if (strcmp(key, "max_dist") == 0) {
357 int v = atoi(val); 372 int v = atoi(val);
358 if (v < 0) v = 0; // 0 = unlimited 373 if (v < 0) v = 0; // 0 = unlimited
@@ -360,6 +375,12 @@ static bool config_load() {
360 g_item_max_dist = v; 375 g_item_max_dist = v;
361 } 376 }
362 } 377 }
378 if (in_proj) {
379 if (strcmp(key, "fuse") == 0)
380 g_proj_fuse = atoi(val) != 0;
381 else if (strcmp(key, "radius") == 0)
382 g_proj_radius = atoi(val) != 0;
383 }
363 if (in_aim) { 384 if (in_aim) {
364 if (strcmp(key, "smooth") == 0) { 385 if (strcmp(key, "smooth") == 0) {
365 int v = atoi(val); 386 int v = atoi(val);
@@ -581,12 +602,16 @@ void config_reset_defaults() {
581 g_fog_start = 200; 602 g_fog_start = 200;
582 g_fog_end = 3000; 603 g_fog_end = 3000;
583 g_skybox = {false, 0}; 604 g_skybox = {false, 0};
605 g_projectiles = {true, 0};
606 g_proj_fuse = true;
607 g_proj_radius = true;
584 g_item_health = true; 608 g_item_health = true;
585 g_item_ammo = true; 609 g_item_ammo = true;
586 g_item_armor = true; 610 g_item_armor = true;
587 g_item_weapons = true; 611 g_item_weapons = true;
588 g_item_crates = true; 612 g_item_crates = true;
589 g_item_distance = true; 613 g_item_distance = true;
614 g_item_usable = true;
590 g_item_max_dist = 5000; 615 g_item_max_dist = 5000;
591 g_aimbot = {true, 604}; 616 g_aimbot = {true, 604};
592 g_triggerbot = {true, 603}; 617 g_triggerbot = {true, 603};
@@ -713,7 +738,7 @@ static FeatureState *feature_state(int feature) {
713 static FeatureState *feats[FEAT_COUNT] = { 738 static FeatureState *feats[FEAT_COUNT] = {
714 &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot, 739 &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot,
715 &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp, 740 &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp,
716 &g_fullbright, &g_world_tint, &g_fog, &g_skybox}; 741 &g_fullbright, &g_world_tint, &g_fog, &g_skybox, &g_projectiles};
717 if (feature < 0 || feature >= FEAT_COUNT) 742 if (feature < 0 || feature >= FEAT_COUNT)
718 return nullptr; 743 return nullptr;
719 return feats[feature]; 744 return feats[feature];
@@ -940,9 +965,11 @@ void outer_draw() {
940 static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; 965 static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr;
941 bool esp_on = feature_active(FEAT_ESP); 966 bool esp_on = feature_active(FEAT_ESP);
942 bool items_on = feature_active(FEAT_ITEM_ESP); 967 bool items_on = feature_active(FEAT_ITEM_ESP);
968 bool projs_on = feature_active(FEAT_PROJECTILES);
943 bool toasts = gui_toasts_active(); 969 bool toasts = gui_toasts_active();
944 if (!g_surface || 970 if (!g_surface ||
945 (!gui_is_open() && !draw_test && !esp_on && !items_on && !toasts)) 971 (!gui_is_open() && !draw_test && !esp_on && !items_on && !projs_on &&
972 !toasts))
946 return; 973 return;
947 974
948 // Level/menu -> game transitions can invalidate the VGUI font handle. 975 // Level/menu -> game transitions can invalidate the VGUI font handle.
@@ -1007,6 +1034,8 @@ void outer_draw() {
1007 esp_draw(); 1034 esp_draw();
1008 if (items_on && overlay_font) 1035 if (items_on && overlay_font)
1009 esp_draw_items(); 1036 esp_draw_items();
1037 if (projs_on && overlay_font)
1038 esp_draw_projectiles();
1010 if (draw_test && overlay_font) { 1039 if (draw_test && overlay_font) {
1011 surf_draw_set_color(255, 0, 0, 255); 1040 surf_draw_set_color(255, 0, 0, 255);
1012 surf_draw_filled_rect(20, 20, 180, 60); 1041 surf_draw_filled_rect(20, 20, 180, 60);