summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh2
-rw-r--r--src/menu.cpp35
2 files changed, 36 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index b72bd2f..51b1ca9 100755
--- a/build.sh
+++ b/build.sh
@@ -4,5 +4,5 @@ cd "$(dirname "$0")"
4g++ -m32 -O2 -std=c++17 -Wall -Wextra -Werror -fPIC -shared -fvisibility=hidden -fno-omit-frame-pointer \ 4g++ -m32 -O2 -std=c++17 -Wall -Wextra -Werror -fPIC -shared -fvisibility=hidden -fno-omit-frame-pointer \
5 -o libhl2hake.so \ 5 -o libhl2hake.so \
6 src/hl2h.cpp src/modules.cpp src/cinput.cpp src/netvars.cpp src/menu.cpp src/gui.cpp src/esp.cpp src/server.cpp src/bones.cpp src/vischeck.cpp \ 6 src/hl2h.cpp src/modules.cpp src/cinput.cpp src/netvars.cpp src/menu.cpp src/gui.cpp src/esp.cpp src/server.cpp src/bones.cpp src/vischeck.cpp \
7 -ldl 7 -ldl -Wl,--no-undefined
8file libhl2hake.so 8file libhl2hake.so
diff --git a/src/menu.cpp b/src/menu.cpp
index af1d2b8..e48fee0 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -660,6 +660,41 @@ void draw_text_col(int x, int y, const char *text, int r, int g, int b) {
660 surf_draw_print_text(wtext, (int)wcslen(wtext)); 660 surf_draw_print_text(wtext, (int)wcslen(wtext));
661} 661}
662 662
663// ---------------------------------------------------------------------------
664// mat_fullbright
665// ---------------------------------------------------------------------------
666
667static int g_fullbright_applied = -1;
668static bool g_fullbright_fail_logged = false;
669
670void fullbright_invalidate() { g_fullbright_applied = -1; }
671
672void fullbright_update() {
673 bool want = feature_active(FEAT_FULLBRIGHT);
674 if ((int)want == g_fullbright_applied)
675 return;
676 // Avoid touching the engine console before the first map/menu frame. The
677 // engine may still be initializing its command buffer.
678 if (!want && g_fullbright_applied < 0) {
679 g_fullbright_applied = 0;
680 return;
681 }
682 bool ok = cvar_set_int("mat_fullbright", want ? 1 : 0);
683 g_fullbright_applied = want;
684 if (ok) {
685 if (want)
686 logf("fullbright: on");
687 else
688 logd("fullbright: off");
689 return;
690 }
691 if (want && !g_fullbright_fail_logged) {
692 g_fullbright_fail_logged = true;
693 logf("fullbright: mat_fullbright cvar unavailable");
694 toastf(TOAST_ERROR, "Fullbright unavailable: cvar interface missing");
695 }
696}
697
663// Draw overlay. MUST be called from inside the ISurface paint path 698// Draw overlay. MUST be called from inside the ISurface paint path
664// (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in 699// (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in
665// PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. 700// PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip.