//***************************************************************************** // void DUEL_Tick( void ) { // Not in duel mode. if ( duel == false ) return; switch ( g_DuelState ) { case DS_WAITINGFORPLAYERS: if ( NETWORK_GetState( ) == NETSTATE_CLIENT ) break; // Two players are here now, begin the countdown! if ( DUEL_CountActiveDuelers( ) == 2 ) { if ( sv_duelcountdowntime > 0 ) DUEL_StartCountdown(( sv_duelcountdowntime * TICRATE ) - 1 ); else DUEL_StartCountdown(( 10 * TICRATE ) - 1 ); } break; case DS_COUNTDOWN: if ( g_ulDuelCountdownTicks ) { g_ulDuelCountdownTicks--; // FIGHT! if (( g_ulDuelCountdownTicks == 0 ) && ( NETWORK_GetState( ) != NETSTATE_CLIENT )) DUEL_DoFight( ); // Play "3... 2... 1..." sounds. else if ( g_ulDuelCountdownTicks == ( 3 * TICRATE )) ANNOUNCER_PlayEntry( cl_announcer, "Three" ); else if ( g_ulDuelCountdownTicks == ( 2 * TICRATE )) ANNOUNCER_PlayEntry( cl_announcer, "Two" ); else if ( g_ulDuelCountdownTicks == ( 1 * TICRATE )) ANNOUNCER_PlayEntry( cl_announcer, "One" ); } break; } }
//***************************************************************************** // void JOINQUEUE_PlayerLeftGame( bool bWantPop ) { bool bPop = true; // If we're in a duel, revert to the "waiting for players" state. // [BB] But only do so if there are less then two duelers left (probably JOINQUEUE_PlayerLeftGame was called mistakenly). if ( duel && ( DUEL_CountActiveDuelers( ) < 2 ) ) DUEL_SetState( DS_WAITINGFORPLAYERS ); // If only one (or zero) person is left, go back to "waiting for players". if ( lastmanstanding ) { // Someone just won by default! if (( GAME_CountLivingAndRespawnablePlayers( ) == 1 ) && ( LASTMANSTANDING_GetState( ) == LMSS_INPROGRESS )) { LONG lWinner; lWinner = LASTMANSTANDING_GetLastManStanding( ); if ( lWinner != -1 ) { if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVER_Printf( PRINT_HIGH, "%s \\c-wins!\n", players[lWinner].userinfo.netname ); else { Printf( "%s \\c-wins!\n", players[lWinner].userinfo.netname ); if ( lWinner == consoleplayer ) ANNOUNCER_PlayEntry( cl_announcer, "YouWin" ); } // Give the winner a win. PLAYER_SetWins( &players[lWinner], players[lWinner].ulWins + 1 ); // Pause for five seconds for the win sequence. LASTMANSTANDING_DoWinSequence( lWinner ); } // Join queue will be popped upon state change. bPop = false; GAME_SetEndLevelDelay( 5 * TICRATE ); } else if ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) <= 1 ) LASTMANSTANDING_SetState( LMSS_WAITINGFORPLAYERS ); } if ( teamlms ) { // Someone just won by default! if (( LASTMANSTANDING_GetState( ) == LMSS_INPROGRESS ) && LASTMANSTANDING_TeamsWithAlivePlayersOn( ) <= 1) { LONG lWinner; lWinner = LASTMANSTANDING_TeamGetLastManStanding( ); if ( lWinner != -1 ) { if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVER_Printf( PRINT_HIGH, "%s \\c-wins!\n", TEAM_GetName( lWinner )); else { Printf( "%s \\c-wins!\n", TEAM_GetName( lWinner )); if ( players[consoleplayer].bOnTeam && ( lWinner == (LONG)players[consoleplayer].ulTeam )) ANNOUNCER_PlayEntry( cl_announcer, "YouWin" ); } // Give the team a win. TEAM_SetWinCount( lWinner, TEAM_GetWinCount( lWinner ) + 1, false ); // Pause for five seconds for the win sequence. LASTMANSTANDING_DoWinSequence( lWinner ); } // Join queue will be popped upon state change. bPop = false; GAME_SetEndLevelDelay( 5 * TICRATE ); } else if ( TEAM_TeamsWithPlayersOn( ) <= 1 ) LASTMANSTANDING_SetState( LMSS_WAITINGFORPLAYERS ); } // If we're in possession mode, revert to the "waiting for players" state // [BB] when there are less than two players now. if ( possession && ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) < 2 )) POSSESSION_SetState( PSNS_WAITINGFORPLAYERS ); if ( teampossession && ( TEAM_TeamsWithPlayersOn( ) <= 1 ) ) POSSESSION_SetState( PSNS_WAITINGFORPLAYERS ); // If we're in invasion mode, revert to the "waiting for players" state. if ( invasion && ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) < 1 )) INVASION_SetState( IS_WAITINGFORPLAYERS ); // If we're in survival co-op mode, revert to the "waiting for players" state. if ( survival && ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) < 1 )) SURVIVAL_SetState( SURVS_WAITINGFORPLAYERS ); // Potentially let one person join the game. if ( bPop && bWantPop ) JOINQUEUE_PopQueue( 1 ); }