diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 14:04:39 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 14:04:39 +0100 |
| commit | 8cd07c04efafcd3e927a21152d10e9fafea54517 (patch) | |
| tree | c89fdf577c90e82080ff5c15982d016cc3f5f7fa /src/hl2h.cpp | |
| parent | Add ESP, aim, view and movement batch (diff) | |
| download | hl2h-8cd07c04efafcd3e927a21152d10e9fafea54517.tar.gz hl2h-8cd07c04efafcd3e927a21152d10e9fafea54517.zip | |
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.
Diffstat (limited to 'src/hl2h.cpp')
| -rw-r--r-- | src/hl2h.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
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() { | |||
| 664 | // and monitor gamma are plain client cvars. | 664 | // and monitor gamma are plain client cvars. |
| 665 | 665 | ||
| 666 | static void view_settings_apply(void *ent) { | 666 | static void view_settings_apply(void *ent) { |
| 667 | if (g_net.default_fov >= 0 && ent) { | 667 | if (g_net.default_fov >= 0 && ent) |
| 668 | static int last = -2; | 668 | *(int *)((uintptr_t)ent + g_net.default_fov) = g_fov_camera; |
| 669 | int want = g_fov_camera > 0 ? g_fov_camera : 0; | 669 | static int last_vm = 54; |
| 670 | if (want != last || g_fov_camera > 0) { | 670 | if (g_fov_viewmodel != last_vm) { |
| 671 | *(int *)((uintptr_t)ent + g_net.default_fov) = want; | ||
| 672 | last = want; | ||
| 673 | } | ||
| 674 | } | ||
| 675 | // 0 means "leave the game's value alone": only send a command once the | ||
| 676 | // slider is non-zero, then restore the stock value when it returns to 0. | ||
| 677 | static int last_vm = 0; | ||
| 678 | if (g_fov_viewmodel > 0 && g_fov_viewmodel != last_vm) { | ||
| 679 | char cmd[48]; | 671 | char cmd[48]; |
| 680 | snprintf(cmd, sizeof(cmd), "viewmodel_fov %d", g_fov_viewmodel); | 672 | snprintf(cmd, sizeof(cmd), "viewmodel_fov %d", g_fov_viewmodel); |
| 681 | console_cmd(cmd); | 673 | console_cmd(cmd); |
| 682 | last_vm = g_fov_viewmodel; | 674 | last_vm = g_fov_viewmodel; |
| 683 | } else if (g_fov_viewmodel == 0 && last_vm > 0) { | ||
| 684 | console_cmd("viewmodel_fov 54"); | ||
| 685 | last_vm = 0; | ||
| 686 | } | 675 | } |
| 687 | static int last_gamma = 22; | 676 | static int last_gamma = 22; |
| 688 | if (g_gamma != last_gamma) { | 677 | if (g_gamma != last_gamma) { |
| @@ -690,6 +679,18 @@ static void view_settings_apply(void *ent) { | |||
| 690 | snprintf(cmd, sizeof(cmd), "mat_monitorgamma %d.%d", g_gamma / 10, | 679 | snprintf(cmd, sizeof(cmd), "mat_monitorgamma %d.%d", g_gamma / 10, |
| 691 | g_gamma % 10); | 680 | g_gamma % 10); |
| 692 | console_cmd(cmd); | 681 | console_cmd(cmd); |
| 682 | // Read back through ICvar to tell an ignored command from an OS gamma | ||
| 683 | // ramp that the compositor discards. | ||
| 684 | float got = -1.0f; | ||
| 685 | if (g_iface.cvar) { | ||
| 686 | using FindFn = void *(*)(void *, const char *); | ||
| 687 | void *v = vfunc<FindFn>(g_iface.cvar, 12)(g_iface.cvar, | ||
| 688 | "mat_monitorgamma"); | ||
| 689 | if (v) | ||
| 690 | got = *(float *)((uintptr_t)v + 0x2c); // ConVar m_Value.f | ||
| 691 | } | ||
| 692 | logf("view: gamma request %d.%d, cvar reports %.2f", g_gamma / 10, | ||
| 693 | g_gamma % 10, got); | ||
| 693 | last_gamma = g_gamma; | 694 | last_gamma = g_gamma; |
| 694 | } | 695 | } |
| 695 | } | 696 | } |
