Skip to content

Commit dbd3bd5

Browse files
committed
Add more hud manager convars for reducing instances of flashing
1 parent e1a7aeb commit dbd3bd5

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ cs2f_prevent_using_players 0 // Whether to prevent +use from hitting players (
2626
cs2f_map_steamids_enable 0 // Whether to make Steam ID's available to maps
2727
cs2f_fix_game_bans 0 // Whether to fix CS2 game bans spreading to all new joining players
2828
cs2f_free_armor 0 // Whether kevlar (1+) and/or helmet (2) are given automatically
29-
cs2f_fix_hud_flashing 0 // Whether to fix hud flashing using a workaround, this BREAKS warmup so pick one or the other
3029
3130
cs2f_beacon_particle "particles/cs2fixes/admin_beacon.vpcf" // .vpcf file to be precached and used for player beacon
3231
@@ -152,4 +151,9 @@ entwatch_auto_filter 1 // Whether to automatically block non-item holders fro
152151
entwatch_clantag 1 // Whether to set item holder's clantag and set 9999 score
153152
entwatch_score 9999 // Score to give item holders (0 = dont change score at all) Requires entwatch_clantag 1
154153
entwatch_glow 1000 // Distance that dropped item weapon glow will be visible (0 = glow disabled)
155-
entwatch_glow_team 0 // Whether dropped item glow is only visible to the team the item belongs to (0 = glow to all players)
154+
entwatch_glow_team 0 // Whether dropped item glow is only visible to the team the item belongs to (0 = glow to all players)
155+
156+
// Hud settings
157+
cs2f_fix_hud_flashing 0 // Whether to fix hud flashing using a workaround, this BREAKS warmup so pick one or the other
158+
cs2f_disable_hud_outside_round 0 // Whether to disable hud messages that would flash when a round is not ongoing, since flashing fix cannot run then
159+
cs2f_hud_duration_leeway 2 // Extra seconds duration to leave hud messages visible (without priority), reduces transition flashes between different priority messages

src/utils/hud_manager.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ extern IGameEventSystem* g_gameEventSystem;
3232
extern CGlobalVars* GetGlobals();
3333

3434
CConVar<bool> g_cvarFixHudFlashing("cs2f_fix_hud_flashing", FCVAR_NONE, "Whether to fix hud flashing using a workaround, this BREAKS warmup so pick one or the other", false);
35+
CConVar<bool> g_cvarDisableHudOutsideRound("cs2f_disable_hud_outside_round", FCVAR_NONE, "Whether to disable hud messages that would flash when a round is not ongoing, since flashing fix cannot run then", false);
36+
CConVar<int> g_cvarHudDurationLeeway("cs2f_hud_duration_leeway", FCVAR_NONE, "Extra seconds duration to leave hud messages visible (without priority), reduces transition flashes between different priority messages", 2);
3537
static std::vector<std::shared_ptr<CHudMessage>> g_vecHudMessages;
3638

3739
bool ShouldDisplayForPlayer(ZEPlayerHandle hPlayer, EHudPriority ePriority)
@@ -48,13 +50,16 @@ bool ShouldDisplayForPlayer(ZEPlayerHandle hPlayer, EHudPriority ePriority)
4850

4951
void CreateHudMessage(std::shared_ptr<CHudMessage> pHudMessage)
5052
{
53+
if (g_cvarDisableHudOutsideRound.Get() && !g_pGameRules->m_bGameRestart())
54+
return;
55+
5156
IGameEvent* pEvent = g_gameEventManager->CreateEvent("show_survival_respawn_status");
5257

5358
if (!pEvent)
5459
return;
5560

5661
pEvent->SetString("loc_token", pHudMessage->GetMessage());
57-
pEvent->SetInt("duration", pHudMessage->GetDuration());
62+
pEvent->SetInt("duration", pHudMessage->GetDuration() + g_cvarHudDurationLeeway.Get());
5863
pEvent->SetInt("userid", -1);
5964

6065
INetworkMessageInternal* pMsg = g_pNetworkMessages->FindNetworkMessageById(GE_Source1LegacyGameEvent);
@@ -154,8 +159,8 @@ std::string EscapeHTMLSpecialCharacters(std::string strMsg)
154159
strMsg.replace(iPos, 1, "&amp;");
155160

156161
std::unordered_map<std::string, std::string> mapReplacements{
157-
{"<", "&lt;"},
158-
{">", "&gt;"},
162+
{"<", "&lt;" },
163+
{">", "&gt;" },
159164
{"\"", "&quot;"},
160165
{"\'", "&apos;"}
161166
};

src/zombiereborn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ void ZR_OnPlayerTakeDamage(CCSPlayerPawn* pVictimPawn, const CTakeDamageInfo* pI
16531653
auto flClassKnockback = 1.0f;
16541654
float flCashScale = g_cvarDamageCashScale.Get();
16551655

1656-
if(flCashScale > 0)
1656+
if (flCashScale > 0)
16571657
{
16581658
const auto pKillerController = pKillerPawn->GetOriginalController();
16591659
int money = pKillerController->m_pInGameMoneyServices->m_iAccount;

0 commit comments

Comments
 (0)