client: Add new ConVar "cl_hud_tournament_always_centered"
This new ConVar adds an additional pass to `CHudTournament::RecalculatePlayerPanels` that when enabled and past 9 defenders, will swap out our client with a player in the middle of the panel list, ensuring that we are once again visible. Useful for community MvM gamemodes utilizing above normal defender counts.
This commit is contained in:
parent
39f6dde8fb
commit
ef6768c716
|
|
@ -48,8 +48,11 @@ void AddSubKeyNamed( KeyValues *pKeys, const char *pszName );
|
|||
|
||||
using namespace vgui;
|
||||
|
||||
#define TOURNAMENT_PANEL_OVERFLOW_THRESHOLD 9
|
||||
#define TOURNAMENT_PANEL_UPDATE_INTERVAL 0.25f
|
||||
|
||||
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." );
|
||||
|
||||
extern ConVar mp_timelimit;
|
||||
extern ConVar mp_winlimit;
|
||||
extern ConVar mp_maxrounds;
|
||||
|
|
@ -890,6 +893,22 @@ void CHudTournament::RecalculatePlayerPanels( void )
|
|||
}
|
||||
}
|
||||
|
||||
if (cl_hud_tournament_always_centered.GetBool())
|
||||
{
|
||||
if (iPanel > TOURNAMENT_PANEL_OVERFLOW_THRESHOLD)
|
||||
{
|
||||
// Get a point close enough to the middle.
|
||||
int middlePoint = RoundInt(iPanel / 2);
|
||||
|
||||
// Switch player locations so that the client is visible once again.
|
||||
CTFPlayerPanel *middlePanel = GetOrAddPanel( middlePoint );
|
||||
middlePanel->SetPlayerIndex( pPlayer->entindex() );
|
||||
|
||||
CTFPlayerPanel *clientPanel = GetOrAddPanel( pPlayer->entindex() );
|
||||
clientPanel->SetPlayerIndex( middlePoint );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear out any extra panels
|
||||
for ( int i = iPanel; i < m_PlayerPanels.Count(); i++ )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue