From edba65625dd5823705619a2e682a99d6ad91ae8b Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 23:32:16 +0100 Subject: World: add prop tint and fog override - World tint now also colours prop materials (models/props*) with their own colour, covering static props and prop_physics while leaving NPC, player and weapon materials untouched. - New Fog card: fog_override colour/start/end via ClientCmd, optional skybox fog, and a Remove fog mode. Restores the map fog (fog_override 0) when disabled and re-applies after level changes. - Config sections [worldtint] prop/colour keys and [fog]. --- src/menu.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 6 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 6a7ffe5..237502b 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -49,8 +49,16 @@ FeatureState g_fullbright{false, 0}; // mat_fullbright world lighting FeatureState g_world_tint{false, 0}; // material colour modulation bool g_tint_world_on = true; bool g_tint_sky_on = true; +bool g_tint_prop_on = true; int g_tint_world_rgb[3] = {255, 255, 255}; int g_tint_sky_rgb[3] = {255, 255, 255}; +int g_tint_prop_rgb[3] = {255, 255, 255}; +FeatureState g_fog{false, 0}; // fog_override colour/distance +bool g_fog_skybox = true; +bool g_fog_disable = false; +int g_fog_rgb[3] = {160, 170, 190}; +int g_fog_start = 200; +int g_fog_end = 3000; bool g_item_health = true; bool g_item_ammo = true; bool g_item_armor = true; @@ -193,11 +201,17 @@ void config_save() { fprintf(f, "[fullbright]\nactive=%d\nbind=%d\n", g_fullbright.active, g_fullbright.bind); fprintf(f, "[worldtint]\nactive=%d\nbind=%d\nworld=%d\nsky=%d\n" - "wr=%d\nwg=%d\nwb=%d\nsr=%d\nsg=%d\nsb=%d\n", + "prop=%d\nwr=%d\nwg=%d\nwb=%d\nsr=%d\nsg=%d\nsb=%d\n" + "pr=%d\npg=%d\npb=%d\n", g_world_tint.active, g_world_tint.bind, (int)g_tint_world_on, - (int)g_tint_sky_on, g_tint_world_rgb[0], g_tint_world_rgb[1], - g_tint_world_rgb[2], g_tint_sky_rgb[0], g_tint_sky_rgb[1], - g_tint_sky_rgb[2]); + (int)g_tint_sky_on, (int)g_tint_prop_on, g_tint_world_rgb[0], + g_tint_world_rgb[1], g_tint_world_rgb[2], g_tint_sky_rgb[0], + g_tint_sky_rgb[1], g_tint_sky_rgb[2], g_tint_prop_rgb[0], + g_tint_prop_rgb[1], g_tint_prop_rgb[2]); + fprintf(f, "[fog]\nactive=%d\nbind=%d\nr=%d\ng=%d\nb=%d\n" + "start=%d\nend=%d\nskybox=%d\ndisable=%d\n", + g_fog.active, g_fog.bind, g_fog_rgb[0], g_fog_rgb[1], g_fog_rgb[2], + g_fog_start, g_fog_end, (int)g_fog_skybox, (int)g_fog_disable); fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n", g_item_esp.active, g_item_esp.bind, (int)g_item_health, @@ -232,7 +246,7 @@ static bool config_load() { FeatureState *cur = nullptr; bool in_esp = false, in_bhop = false, in_aim = false, in_silent = false, in_jumpbug = false, in_spread = false, in_items = false, - in_tint = false; + in_tint = false, in_fog = false; while (fgets(line, sizeof(line), f)) { line[strcspn(line, "\r\n")] = 0; if (line[0] == '[') { @@ -254,6 +268,8 @@ static bool config_load() { cur = &g_fullbright; else if (strstr(line, "[worldtint]")) cur = &g_world_tint; + else if (strstr(line, "[fog]")) + cur = &g_fog; else if (strstr(line, "[aimbot]")) cur = &g_aimbot; else if (strstr(line, "[triggerbot]")) @@ -270,6 +286,7 @@ static bool config_load() { in_spread = (cur == &g_spread); in_items = (cur == &g_item_esp); in_tint = (cur == &g_world_tint); + in_fog = (cur == &g_fog); } else if (cur) { char *eq = strchr(line, '='); if (!eq) @@ -345,6 +362,8 @@ static bool config_load() { g_tint_world_on = atoi(val) != 0; else if (strcmp(key, "sky") == 0) g_tint_sky_on = atoi(val) != 0; + else if (strcmp(key, "prop") == 0) + g_tint_prop_on = atoi(val) != 0; else if (strcmp(key, "wr") == 0 || strcmp(key, "wg") == 0 || strcmp(key, "wb") == 0) { int v = atoi(val); @@ -357,6 +376,35 @@ static bool config_load() { if (v < 0) v = 0; if (v > 255) v = 255; g_tint_sky_rgb[key[1] == 'r' ? 0 : key[1] == 'g' ? 1 : 2] = v; + } else if (strcmp(key, "pr") == 0 || strcmp(key, "pg") == 0 || + strcmp(key, "pb") == 0) { + int v = atoi(val); + if (v < 0) v = 0; + if (v > 255) v = 255; + g_tint_prop_rgb[key[1] == 'r' ? 0 : key[1] == 'g' ? 1 : 2] = v; + } + } + if (in_fog) { + if (strcmp(key, "r") == 0 || strcmp(key, "g") == 0 || + strcmp(key, "b") == 0) { + int v = atoi(val); + if (v < 0) v = 0; + if (v > 255) v = 255; + g_fog_rgb[key[0] == 'r' ? 0 : key[0] == 'g' ? 1 : 2] = v; + } else if (strcmp(key, "start") == 0) { + int v = atoi(val); + if (v < 0) v = 0; + if (v > 8000) v = 8000; + g_fog_start = v; + } else if (strcmp(key, "end") == 0) { + int v = atoi(val); + if (v < 0) v = 0; + if (v > 20000) v = 20000; + g_fog_end = v; + } else if (strcmp(key, "skybox") == 0) { + g_fog_skybox = atoi(val) != 0; + } else if (strcmp(key, "disable") == 0) { + g_fog_disable = atoi(val) != 0; } } if (in_esp) { @@ -415,8 +463,18 @@ void config_reset_defaults() { g_world_tint = {false, 0}; g_tint_world_on = true; g_tint_sky_on = true; + g_tint_prop_on = true; g_tint_world_rgb[0] = g_tint_world_rgb[1] = g_tint_world_rgb[2] = 255; g_tint_sky_rgb[0] = g_tint_sky_rgb[1] = g_tint_sky_rgb[2] = 255; + g_tint_prop_rgb[0] = g_tint_prop_rgb[1] = g_tint_prop_rgb[2] = 255; + g_fog = {false, 0}; + g_fog_skybox = true; + g_fog_disable = false; + g_fog_rgb[0] = 160; + g_fog_rgb[1] = 170; + g_fog_rgb[2] = 190; + g_fog_start = 200; + g_fog_end = 3000; g_item_health = true; g_item_ammo = true; g_item_armor = true; @@ -534,7 +592,7 @@ static FeatureState *feature_state(int feature) { static FeatureState *feats[FEAT_COUNT] = { &g_bhop, &g_abh, &g_esp, &g_aimbot, &g_triggerbot, &g_silentaim, &g_jumpbug, &g_melee, &g_spread, &g_item_esp, - &g_fullbright, &g_world_tint}; + &g_fullbright, &g_world_tint, &g_fog}; if (feature < 0 || feature >= FEAT_COUNT) return nullptr; return feats[feature]; @@ -741,6 +799,7 @@ void outer_draw() { poll_keyboard(); fullbright_update(); world_tint_update(); + fog_update(); gui_handle_input(); // HL2H_DRAW_TEST=1 draws a probe rect without needing the GUI open static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; @@ -762,6 +821,7 @@ void outer_draw() { last_local = le; font_reset = true; world_tint_invalidate(); + fog_invalidate(); } } if (font_reset && g_font) { -- cgit v1.2.3