diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-03 22:44:22 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-03 22:44:22 +0100 |
| commit | 5f256e1f92bf7b495667a0ff453b491f98a38fbf (patch) | |
| tree | a19081268ca0ea665869dc4655325308b5881ba8 /src/menu.cpp | |
| parent | Startup crash: skip fullbright command when off; drop bad owner netvars; add ... (diff) | |
| download | hl2h-5f256e1f92bf7b495667a0ff453b491f98a38fbf.tar.gz hl2h-5f256e1f92bf7b495667a0ff453b491f98a38fbf.zip | |
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.
Diffstat (limited to 'src/menu.cpp')
| -rw-r--r-- | src/menu.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 | |||
| 667 | static int g_fullbright_applied = -1; | ||
| 668 | static bool g_fullbright_fail_logged = false; | ||
| 669 | |||
| 670 | void fullbright_invalidate() { g_fullbright_applied = -1; } | ||
| 671 | |||
| 672 | void 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. |
