From 95b5be2299b332917ae63c45252cb9744a3460cd Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 23:51:02 +0100 Subject: World: add skybox changer New Visuals -> Skybox card with a runtime sv_skyname override using the same mechanism as the stock skybox_swapper entity. The choice list is the HL2 skybox set extracted from the game VPKs. The map's own sky is captured from loaded materials (SkyBox group, parsing skybox/... face names) before the first override, so turning the feature off or picking "Map default" restores it; a level change restores it implicitly. Sky changes invalidate the world tint so new sky materials are tinted as well. GUI: add a CK_CHOICE control (value box with < / > zones). --- src/menu.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/menu.cpp') 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; int g_fog_rgb[3] = {160, 170, 190}; int g_fog_start = 200; int g_fog_end = 3000; +FeatureState g_skybox{false, 0}; // sv_skyname override +int g_skybox_choice = 0; // 0 = map default bool g_item_health = true; bool g_item_ammo = true; bool g_item_armor = true; @@ -212,6 +214,8 @@ void config_save() { "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, "[skybox]\nactive=%d\nbind=%d\nchoice=%d\n", g_skybox.active, + g_skybox.bind, g_skybox_choice); 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, @@ -246,7 +250,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_fog = false; + in_tint = false, in_fog = false, in_skybox = false; while (fgets(line, sizeof(line), f)) { line[strcspn(line, "\r\n")] = 0; if (line[0] == '[') { @@ -270,6 +274,8 @@ static bool config_load() { cur = &g_world_tint; else if (strstr(line, "[fog]")) cur = &g_fog; + else if (strstr(line, "[skybox]")) + cur = &g_skybox; else if (strstr(line, "[aimbot]")) cur = &g_aimbot; else if (strstr(line, "[triggerbot]")) @@ -287,6 +293,7 @@ static bool config_load() { in_items = (cur == &g_item_esp); in_tint = (cur == &g_world_tint); in_fog = (cur == &g_fog); + in_skybox = (cur == &g_skybox); } else if (cur) { char *eq = strchr(line, '='); if (!eq) @@ -407,6 +414,12 @@ static bool config_load() { g_fog_disable = atoi(val) != 0; } } + if (in_skybox && strcmp(key, "choice") == 0) { + int v = atoi(val); + if (v < 0) v = 0; + if (v >= skybox_option_count()) v = 0; + g_skybox_choice = v; + } if (in_esp) { if (strcmp(key, "neutral") == 0) g_esp_opt[ESP_OPT_SHOW_NEUTRAL] = atoi(val) != 0; @@ -475,6 +488,8 @@ void config_reset_defaults() { g_fog_rgb[2] = 190; g_fog_start = 200; g_fog_end = 3000; + g_skybox = {false, 0}; + g_skybox_choice = 0; g_item_health = true; g_item_ammo = true; g_item_armor = true; @@ -592,7 +607,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_fog}; + &g_fullbright, &g_world_tint, &g_fog, &g_skybox}; if (feature < 0 || feature >= FEAT_COUNT) return nullptr; return feats[feature]; @@ -800,6 +815,7 @@ void outer_draw() { fullbright_update(); world_tint_update(); fog_update(); + skybox_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; @@ -822,6 +838,7 @@ void outer_draw() { font_reset = true; world_tint_invalidate(); fog_invalidate(); + skybox_invalidate(); } } if (font_reset && g_font) { -- cgit v1.2.3