diff options
| author | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
|---|---|---|
| committer | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
| commit | 55ed12f8d1eb6887d348be03aee5573d44177ffb (patch) | |
| tree | 3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/game/shared/teamplay_round_timer.cpp | |
| parent | * Added support for Visual C++ 2013 Express to VPC (diff) | |
| download | source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip | |
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/game/shared/teamplay_round_timer.cpp')
| -rw-r--r-- | mp/src/game/shared/teamplay_round_timer.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
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 ); } |