diff options
Diffstat (limited to '')
| -rw-r--r-- | src/menu.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 237502b..dfd973d 100644 --- a/src/menu.cpp +++ b/src/menu.cpp | |||
| @@ -59,6 +59,8 @@ bool g_fog_disable = false; | |||
| 59 | int g_fog_rgb[3] = {160, 170, 190}; | 59 | int g_fog_rgb[3] = {160, 170, 190}; |
| 60 | int g_fog_start = 200; | 60 | int g_fog_start = 200; |
| 61 | int g_fog_end = 3000; | 61 | int g_fog_end = 3000; |
| 62 | FeatureState g_skybox{false, 0}; // sv_skyname override | ||
| 63 | int g_skybox_choice = 0; // 0 = map default | ||
| 62 | bool g_item_health = true; | 64 | bool g_item_health = true; |
| 63 | bool g_item_ammo = true; | 65 | bool g_item_ammo = true; |
| 64 | bool g_item_armor = true; | 66 | bool g_item_armor = true; |
| @@ -212,6 +214,8 @@ void config_save() { | |||
| 212 | "start=%d\nend=%d\nskybox=%d\ndisable=%d\n", | 214 | "start=%d\nend=%d\nskybox=%d\ndisable=%d\n", |
| 213 | g_fog.active, g_fog.bind, g_fog_rgb[0], g_fog_rgb[1], g_fog_rgb[2], | 215 | g_fog.active, g_fog.bind, g_fog_rgb[0], g_fog_rgb[1], g_fog_rgb[2], |
| 214 | g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable); | 216 | g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable); |
| 217 | fprintf(f, "[skybox]\nactive=%d\nbind=%d\nchoice=%d\n", g_skybox.active, | ||
| 218 | g_skybox.bind, g_skybox_choice); | ||
| 215 | fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" | 219 | fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" |
| 216 | "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n", | 220 | "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n", |
| 217 | g_item_esp.active, g_item_esp.bind, (int)g_item_health, | 221 | g_item_esp.active, g_item_esp.bind, (int)g_item_health, |
| @@ -246,7 +250,7 @@ static bool config_load() { | |||
| 246 | FeatureState *cur = nullptr; | 250 | FeatureState *cur = nullptr; |
| 247 | bool in_esp = false, in_bhop = false, in_aim = false, in_silent = false, | 251 | bool in_esp = false, in_bhop = false, in_aim = false, in_silent = false, |
| 248 | in_jumpbug = false, in_spread = false, in_items = false, | 252 | in_jumpbug = false, in_spread = false, in_items = false, |
| 249 | in_tint = false, in_fog = false; | 253 | in_tint = false, in_fog = false, in_skybox = false; |
| 250 | while (fgets(line, sizeof(line), f)) { | 254 | while (fgets(line, sizeof(line), f)) { |
| 251 | line[strcspn(line, "\r\n")] = 0; | 255 | line[strcspn(line, "\r\n")] = 0; |
| 252 | if (line[0] == '[') { | 256 | if (line[0] == '[') { |
| @@ -270,6 +274,8 @@ static bool config_load() { | |||
| 270 | cur = &g_world_tint; | 274 | cur = &g_world_tint; |
| 271 | else if (strstr(line, "[fog]")) | 275 | else if (strstr(line, "[fog]")) |
| 272 | cur = &g_fog; | 276 | cur = &g_fog; |
| 277 | else if (strstr(line, "[skybox]")) | ||
| 278 | cur = &g_skybox; | ||
| 273 | else if (strstr(line, "[aimbot]")) | 279 | else if (strstr(line, "[aimbot]")) |
| 274 | cur = &g_aimbot; | 280 | cur = &g_aimbot; |
| 275 | else if (strstr(line, "[triggerbot]")) | 281 | else if (strstr(line, "[triggerbot]")) |
| @@ -287,6 +293,7 @@ static bool config_load() { | |||
| 287 | in_items = (cur == &g_item_esp); | 293 | in_items = (cur == &g_item_esp); |
| 288 | in_tint = (cur == &g_world_tint); | 294 | in_tint = (cur == &g_world_tint); |
| 289 | in_fog = (cur == &g_fog); | 295 | in_fog = (cur == &g_fog); |
| 296 | in_skybox = (cur == &g_skybox); | ||
| 290 | } else if (cur) { | 297 | } else if (cur) { |
| 291 | char *eq = strchr(line, '='); | 298 | char *eq = strchr(line, '='); |
| 292 | if (!eq) | 299 | if (!eq) |
| @@ -407,6 +414,12 @@ static bool config_load() { | |||
| 407 | g_fog_disable = atoi(val) != 0; | 414 | g_fog_disable = atoi(val) != 0; |
| 408 | } | 415 | } |
| 409 | } | 416 | } |
| 417 | if (in_skybox && strcmp(key, "choice") == 0) { | ||
| 418 | int v = atoi(val); | ||
| 419 | if (v < 0) v = 0; | ||
| 420 | if (v >= skybox_option_count()) v = 0; | ||
| 421 | g_skybox_choice = v; | ||
| 422 | } | ||
| 410 | if (in_esp) { | 423 | if (in_esp) { |
| 411 | if (strcmp(key, "neutral") == 0) | 424 | if (strcmp(key, "neutral") == 0) |
| 412 | g_esp_opt[ESP_OPT_SHOW_NEUTRAL] = atoi(val) != 0; | 425 | g_esp_opt[ESP_OPT_SHOW_NEUTRAL] = atoi(val) != 0; |
| @@ -475,6 +488,8 @@ void config_reset_defaults() { | |||
| 475 | g_fog_rgb[2] = 190; | 488 | g_fog_rgb[2] = 190; |
| 476 | g_fog_start = 200; | 489 | g_fog_start = 200; |
| 477 | g_fog_end = 3000; | 490 | g_fog_end = 3000; |
| 491 | g_skybox = {false, 0}; | ||
| 492 | g_skybox_choice = 0; | ||
| 478 | g_item_health = true; | 493 | g_item_health = true; |
| 479 | g_item_ammo = true; | 494 | g_item_ammo = true; |
| 480 | g_item_armor = true; | 495 | g_item_armor = true; |
| @@ -592,7 +607,7 @@ static FeatureState *feature_state(int feature) { | |||
| 592 | static FeatureState *feats[FEAT_COUNT] = { | 607 | static FeatureState *feats[FEAT_COUNT] = { |
| 593 | &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot, | 608 | &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot, |
| 594 | &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp, | 609 | &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp, |
| 595 | &g_fullbright, &g_world_tint, &g_fog}; | 610 | &g_fullbright, &g_world_tint, &g_fog, &g_skybox}; |
| 596 | if (feature < 0 || feature >= FEAT_COUNT) | 611 | if (feature < 0 || feature >= FEAT_COUNT) |
| 597 | return nullptr; | 612 | return nullptr; |
| 598 | return feats[feature]; | 613 | return feats[feature]; |
| @@ -800,6 +815,7 @@ void outer_draw() { | |||
| 800 | fullbright_update(); | 815 | fullbright_update(); |
| 801 | world_tint_update(); | 816 | world_tint_update(); |
| 802 | fog_update(); | 817 | fog_update(); |
| 818 | skybox_update(); | ||
| 803 | gui_handle_input(); | 819 | gui_handle_input(); |
| 804 | // HL2H_DRAW_TEST=1 draws a probe rect without needing the GUI open | 820 | // HL2H_DRAW_TEST=1 draws a probe rect without needing the GUI open |
| 805 | static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; | 821 | static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; |
| @@ -822,6 +838,7 @@ void outer_draw() { | |||
| 822 | font_reset = true; | 838 | font_reset = true; |
| 823 | world_tint_invalidate(); | 839 | world_tint_invalidate(); |
| 824 | fog_invalidate(); | 840 | fog_invalidate(); |
| 841 | skybox_invalidate(); | ||
| 825 | } | 842 | } |
| 826 | } | 843 | } |
| 827 | if (font_reset && g_font) { | 844 | if (font_reset && g_font) { |
