//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::InputRoundSpawn( inputdata_t &input ) { if ( !m_bResetTimeOnRoundStart && ( m_nState == RT_STATE_NORMAL ) ) { m_nTimeToUseAfterSetupFinished = GetTimeRemaining(); } else { m_nTimeToUseAfterSetupFinished = m_nTimerInitialLength; } if ( m_nSetupTimeLength > 0 ) { SetTimeRemaining( m_nSetupTimeLength ); SetState( RT_STATE_SETUP ); if ( ShowInHud() && !TeamplayRoundBasedRules()->IsInWaitingForPlayers() ) { UTIL_LogPrintf( "World triggered \"Round_Setup_Begin\"\n" ); } } else { SetTimeRemaining( m_nTimeToUseAfterSetupFinished ); SetState( RT_STATE_NORMAL ); } if ( !m_bStartPaused && !TeamplayRoundBasedRules()->IsInWaitingForPlayers() ) { ResumeTimer(); } }
bool HealthCheckedConnection::Setup() { // setup the RX timeout ResumeTimer(); // send a heartbeat now and setup the TX timer SendHeartbeat(); HeartbeatSent(); return true; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::InputEnable( inputdata_t &input ) { m_bIsDisabled = false; ResumeTimer(); if ( m_bShowInHUD ) { SetActiveTimer( this ); } if ( IsStopWatchTimer() == true && IsWatchingTimeStamps() == true ) { m_flTimerEndTime = gpGlobals->curtime; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::RoundTimerThink( void ) { if ( TeamplayRoundBasedRules()->IsInPreMatch() == true && IsDisabled() == false ) { inputdata_t data; InputDisable( data ); } if ( IsDisabled() || m_bTimerPaused || IsInCommentaryMode() || gpGlobals->eLoadType == MapLoad_Background ) { SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); return; } // Don't do anything when the game has been won or if we're loading a bugbait report if ( TeamplayRoundBasedRules()->RoundHasBeenWon() || TeamplayRoundBasedRules()->IsLoadingBugBaitReport() ) { // We want to stop timers when the round has been won, but we don't want to // force mapmakers to deal with having to unpause it. This little hack works around that. if ( !m_bTimerPaused ) { PauseTimer(); m_bPauseDueToWin = true; } SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); return; } else if ( m_bPauseDueToWin ) { ResumeTimer(); m_bPauseDueToWin = false; } float flTime = GetTimeRemaining(); if ( flTime > 0 && ShowInHud() ) // is this the timer we're showing in the HUD? { TeamplayRoundBasedRules()->SetOvertime( false ); } if ( flTime <= 0.0f && m_bFireFinished ) { // Allow the gamerules to prevent timer expiration (i.e. while a control point is contested) if ( !TeamplayGameRules()->TimerMayExpire() ) { // we don't want the timer to keep going (negative time) m_flTimerEndTime = gpGlobals->curtime; // is this the timer we're showing in the HUD? if ( ShowInHud() ) { TeamplayRoundBasedRules()->SetOvertime( true ); } // Think slower SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 1.0, ROUND_TIMER_THINK ); return; } m_OnFinished.FireOutput( this, this ); m_bFireFinished = false; } else if ( flTime <= 300.0 && m_bFire5MinRemain ) { m_On5MinRemain.FireOutput( this, this ); m_bFire5MinRemain = false; } else if ( flTime <= 240.0 && m_bFire4MinRemain ) { m_On4MinRemain.FireOutput( this, this ); m_bFire4MinRemain = false; } else if ( flTime <= 180.0 && m_bFire3MinRemain ) { m_On3MinRemain.FireOutput( this, this ); m_bFire3MinRemain = false; } else if ( flTime <= 120.0 && m_bFire2MinRemain ) { m_On2MinRemain.FireOutput( this, this ); m_bFire2MinRemain = false; } else if ( flTime <= 60.0 && m_bFire1MinRemain ) { m_On1MinRemain.FireOutput( this, this ); m_bFire1MinRemain = false; } else if ( flTime <= 30.0 && m_bFire30SecRemain ) { m_On30SecRemain.FireOutput( this, this ); m_bFire30SecRemain = false; } else if ( flTime <= 10.0 && m_bFire10SecRemain ) { m_On10SecRemain.FireOutput( this, this ); m_bFire10SecRemain = false; } else if ( flTime <= 5.0 && m_bFire5SecRemain ) { m_On5SecRemain.FireOutput( this, this ); m_bFire5SecRemain = false; } else if ( flTime <= 4.0 && m_bFire4SecRemain ) { m_On4SecRemain.FireOutput( this, this ); m_bFire4SecRemain = false; } else if ( flTime <= 3.0 && m_bFire3SecRemain ) { m_On3SecRemain.FireOutput( this, this ); m_bFire3SecRemain = false; } else if ( flTime <= 2.0 && m_bFire2SecRemain ) { m_On2SecRemain.FireOutput( this, this ); m_bFire2SecRemain = false; } else if ( flTime <= 1.0 && m_bFire1SecRemain ) { m_On1SecRemain.FireOutput( this, this ); m_bFire1SecRemain = false; } SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::InputResume( inputdata_t &input ) { ResumeTimer(); }