Skip to content

Commit eaad7ff

Browse files
committed
1 parent ebdd941 commit eaad7ff

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/game/client/tf/tf_hud_tournament.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,15 @@ void AddSubKeyNamed( KeyValues *pKeys, const char *pszName );
5151

5252
using namespace vgui;
5353

54+
#ifdef BDSBASE
55+
#define TOURNAMENT_PANEL_OVERFLOW_THRESHOLD 9
56+
#endif
5457
#define TOURNAMENT_PANEL_UPDATE_INTERVAL 0.25f
5558

59+
#ifdef BDSBASE
60+
ConVar cl_hud_tournament_always_centered("cl_hud_tournament_always_centered", "0", FCVAR_ARCHIVE, "Ensure that the client is always visible within the tournament HUD.");
61+
#endif
62+
5663
extern ConVar mp_timelimit;
5764
extern ConVar mp_winlimit;
5865
extern ConVar mp_maxrounds;
@@ -927,6 +934,24 @@ void CHudTournament::RecalculatePlayerPanels( void )
927934
}
928935
}
929936

937+
#ifdef BDSBASE
938+
if (cl_hud_tournament_always_centered.GetBool())
939+
{
940+
if (iPanel > TOURNAMENT_PANEL_OVERFLOW_THRESHOLD)
941+
{
942+
// Get a point close enough to the middle.
943+
int middlePoint = RoundInt(iPanel / 2);
944+
945+
// Switch player locations so that the client is visible once again.
946+
CTFPlayerPanel* middlePanel = GetOrAddPanel(middlePoint);
947+
middlePanel->SetPlayerIndex(pPlayer->entindex());
948+
949+
CTFPlayerPanel* clientPanel = GetOrAddPanel(pPlayer->entindex());
950+
clientPanel->SetPlayerIndex(middlePoint);
951+
}
952+
}
953+
#endif
954+
930955
// Clear out any extra panels
931956
for ( int i = iPanel; i < m_PlayerPanels.Count(); i++ )
932957
{

0 commit comments

Comments
 (0)