From 8cd07c04efafcd3e927a21152d10e9fafea54517 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:04:39 +0100 Subject: Transitions: per-trigger targets and 3D wireframe; FOV range fixes - Each changelevel trigger now shows its own target map. The trigger whose target is the map we came from is marked "<- map"; the forward one is "-> map". No more appending one global previous-map line to every box. - Draw the volume as a projected 8-corner / 12-edge wireframe with the tag above its highest visible corner instead of a screen-space rectangle. - Camera FOV is 40..140 (stock 75) and viewmodel FOV 20..120 (stock 54); 0 is no longer allowed and old configs using 0 migrate to the stock value. - Log the mat_monitorgamma readback via ICvar so we can tell whether the command is rejected or the OS/compositor ignores the gamma ramp. --- src/hl2h.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index 74a8c6c..f7106cd 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -664,25 +664,14 @@ static void install_uniform_random_hook() { // and monitor gamma are plain client cvars. static void view_settings_apply(void *ent) { - if (g_net.default_fov >= 0 && ent) { - static int last = -2; - int want = g_fov_camera > 0 ? g_fov_camera : 0; - if (want != last || g_fov_camera > 0) { - *(int *)((uintptr_t)ent + g_net.default_fov) = want; - last = want; - } - } - // 0 means "leave the game's value alone": only send a command once the - // slider is non-zero, then restore the stock value when it returns to 0. - static int last_vm = 0; - if (g_fov_viewmodel > 0 && g_fov_viewmodel != last_vm) { + if (g_net.default_fov >= 0 && ent) + *(int *)((uintptr_t)ent + g_net.default_fov) = g_fov_camera; + static int last_vm = 54; + if (g_fov_viewmodel != last_vm) { char cmd[48]; snprintf(cmd, sizeof(cmd), "viewmodel_fov %d", g_fov_viewmodel); console_cmd(cmd); last_vm = g_fov_viewmodel; - } else if (g_fov_viewmodel == 0 && last_vm > 0) { - console_cmd("viewmodel_fov 54"); - last_vm = 0; } static int last_gamma = 22; if (g_gamma != last_gamma) { @@ -690,6 +679,18 @@ static void view_settings_apply(void *ent) { snprintf(cmd, sizeof(cmd), "mat_monitorgamma %d.%d", g_gamma / 10, g_gamma % 10); console_cmd(cmd); + // Read back through ICvar to tell an ignored command from an OS gamma + // ramp that the compositor discards. + float got = -1.0f; + if (g_iface.cvar) { + using FindFn = void *(*)(void *, const char *); + void *v = vfunc(g_iface.cvar, 12)(g_iface.cvar, + "mat_monitorgamma"); + if (v) + got = *(float *)((uintptr_t)v + 0x2c); // ConVar m_Value.f + } + logf("view: gamma request %d.%d, cvar reports %.2f", g_gamma / 10, + g_gamma % 10, got); last_gamma = g_gamma; } } -- cgit v1.2.3