Skip to content

Commit 2ab2e0a

Browse files
committed
fix more tournament UI bugs
1 parent 31c7f37 commit 2ab2e0a

4 files changed

Lines changed: 47 additions & 7 deletions

File tree

src/game/client/tf/tf_hud_match_status.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "tf_match_description.h"
2626
#include "tf_hud_tournament.h"
2727
#include "tf_classmenu.h"
28+
#include "tf_hud_teamgoal_tournament.h"
2829
#include "tf_rating_data.h"
2930

3031
extern ConVar mp_winlimit;
@@ -45,11 +46,17 @@ bool ShouldUseMatchHUD()
4546
#ifdef TF2_OG
4647
return false;
4748
#else
48-
if (TFGameRules() && TFGameRules()->IsMannVsMachineMode())
49+
if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() )
4950
return false;
5051

52+
if ( TFGameRules() && TFGameRules()->IsCompetitiveGame() && !TFGameRules()->IsInPlay() )
53+
{
54+
return false;
55+
}
56+
5157
// TODO(mcoms): enforce this better
52-
if ( TFGameRules() && ( TFGameRules()->IsMatchTypeCompetitive() || TFGameRules()->IsEmulatingMatch() == 2 ) )
58+
C_TFPlayer* pTFPlayer = C_TFPlayer::GetLocalTFPlayer();
59+
if ( TFGameRules() && ( TFGameRules()->IsMatchTypeCompetitive() || TFGameRules()->IsEmulatingMatch() == 2 ) && pTFPlayer && pTFPlayer->GetTeamNumber() >= FIRST_GAME_TEAM )
5360
return true;
5461

5562
return tf_use_match_hud.GetBool();
@@ -484,6 +491,18 @@ void CTFHudMatchStatus::OnThink()
484491
{
485492
pKothHUD->InvalidateLayout( false, true );
486493
}
494+
495+
CHudTeamGoalTournament *pGoalHUD = GET_HUDELEMENT( CHudTeamGoalTournament );
496+
if ( pGoalHUD )
497+
{
498+
pGoalHUD->InvalidateLayout( false, true );
499+
}
500+
501+
CHudStopWatch *pStopWatchHUD = GET_HUDELEMENT( CHudStopWatch );
502+
if ( pStopWatchHUD )
503+
{
504+
pStopWatchHUD->InvalidateLayout( false, true );
505+
}
487506
}
488507

489508
// check for an active timer and turn the time panel on or off if we need to

src/game/client/tf/tf_hud_tournament.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ void CHudTournament::PreparePanel( void )
399399

400400
if ( m_bCountDownVisible )
401401
{
402-
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence(this, m_bCompetitiveMode ? "HudTournament_ShowTimerCompetitive" : "HudTournament_ShowTimerDefault", false);
402+
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, m_bCompetitiveMode || ( m_bReadyStatusMode && TFGameRules() && !TFGameRules()->IsMannVsMachineMode() ) ? "HudTournament_ShowTimerCompetitive" : "HudTournament_ShowTimerDefault", false );
403403
}
404404
else
405405
{
@@ -791,7 +791,7 @@ void CHudTournament::PerformLayout( void )
791791
}
792792
}
793793

794-
bool bShowTournamentConditions = !m_bCompetitiveMode && TFGameRules() && !TFGameRules()->IsMannVsMachineMode();
794+
bool bShowTournamentConditions = TFGameRules() && !TFGameRules()->IsCompetitiveGame();
795795

796796
// Hide some elements when in competitive mode
797797
if ( m_pTournamentConditionLabel )

src/game/server/tf/tf_player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ int CTFPlayer::CheckStrandedSpawn(void)
23492349
}
23502350

23512351
// or during pre-match / countdown
2352-
if ( !TFGameRules()->IsInPlay() || gpGlobals->curtime < TFGameRules()->GetPreroundCountdownTime() )
2352+
if ( !TFGameRules()->IsInPlay() || TFGameRules()->State_Get() == GR_STATE_PREROUND || gpGlobals->curtime < TFGameRules()->GetPreroundCountdownTime() )
23532353
{
23542354
return STRANDED_SPAWN_DETACHED;
23552355
}

src/game/shared/teamplayroundbased_gamerules.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ void CTeamplayRoundBasedRules::State_Think_RND_RUNNING( void )
19281928
CheckReadyRestart();
19291929

19301930
#ifdef TF_DLL
1931-
if ( !TFGameRules()->IsMannVsMachineMode() && IsInTournamentMode() && !TFGameRules()->IsCommunityGameMode() )
1931+
if ( !TFGameRules()->IsMannVsMachineMode() && IsInPreMatch() && !TFGameRules()->IsCommunityGameMode() )
19321932
{
19331933
if ( TFGameRules()->UsePlayerReadyStatusMode() )
19341934
{
@@ -1940,7 +1940,7 @@ void CTeamplayRoundBasedRules::State_Think_RND_RUNNING( void )
19401940
}
19411941
}
19421942
// if we entered tournament mode but we're stuck without waiting for teams, then let's fix that.
1943-
else if ( IsInWaitingForPlayers() && GetRoundRestartTime() <= 0 && mp_restartround.GetInt() <= 0 && mp_restartgame.GetInt() <= 0 && !mp_restartgame_immediate.GetBool() && !m_bAwaitingReadyRestart )
1943+
else if ( GetRoundRestartTime() <= 0 && mp_restartround.GetInt() <= 0 && mp_restartgame.GetInt() <= 0 && !mp_restartgame_immediate.GetBool() && !m_bAwaitingReadyRestart )
19441944
{
19451945
m_bAwaitingReadyRestart = true;
19461946
}
@@ -2775,6 +2775,27 @@ void CC_CH_TournamentRestart( void )
27752775
}
27762776
static ConCommand mp_tournament_restart("mp_tournament_restart", CC_CH_TournamentRestart, "Restart Tournament Mode on the current level." );
27772777

2778+
void CC_CH_TournamentRefresh( void )
2779+
{
2780+
if ( mp_tournament_allow_non_admin_restart.GetBool() == false )
2781+
{
2782+
if ( !UTIL_IsCommandIssuedByServerAdmin() )
2783+
return;
2784+
}
2785+
2786+
#ifdef TF_DLL
2787+
if ( TFGameRules() && ( TFGameRules()->IsMannVsMachineMode() ) )
2788+
return;
2789+
#endif // TF_DLL
2790+
2791+
CTeamplayRoundBasedRules* pRules = dynamic_cast<CTeamplayRoundBasedRules*>( GameRules() );
2792+
if ( pRules )
2793+
{
2794+
pRules->RestartTournament();
2795+
}
2796+
}
2797+
static ConCommand mp_tournament_legacy_refresh( "mp_tournament_stop_and_refresh", CC_CH_TournamentRefresh, "Refresh Tournament Mode on the current level, keeping the round largely intact. Provided for legacy mp_tournament_restart behavior." );
2798+
27782799
void CTeamplayRoundBasedRules::RestartTournament( void )
27792800
{
27802801
if ( IsInTournamentMode() == false )

0 commit comments

Comments
 (0)