Skip to content

Commit

Permalink
Don't want for 5 seconds on new map to start singleplayer match
Browse files Browse the repository at this point in the history
  • Loading branch information
IgeNiaI committed Feb 20, 2023
1 parent 559a3ef commit d25472b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/deathmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void DEATHMATCH_Tick( void )
if ( teamplay )
{
// Two players are here now, begin the countdown or warmup state
if ( TEAM_TeamsWithPlayersOn( ) > 1 && level.time >= TICRATE * 5 )
if ( TEAM_TeamsWithPlayersOn( ) > 1 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
// Warmup only in non lobby maps
if ( sv_deathmatchwarmup && !GAMEMODE_IsLobbyMap( ) )
Expand All @@ -130,7 +130,7 @@ void DEATHMATCH_Tick( void )
else
{
// Two players are here now, begin the countdown or warmup state
if ( GAME_CountActivePlayers( ) >= 2 && level.time >= TICRATE * 5 )
if ( GAME_CountActivePlayers( ) >= 2 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
// Warmup only in non lobby maps
if ( sv_deathmatchwarmup && !GAMEMODE_IsLobbyMap( ) )
Expand Down
2 changes: 1 addition & 1 deletion src/duel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void DUEL_Tick( void )
}

// Two players are here now, begin the countdown or warmup state
if ( DUEL_CountActiveDuelers( ) == 2 && level.time >= TICRATE * 5 )
if ( DUEL_CountActiveDuelers( ) == 2 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
// Warmup only in non lobby maps
if ( sv_duelwarmup && !GAMEMODE_IsLobbyMap( ) )
Expand Down
7 changes: 7 additions & 0 deletions src/gamemode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,13 @@ ULONG GAMEMODE_GetCurrentFlags( void )
return ( g_GameModes[g_CurrentGameMode].ulFlags );
}

//*****************************************************************************
//
bool GAMEMODE_IsNewMapStartMatchDelayOver( void )
{
return ( NETWORK_GetState() != NETSTATE_SERVER ) || ( level.time >= TICRATE * 5 );
}

//*****************************************************************************
//
char *GAMEMODE_GetShortName( GAMEMODE_e GameMode )
Expand Down
1 change: 1 addition & 0 deletions src/gamemode.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ void GAMEMODE_CondenseGameSettingBlock ( TArray<GAMESETTING_s> *pList );
void GAMEMODE_ParseGamemodeInfo( void );
ULONG GAMEMODE_GetFlags( GAMEMODE_e GameMode );
ULONG GAMEMODE_GetCurrentFlags( void );
bool GAMEMODE_IsNewMapStartMatchDelayOver( void );
char *GAMEMODE_GetShortName( GAMEMODE_e GameMode );
char *GAMEMODE_GetName( GAMEMODE_e GameMode );
char *GAMEMODE_GetF1Texture( GAMEMODE_e GameMode );
Expand Down
2 changes: 1 addition & 1 deletion src/invasion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ void INVASION_Tick( void )
}

// A player is here! Begin the countdown!
if ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) >= 1 && level.time >= TICRATE * 5 )
if ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) >= 1 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
if ( sv_invasioncountdowntime > 0 )
INVASION_StartFirstCountdown(( sv_invasioncountdowntime * TICRATE ) - 1 );
Expand Down
4 changes: 2 additions & 2 deletions src/lastmanstanding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void LASTMANSTANDING_Tick( void )
if ( lastmanstanding )
{
// Two players are here now, being the countdown!
if ( GAME_CountActivePlayers( ) >= 2 && level.time >= TICRATE * 5 )
if ( GAME_CountActivePlayers( ) >= 2 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
ULONG ulIdx;
bool nowarmup = false;
Expand Down Expand Up @@ -147,7 +147,7 @@ void LASTMANSTANDING_Tick( void )

if ( teamlms )
{
if ( TEAM_TeamsWithPlayersOn( ) > 1 && level.time >= TICRATE * 5 )
if ( TEAM_TeamsWithPlayersOn( ) > 1 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
// Warmup only in non lobby maps
if ( sv_lmswarmup && TEAM_GetHighestWinCount() <= 0 )
Expand Down
4 changes: 2 additions & 2 deletions src/possession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void POSSESSION_Tick( void )
if ( possession )
{
// Two players are here now, being the initial countdown!
if ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) >= 2 && level.time >= TICRATE * 5 )
if ( SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ) >= 2 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
if ( sv_possessioncountdowntime > 0 )
POSSESSION_StartCountdown(( sv_possessioncountdowntime * TICRATE ) - 1 );
Expand All @@ -121,7 +121,7 @@ void POSSESSION_Tick( void )

if ( teampossession )
{
if ( TEAM_TeamsWithPlayersOn( ) > 1 && level.time >= TICRATE * 5 )
if ( TEAM_TeamsWithPlayersOn( ) > 1 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
if ( sv_possessioncountdowntime > 0 )
POSSESSION_StartCountdown(( sv_possessioncountdowntime * TICRATE ) - 1 );
Expand Down
2 changes: 1 addition & 1 deletion src/survival.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void SURVIVAL_Tick( void )
}

// Someone is here! Begin the countdown.
if ( GAME_CountActivePlayers( ) > 0 && level.time >= TICRATE * 5 )
if ( GAME_CountActivePlayers( ) > 0 && GAMEMODE_IsNewMapStartMatchDelayOver() )
{
if ( sv_survivalcountdowntime > 0 )
SURVIVAL_StartCountdown(( sv_survivalcountdowntime * TICRATE ) - 1 );
Expand Down

0 comments on commit d25472b

Please sign in to comment.