/* ================= CheckExitRules There will be a delay between the time the exit is qualified for and the time everyone is moved to the intermission spot, so you can see the last frag. ================= */ void CheckExitRules( void ) { int i; gclient_t *cl; // if at the intermission, wait for all non-bots to // signal ready, then go to next level if ( level.intermissiontime ) { CheckIntermissionExit (); return; } if ( level.intermissionQueued ) { #ifdef MISSIONPACK int time = (g_singlePlayer.integer) ? SP_INTERMISSION_DELAY_TIME : INTERMISSION_DELAY_TIME; if ( level.time - level.intermissionQueued >= time ) { level.intermissionQueued = 0; BeginIntermission(); } #else if ( level.time - level.intermissionQueued >= INTERMISSION_DELAY_TIME ) { level.intermissionQueued = 0; BeginIntermission(); } #endif return; } // check for sudden death if ( ScoreIsTied() ) { // always wait for sudden death return; } if ( g_timelimit.integer && !level.warmupTime ) { if ( level.time - level.startTime >= g_timelimit.integer*60000 ) { trap_SendServerCommand( -1, "print \"Timelimit hit.\n\""); LogExit( "Timelimit hit." ); return; } } if ( g_gametype.integer < GT_CTF && g_fraglimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) { trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" ); LogExit( "Fraglimit hit." ); return; } if ( level.teamScores[TEAM_BLUE] >= g_fraglimit.integer ) { trap_SendServerCommand( -1, "print \"Blue hit the fraglimit.\n\"" ); LogExit( "Fraglimit hit." ); return; } for ( i=0 ; i< g_maxclients.integer ; i++ ) { cl = level.clients + i; if ( cl->pers.connected != CON_CONNECTED ) { continue; } if ( cl->sess.sessionTeam != TEAM_FREE ) { continue; } if ( cl->ps.persistant[PERS_SCORE] >= g_fraglimit.integer ) { LogExit( "Fraglimit hit." ); trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " hit the fraglimit.\n\"", cl->pers.netname ) ); return; } } } if ( g_gametype.integer >= GT_CTF && g_capturelimit.integer ) { if ( level.teamScores[TEAM_RED] >= g_capturelimit.integer ) { trap_SendServerCommand( -1, "print \"Red hit the capturelimit.\n\"" ); LogExit( "Capturelimit hit." ); return; } if ( level.teamScores[TEAM_BLUE] >= g_capturelimit.integer ) { trap_SendServerCommand( -1, "print \"Blue hit the capturelimit.\n\"" ); LogExit( "Capturelimit hit." ); return; } } }
/* ================= CheckExitRules There will be a delay between the time the exit is qualified for and the time everyone is moved to the intermission spot, so you can see the last frag. ================= */ void CheckExitRules() { // if at the intermission, wait for all non-bots to // signal ready, then go to next level if( theLevel.intermissiontime_ ) { CheckIntermissionExit (); return; } if( theLevel.intermissionQueued_ ) { if ( theLevel.time_ - theLevel.intermissionQueued_ >= INTERMISSION_DELAY_TIME ) { theLevel.intermissionQueued_ = 0; BeginIntermission(); } return; } // check for sudden death if( ScoreIsTied() ) { // always wait for sudden death return; } if( g_timelimit.integer && !theLevel.warmupTime_ ) { if( theLevel.time_ - theLevel.startTime_ >= g_timelimit.integer*60000 ) { SV_GameSendServerCommand( -1, "print \"Timelimit hit.\n\" \"<scoreboard>\""); LogExit( "Timelimit hit." ); return; } } if( theLevel.numPlayingClients_ < 2 ) return; if( g_gametype.integer < GT_CTF && g_fraglimit.integer ) { if( theLevel.teamScores_[ClientBase::TEAM_RED] >= g_fraglimit.integer ) { SV_GameSendServerCommand( -1, "print \"Red hit the fraglimit.\n\" \"<scoreboard>\"" ); LogExit( "Fraglimit hit." ); return; } if( theLevel.teamScores_[ClientBase::TEAM_BLUE] >= g_fraglimit.integer ) { SV_GameSendServerCommand( -1, "print \"Blue hit the fraglimit.\n\" \"<scoreboard>\"" ); LogExit( "Fraglimit hit." ); return; } for( int i=1 ; i<= g_maxclients.integer ; i++ ) { GameClient *cl = theLevel.getClient(i); if( !cl || cl->pers_.connected_ != GameClient::ClientPersistant::CON_CONNECTED ) continue; if( cl->sess_.sessionTeam_ != ClientBase::TEAM_FREE ) continue; if( cl->ps_.persistant[PERS_SCORE] >= g_fraglimit.integer ) { LogExit( "Fraglimit hit." ); SV_GameSendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " hit the fraglimit.\n\" \"<scoreboard>\"", cl->pers_.netname_ ) ); return; } } } if( g_gametype.integer >= GT_CTF && g_capturelimit.integer ) { if( theLevel.teamScores_[ClientBase::TEAM_RED] >= g_capturelimit.integer ) { SV_GameSendServerCommand( -1, "print \"Red hit the capturelimit.\n\" \"<scoreboard>\"" ); LogExit( "Capturelimit hit." ); return; } if( theLevel.teamScores_[ClientBase::TEAM_BLUE] >= g_capturelimit.integer ) { SV_GameSendServerCommand( -1, "print \"Blue hit the capturelimit.\n\" \"<scoreboard>\"" ); LogExit( "Capturelimit hit." ); return; } } }