From 5f256e1f92bf7b495667a0ff453b491f98a38fbf Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 22:44:22 +0100 Subject: Fix undefined fullbright symbols; link with --no-undefined The fullbright_update/fullbright_invalidate definitions were lost when the old text-menu section was removed, leaving undefined symbols that made the dynamic loader reject libhl2hake.so. Restore both definitions and add -Wl,--no-undefined so missing definitions fail the build instead of the game. --- src/menu.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src') 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) { surf_draw_print_text(wtext, (int)wcslen(wtext)); } +// --------------------------------------------------------------------------- +// mat_fullbright +// --------------------------------------------------------------------------- + +static int g_fullbright_applied = -1; +static bool g_fullbright_fail_logged = false; + +void fullbright_invalidate() { g_fullbright_applied = -1; } + +void fullbright_update() { + bool want = feature_active(FEAT_FULLBRIGHT); + if ((int)want == g_fullbright_applied) + return; + // Avoid touching the engine console before the first map/menu frame. The + // engine may still be initializing its command buffer. + if (!want && g_fullbright_applied < 0) { + g_fullbright_applied = 0; + return; + } + bool ok = cvar_set_int("mat_fullbright", want ? 1 : 0); + g_fullbright_applied = want; + if (ok) { + if (want) + logf("fullbright: on"); + else + logd("fullbright: off"); + return; + } + if (want && !g_fullbright_fail_logged) { + g_fullbright_fail_logged = true; + logf("fullbright: mat_fullbright cvar unavailable"); + toastf(TOAST_ERROR, "Fullbright unavailable: cvar interface missing"); + } +} + // Draw overlay. MUST be called from inside the ISurface paint path // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. -- cgit v1.2.3