Skip to content

Commit 4f1ba0f

Browse files
belomaxorkaclaude
andcommitted
Make mp_show_hintmessages respect bOverride to preserve ReAPI contract
Move the cvar check below the IsAlive gate and skip it when bOverride is set, so it acts as a server-side sibling of the client _ah (auto-help) preference rather than an unconditional block. The hook chain terminal (HintMessageEx OrigFunc) still runs after all plugin hooks, so RG_CBasePlayer_HintMessageEx keeps firing for vanilla events. And because bOverride already bypasses m_bShowHints today, ReAPI callers that need guaranteed delivery (rg_hint_message with override) keep their existing escape hatch — no new contract is broken. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 6c6cf17 commit 4f1ba0f

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
7474
| mp_show_radioicon | 1 | 0 | 1 | Show radio icon.<br/>`0` disabled<br/>`1` enabled |
7575
| mp_show_scenarioicon | 0 | 0 | 1 | Show scenario icon in HUD such as count of alive hostages or ticking bomb.<br/>`0` disabled<br/>`1` enabled |
7676
| mp_show_bomb_timer | 0 | 0 | 1 | Show the time until the planted bomb explodes on the HUD round timer.<br/>`0` disabled<br/>`1` enabled (when the bomb is planted, the round timer shows the C4 countdown) |
77-
| mp_show_hintmessages | 1 | 0 | 1 | Send hint messages (Hint_*) to clients.<br/>`0` disabled (hints are blocked server-side)<br/>`1` enabled |
77+
| mp_show_hintmessages | 1 | 0 | 1 | Send hint messages (Hint_*) to clients.<br/>`0` disabled (non-forced hints are suppressed server-side; forced hints, e.g. ReAPI `rg_hint_message` with override, still pass)<br/>`1` enabled |
7878
| mp_old_bomb_defused_sound | 1 | 0 | 1 | Play "Bomb has been defused" sound instead of "Counter-Terrorists win" when bomb was defused<br/>`0` disabled<br/>`1` enabled |
7979
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
8080
| sv_alltalk | 0 | 0 | 5 | When players can hear each other ([further explanation](../../wiki/sv_alltalk)).<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody<br/>`4` alive hear alive, dead hear dead and alive.<br/>`5` alive hear alive teammates, dead hear dead and alive.

dist/game.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ mp_show_scenarioicon "0"
207207
mp_show_bomb_timer "0"
208208
209209
// Send hint messages (Hint_*) to clients.
210-
// 0 - disabled (hints are blocked server-side)
210+
// 0 - disabled (non-forced hints suppressed server-side; forced hints still pass)
211211
// 1 - enabled (default behavior)
212212
//
213213
// Default value: "1"

regamedll/dlls/player.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8108,14 +8108,17 @@ LINK_HOOK_CLASS_CHAIN(bool, CBasePlayer, HintMessageEx, (const char *pMessage, f
81088108

81098109
bool EXT_FUNC CBasePlayer::__API_HOOK(HintMessageEx)(const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride)
81108110
{
8111-
#ifdef REGAMEDLL_ADD
8112-
if (show_hintmessages.value == 0.0f)
8113-
return false;
8114-
#endif
8115-
81168111
if (!bDisplayIfPlayerDead && !IsAlive())
81178112
return false;
81188113

8114+
#ifdef REGAMEDLL_ADD
8115+
// Server-side sibling of the client's _ah (auto-help) preference: suppresses
8116+
// non-forced hints only. bOverride still bypasses it, exactly as it already
8117+
// bypasses m_bShowHints, so ReAPI callers keep their existing escape hatch.
8118+
if (!bOverride && show_hintmessages.value == 0.0f)
8119+
return true;
8120+
#endif
8121+
81198122
if (bOverride || m_bShowHints)
81208123
return m_hintMessageQueue.AddMessage(pMessage, duration, true, nullptr);
81218124

0 commit comments

Comments
 (0)