From 55ed12f8d1eb6887d348be03aee5573d44177ffb Mon Sep 17 00:00:00 2001 From: Michael Sartain Date: Thu, 2 Oct 2014 08:25:55 -0700 Subject: Updated the SDK with the latest code from the TF and HL2 branches. --- mp/src/game/shared/teamplay_round_timer.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'mp/src/game/shared/teamplay_round_timer.cpp') diff --git a/mp/src/game/shared/teamplay_round_timer.cpp b/mp/src/game/shared/teamplay_round_timer.cpp index f993749a..6c6ccb77 100644 --- a/mp/src/game/shared/teamplay_round_timer.cpp +++ b/mp/src/game/shared/teamplay_round_timer.cpp @@ -245,6 +245,7 @@ CTeamRoundTimer::CTeamRoundTimer( void ) m_bResetTimeOnRoundStart = false; m_nTimeToUseAfterSetupFinished = 0; m_flNextOvertimeNag = 0; + m_flLastTime = 0.f; #endif } @@ -781,6 +782,9 @@ void CTeamRoundTimer::SetTimerThink( int nType ) //----------------------------------------------------------------------------- void CTeamRoundTimer::RoundTimerSetupThink( void ) { + float flLastTime = m_flLastTime; + m_flLastTime = GetTimeRemaining(); + if ( TeamplayRoundBasedRules()->IsInPreMatch() == true && IsDisabled() == false ) { inputdata_t data; @@ -797,6 +801,22 @@ void CTeamRoundTimer::RoundTimerSetupThink( void ) float flTime = GetTimeRemaining(); TeamplayRoundBasedRules()->SetOvertime( false ); + if ( m_flLastTime > 0.f ) + { + int nLastSecond = floor( flLastTime ); + int nThisSecond = floor( flTime ); + + if ( nLastSecond != nThisSecond ) + { + IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_pre_round_time_left" ); + if ( event ) + { + event->SetInt( "time", nThisSecond ); + gameeventmanager->FireEvent( event ); + } + } + } + if ( flTime <= 0.0f && m_bFireFinished ) { IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_setup_finished" ); @@ -1291,14 +1311,14 @@ void CTeamRoundTimer::InputAddTeamTime( inputdata_t &input ) // get the team p = nexttoken( token, p, ' ' ); - if ( token ) + if ( token[0] ) { nTeam = Q_atoi( token ); } // get the time p = nexttoken( token, p, ' ' ); - if ( token ) + if ( token[0] ) { nSeconds = Q_atoi( token ); } -- cgit v1.2.3