Skip to content

Commit d9d4df1

Browse files
committed
perf: optimize HUD updates
1 parent a25d3a1 commit d9d4df1

15 files changed

+91
-69
lines changed

src/game/client/hud_controlpointicons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ void CControlPointIcon::PerformLayout( void )
551551
if ( m_pCapNumPlayers )
552552
{
553553
m_pCapNumPlayers->SetVisible( (iPlayers>1) );
554-
SetDialogVariable( "numcappers", iPlayers );
554+
SetDialogVariable( "numcappers", iPlayers, false );
555555

556556
m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) );
557557
}

src/game/client/tf/tf_hud_escort.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ void CTFHudEscort::UpdateAlarmAnimations( void )
696696
void CTFHudEscort::OnTick()
697697
{
698698
// don't need to do this on non-escort maps (unless we're trying to override the HUD type)
699-
if ( TFGameRules() && ( TFGameRules()->GetGameType() != TF_GAMETYPE_ESCORT ) && ( TFGameRules()->GetHUDType() != TF_HUDTYPE_ESCORT ) )
699+
if ( !TFGameRules() || ( TFGameRules()->GetGameType() != TF_GAMETYPE_ESCORT ) && ( TFGameRules()->GetHUDType() != TF_HUDTYPE_ESCORT ) )
700700
return;
701701

702702
if ( !BaseClass::IsVisible() ) // intentionally skipping our version of IsVisible() to bypass the !m_bHaveValidPointPositions check
@@ -831,14 +831,14 @@ void CTFHudEscort::OnTick()
831831
if ( flSecondsToRecede > 0.0f && flSecondsToRecede <= TF_ESCORT_RECEDE_COUNTDOWN )
832832
{
833833
int iDisplaySeconds = (int)( flSecondsToRecede ) + 1;
834-
m_pEscortItemPanel->SetDialogVariable( "recede", VarArgs( "%d", iDisplaySeconds ) );
834+
m_pEscortItemPanel->SetDialogVariable( "recede", VarArgs( "%d", iDisplaySeconds ), false );
835835

836836
// we should not be showing the blocked image if we're showing the countdown
837837
m_pBlocked->SetVisible( false );
838838
}
839839
else
840840
{
841-
m_pEscortItemPanel->SetDialogVariable( "recede", "" );
841+
m_pEscortItemPanel->SetDialogVariable( "recede", "", false );
842842
}
843843

844844
// Debug string

src/game/client/tf/tf_hud_flagstatus.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -641,37 +641,37 @@ void CTFHudFlagObjectives::OnTick()
641641
}
642642

643643
// are we playing captures for rounds?
644-
if ( !TFGameRules() || ( !TFGameRules()->IsPlayingHybrid_CTF_CP() && !TFGameRules()->IsPlayingSpecialDeliveryMode() && !TFGameRules()->IsMannVsMachineMode() ) )
644+
if ( TFGameRules() && ( !TFGameRules()->IsPlayingHybrid_CTF_CP() && !TFGameRules()->IsPlayingSpecialDeliveryMode() && !TFGameRules()->IsMannVsMachineMode() ) )
645645
{
646646
if ( tf_flag_caps_per_round.GetInt() > 0 )
647647
{
648648
C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE );
649649
if ( pTeam )
650650
{
651-
SetDialogVariable( "bluescore", pTeam->GetFlagCaptures() );
651+
SetDialogVariable( "bluescore", pTeam->GetFlagCaptures(), false );
652652
}
653653

654654
pTeam = GetGlobalTFTeam( TF_TEAM_RED );
655655
if ( pTeam )
656656
{
657-
SetDialogVariable( "redscore", pTeam->GetFlagCaptures() );
657+
SetDialogVariable( "redscore", pTeam->GetFlagCaptures(), false );
658658
}
659659

660660
SetPlayingToLabelVisible( true );
661-
SetDialogVariable( "rounds", tf_flag_caps_per_round.GetInt() );
661+
SetDialogVariable( "rounds", tf_flag_caps_per_round.GetInt(), false );
662662
}
663663
else // we're just playing straight score
664664
{
665665
C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE );
666666
if ( pTeam )
667667
{
668-
SetDialogVariable( "bluescore", pTeam->Get_Score() );
668+
SetDialogVariable( "bluescore", pTeam->Get_Score(), false );
669669
}
670670

671671
pTeam = GetGlobalTFTeam( TF_TEAM_RED );
672672
if ( pTeam )
673673
{
674-
SetDialogVariable( "redscore", pTeam->Get_Score() );
674+
SetDialogVariable( "redscore", pTeam->Get_Score(), false );
675675
}
676676

677677
SetPlayingToLabelVisible( false );

src/game/client/tf/tf_hud_itemeffectmeter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ void CHudItemEffectMeter::Update( C_TFPlayer* pPlayer, const char* pSoundScript
451451
{
452452
if ( ShowPercentSymbol() )
453453
{
454-
SetDialogVariable( "progresscount", VarArgs( "%d%%", iCount ) );
454+
SetDialogVariable( "progresscount", VarArgs( "%d%%", iCount ), false );
455455
}
456456
else
457457
{
458-
SetDialogVariable( "progresscount", iCount );
458+
SetDialogVariable( "progresscount", iCount, false );
459459
}
460460
}
461461

src/game/client/tf/tf_hud_mann_vs_machine_status.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ void CInWorldCurrencyStatus::OnTick( void )
11231123

11241124
char szTmp[16];
11251125
Q_snprintf( szTmp, ARRAYSIZE( szTmp ), "$%d", nWorldMoney );
1126-
SetDialogVariable( "currency", szTmp );
1126+
SetDialogVariable( "currency", szTmp, false );
11271127
}
11281128
//-----------------------------------------------------------------------------
11291129
// Purpose:

src/game/client/tf/tf_hud_passtime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ void CTFHudTeamScore::OnTick()
218218
tf_passtime_scores_per_round.GetInt() );
219219
}
220220

221-
SetDialogVariable( "bluescore", iBlueScore );
222-
SetDialogVariable( "redscore", iRedScore );
221+
SetDialogVariable( "bluescore", iBlueScore, false );
222+
SetDialogVariable( "redscore", iRedScore, false );
223223
}
224224

225225
//-----------------------------------------------------------------------------

src/game/client/tf/tf_hud_playerstatus.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,11 @@ void CTFHudPlayerHealth::SetHealth( int iNewHealth, int iMaxHealth, int iMaxBuff
866866
// set our health display value
867867
if ( m_nHealth > 0 )
868868
{
869-
SetDialogVariable( "Health", m_nHealth );
869+
SetDialogVariable( "Health", m_nHealth, false );
870870
}
871871
else
872872
{
873-
SetDialogVariable( "Health", "" );
873+
SetDialogVariable( "Health", "", false );
874874
}
875875
}
876876

src/game/client/tf/tf_hud_robot_destruction_status.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ void CTFHUDRobotDestruction::OnTick()
564564
if ( !pRoboLogic )
565565
return;
566566

567-
m_pRedScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_RED ) );
568-
m_pBlueScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_BLUE ) );
567+
m_pRedScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_RED ), false );
568+
m_pBlueScoreValueContainer->SetDialogVariable( "score", pRoboLogic->GetScore( TF_TEAM_BLUE ), false );
569569

570570
#ifdef STAGING_ONLY
571571
if ( rd_hud_test_bars.GetBool() )
@@ -576,8 +576,8 @@ void CTFHUDRobotDestruction::OnTick()
576576
m_pBlueProgressBarEscrow->SetProgress( 0.f, true );
577577
m_pRedProgressBarEscrow->SetProgress( 0.f, true );
578578

579-
m_pRedScoreValueContainer->SetDialogVariable( "score", flProgress );
580-
m_pBlueScoreValueContainer->SetDialogVariable( "score", flProgress );
579+
m_pRedScoreValueContainer->SetDialogVariable( "score", flProgress, false );
580+
m_pBlueScoreValueContainer->SetDialogVariable( "score", flProgress, false );
581581
}
582582
else
583583
#endif
@@ -601,8 +601,8 @@ void CTFHUDRobotDestruction::OnTick()
601601

602602
if ( m_pProgressBarsContainer )
603603
{
604-
m_pProgressBarsContainer->SetDialogVariable( "red_escrow", nRedEscrow );
605-
m_pProgressBarsContainer->SetDialogVariable( "blue_escrow", nBlueEscrow );
604+
m_pProgressBarsContainer->SetDialogVariable( "red_escrow", nRedEscrow, false );
605+
m_pProgressBarsContainer->SetDialogVariable( "blue_escrow", nBlueEscrow, false );
606606
}
607607

608608
// update the team leader image
@@ -780,7 +780,7 @@ void CTFHUDRobotDestruction::OnTick()
780780
}
781781

782782
SetPlayingToLabelVisible( true );
783-
SetDialogVariable( "rounds", pRoboLogic->GetMaxPoints() );
783+
SetDialogVariable( "rounds", pRoboLogic->GetMaxPoints(), false );
784784
// HACK! Fix the events
785785
UpdateCarriedFlagStatus( NULL, NULL );
786786
}
@@ -867,7 +867,7 @@ void CTFHUDRobotDestruction::UpdateStolenPoints( int nTeam, EditablePanel* pCont
867867
}
868868
// Show the stolen panels if the stolen score is anything
869869
pContainer->SetVisible( nStolenPoints > 0 );
870-
pContainer->SetDialogVariable( "intelvalue", nStolenPoints );
870+
pContainer->SetDialogVariable( "intelvalue", nStolenPoints, false );
871871
}
872872

873873
// Find our stolen flag
@@ -949,7 +949,7 @@ void CTFHUDRobotDestruction::UpdateCarriedFlagStatus( C_BasePlayer *pNewOwner /*
949949
if ( pPlayerFlag && !pPlayerFlag->IsMarkedForDeletion() && !pPlayerFlag->IsDormant() )
950950
{
951951
m_pCarriedContainer->SetVisible( true );
952-
m_pCarriedContainer->SetDialogVariable( "flagvalue", pPlayerFlag->GetPointValue() );
952+
m_pCarriedContainer->SetDialogVariable( "flagvalue", pPlayerFlag->GetPointValue(), false );
953953
// make sure the panels are on, set the initial alpha values,
954954
// set the color of the flag we're carrying, and start the animations
955955
if ( m_pCarriedImage && !m_pCarriedImage->IsVisible() )

src/game/client/tf/tf_hud_target_id.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ void CTargetID::UpdateID( void )
10161016
if ( m_pMoveableSubPanel->IsVisible() )
10171017
{
10181018
const char *pBoundKey = engine->Key_LookupBinding( pszActionCommand );
1019-
m_pMoveableSubPanel->SetDialogVariable( "movekey", pBoundKey );
1019+
m_pMoveableSubPanel->SetDialogVariable( "movekey", pBoundKey, false );
10201020
}
10211021

10221022
if ( m_pMoveableIcon )
@@ -1060,7 +1060,7 @@ void CTargetID::UpdateID( void )
10601060
m_pTargetNameLabel->SetFgColor( colorName );
10611061

10621062
// TODO: Support if( hud_centerid.GetInt() == 0 )
1063-
SetDialogVariable( "targetname", sIDString );
1063+
SetDialogVariable( "targetname", sIDString, false );
10641064
}
10651065
else
10661066
{
@@ -1075,7 +1075,7 @@ void CTargetID::UpdateID( void )
10751075
m_pTargetDataLabel->SetVisible(true);
10761076
m_pTargetDataLabel->SetFgColor( colorData );
10771077

1078-
SetDialogVariable( "targetdata", sDataString );
1078+
SetDialogVariable( "targetdata", sDataString, false );
10791079
}
10801080
else
10811081
{

src/game/client/tf/tf_hud_tournament.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ void CHudTournament::PreparePanel( void )
303303
pszLabelText = "Tournament_Instructions_Waiting";
304304
}
305305

306-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( pszLabelText ) );
307-
SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeam" ) );
306+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( pszLabelText ), false );
307+
SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeam" ), false );
308308
SetPlayerPanelsVisible( true );
309309
m_pModeImage->SetVisible( m_bCompetitiveMode );
310310
}
311311
else
312312
{
313-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions" ) );
314-
SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeams" ) );
313+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions" ), false );
314+
SetDialogVariable( "tournamentstatelabel", g_pVGuiLocalize->Find( "Tournament_WaitingForTeams" ), false );
315315
SetPlayerPanelsVisible( false );
316316
m_pModeImage->SetVisible( false );
317317
}
@@ -337,36 +337,36 @@ void CHudTournament::PreparePanel( void )
337337
if ( pFormatString )
338338
{
339339
g_pVGuiLocalize->ConstructString_safe( szCountdown, pFormatString, 1, wzVal );
340-
SetDialogVariable( "tournamentstatelabel", szCountdown );
340+
SetDialogVariable( "tournamentstatelabel", szCountdown, false );
341341
}
342342

343343
if ( bAutoReady )
344344
{
345-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) );
345+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false );
346346
m_pModeImage->SetVisible( false );
347347
SetPlayerPanelsVisible( false );
348348
}
349349
else if ( nTime <= TOURNAMENT_NOCANCEL_TIME )
350350
{
351-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) );
351+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false );
352352
}
353353
else
354354
{
355355
if ( m_bReadyStatusMode )
356356
{
357357
if ( bSteamController )
358358
{
359-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready_NoKeyHintText" ) );
359+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready_NoKeyHintText" ), false );
360360
bShowReadyHintIcon = true;
361361
}
362362
else
363363
{
364-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready" ) );
364+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "Tournament_Instructions_Ready" ), false );
365365
}
366366
}
367367
else
368368
{
369-
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ) );
369+
SetDialogVariable( "readylabel", g_pVGuiLocalize->Find( "" ), false );
370370
}
371371
}
372372

@@ -415,13 +415,13 @@ void CHudTournament::PreparePanel( void )
415415
#endif
416416

417417
C_TFTeam *pBlueTeam = GetGlobalTFTeam( TF_TEAM_BLUE );
418-
SetDialogVariable( "bluenamelabel", pBlueTeam ? pBlueTeam->Get_Localized_Name() : L"BLU" );
418+
SetDialogVariable( "bluenamelabel", pBlueTeam ? pBlueTeam->Get_Localized_Name() : L"BLU", false );
419419

420420
C_TFTeam *pRedTeam = GetGlobalTFTeam( TF_TEAM_RED );
421-
SetDialogVariable( "rednamelabel", pRedTeam ? pRedTeam->Get_Localized_Name() : L"RED" );
421+
SetDialogVariable( "rednamelabel", pRedTeam ? pRedTeam->Get_Localized_Name() : L"RED", false );
422422

423-
SetDialogVariable( "bluestate", TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ) );
424-
SetDialogVariable( "redstate", TFGameRules()->IsTeamReady( TF_TEAM_RED ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ) );
423+
SetDialogVariable( "bluestate", TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ), false );
424+
SetDialogVariable( "redstate", TFGameRules()->IsTeamReady( TF_TEAM_RED ) ? g_pVGuiLocalize->Find( "Tournament_TeamReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamNotReady" ), false );
425425

426426
if ( m_bTeamReady[TF_TEAM_BLUE] != TFGameRules()->IsTeamReady( TF_TEAM_BLUE ) || m_bTeamReady[TF_TEAM_RED] != TFGameRules()->IsTeamReady( TF_TEAM_RED ) )
427427
{
@@ -479,7 +479,7 @@ void CHudTournament::PreparePanel( void )
479479
_snwprintf( szWindConditions, ARRAYSIZE( szWindConditions ), STRING_FMT STRING_FMT, szWindConditions, g_pVGuiLocalize->Find( "Tournament_WinConditionsNone" ) );
480480
}
481481

482-
SetDialogVariable( "winconditions", szWindConditions );
482+
SetDialogVariable( "winconditions", szWindConditions, false );
483483
}
484484

485485
//-----------------------------------------------------------------------------
@@ -1203,7 +1203,7 @@ void CHudTournamentSetup::OnTick( void )
12031203
m_pNameEntry->SetText( ( iLocalTeam == TF_TEAM_BLUE ) ? mp_tournament_blueteamname.GetString() : mp_tournament_redteamname.GetString() );
12041204
}
12051205

1206-
SetDialogVariable( "tournamentstatelabel", TFGameRules()->IsTeamReady( iLocalTeam ) ? g_pVGuiLocalize->Find( "Tournament_TeamSetupReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamSetupNotReady" ) );
1206+
SetDialogVariable( "tournamentstatelabel", TFGameRules()->IsTeamReady( iLocalTeam ) ? g_pVGuiLocalize->Find( "Tournament_TeamSetupReady" ) : g_pVGuiLocalize->Find( "Tournament_TeamSetupNotReady" ), false );
12071207

12081208
m_flNextThink = gpGlobals->curtime + TOURNAMENT_PANEL_UPDATE_INTERVAL;
12091209
}
@@ -1435,7 +1435,7 @@ void CHudStopWatch::OnTick( void )
14351435

14361436
m_pStopWatchImage->SetImage( "../hud/ico_time_none" );
14371437

1438-
SetDialogVariable( "stopwatchlabel", g_pVGuiLocalize->Find( "Tournament_StopWatchNoCap" ) );
1438+
SetDialogVariable( "stopwatchlabel", g_pVGuiLocalize->Find( "Tournament_StopWatchNoCap" ), false );
14391439
}
14401440
else if ( TFGameRules()->GetStopWatchState() == STOPWATCH_RUNNING )
14411441
{
@@ -1476,8 +1476,8 @@ void CHudStopWatch::OnTick( void )
14761476
pszPoints = g_pVGuiLocalize->Find( "#Tournament_StopWatch_Points" );
14771477
}
14781478

1479-
SetDialogVariable( "pointslabel", pszPoints );
1480-
SetDialogVariable( "scoretobeat", wzScoreVal );
1479+
SetDialogVariable( "pointslabel", pszPoints, false );
1480+
SetDialogVariable( "scoretobeat", wzScoreVal, false );
14811481

14821482
wchar_t wzHelp[128];
14831483

@@ -1490,7 +1490,7 @@ void CHudStopWatch::OnTick( void )
14901490
g_pVGuiLocalize->ConstructString_safe( wzHelp, g_pVGuiLocalize->Find( "Tournament_StopWatch_TimeVictoryDefender" ), 1, pDefender->Get_Localized_Name() );
14911491
}
14921492

1493-
SetDialogVariable( "descriptionlabel", wzHelp );
1493+
SetDialogVariable( "descriptionlabel", wzHelp, false );
14941494

14951495
if ( pTimer && !pTimer->IsWatchingTimeStamps() )
14961496
{
@@ -1513,7 +1513,7 @@ void CHudStopWatch::OnTick( void )
15131513
m_pStopWatchDescriptionBG->SetVisible( false );
15141514
m_pStopWatchDescriptionLabel->SetVisible( false );
15151515

1516-
SetDialogVariable( "descriptionlabel", g_pVGuiLocalize->Find( "#Tournament_StopWatch_CapVictory" ) );
1516+
SetDialogVariable( "descriptionlabel", g_pVGuiLocalize->Find( "#Tournament_StopWatch_CapVictory" ), false );
15171517

15181518
m_pStopWatchImage->SetImage( "../hud/ico_time_60" );
15191519

@@ -1537,7 +1537,7 @@ void CHudStopWatch::OnTick( void )
15371537
g_pVGuiLocalize->ConstructString_safe( wzScoreVal, g_pVGuiLocalize->Find( "Tournament_StopWatchPointCaptureSpectator" ), 2, wzVal, iPoints == 1 ? g_pVGuiLocalize->Find( "#Tournament_StopWatch_Point" ) : g_pVGuiLocalize->Find( "#Tournament_StopWatch_Points" ) );
15381538
}
15391539

1540-
SetDialogVariable( "stopwatchlabel", wzScoreVal );
1540+
SetDialogVariable( "stopwatchlabel", wzScoreVal, false );
15411541
}
15421542
}
15431543
}

0 commit comments

Comments
 (0)