//----------------------------------------------------------------------------- // Purpose: The act has started //----------------------------------------------------------------------------- void CInfoAct::StartAct( void ) { // FIXME: Should this change? // Don't allow two simultaneous acts if (g_hCurrentAct) { g_hCurrentAct->FinishAct( ); } // Set the global act to this g_hCurrentAct = this; m_flActStartedAt = gpGlobals->curtime; m_OnStarted.FireOutput( this, this ); // Do we have a timelimit? if ( m_flActTimeLimit ) { SetNextThink( gpGlobals->curtime + m_flActTimeLimit ); SetThink( ActThink ); } SetUpRespawnTimers(); // Tell all the clients CRelieableBroadcastRecipientFilter filter; UserMessageBegin( filter, "ActBegin" ); WRITE_BYTE( (byte)m_iActNumber ); WRITE_FLOAT( m_flActStartedAt ); MessageEnd(); // If we're not an intermission, clean up if ( !HasSpawnFlags( SF_ACT_INTERMISSION ) ) { CleanupOnActStart(); } // Cycle through all players and start the act for ( int i = 1; i <= gpGlobals->maxClients; i++ ) { CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)UTIL_PlayerByIndex( i ); if ( pPlayer ) { // Am I an intermission? if ( HasSpawnFlags( SF_ACT_INTERMISSION ) ) { StartIntermission( pPlayer ); } else { StartActOverlayTime( pPlayer ); } } } // Think again soon, to remove player locks if ( !HasSpawnFlags(SF_ACT_INTERMISSION) ) { SetNextThink( gpGlobals->curtime + MIN_ACT_OVERLAY_TIME ); SetThink( ActThinkEndActOverlayTime ); } }