Added mp_halftime and fixed the behaviour of not flushing the round before a second player joins.
This commit is contained in:
parent
f78ece6005
commit
0eaf9f5bc3
5 changed files with 61 additions and 4 deletions
|
@ -87,6 +87,7 @@ enum {
|
|||
.float fProgressBar;
|
||||
|
||||
// Match specific fields
|
||||
int iRounds;
|
||||
int iWon_T;
|
||||
int iWon_CT;
|
||||
int iAlivePlayers_T;
|
||||
|
|
|
@ -130,6 +130,9 @@ void StartFrame( void ) {
|
|||
} else if ( iInGamePlayers == 0 ) {
|
||||
fGameState = GAME_INACTIVE;
|
||||
fGameTime = 0;
|
||||
iWon_T = 0;
|
||||
iWon_CT = 0;
|
||||
iRounds = 0;
|
||||
} else {
|
||||
Timer_Update(); // Timer that happens once players have started joining
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ Rules_Restart
|
|||
Loop through all ents and handle them
|
||||
=================
|
||||
*/
|
||||
void Rules_Restart( void ) {
|
||||
void Rules_Restart( int iWipe ) {
|
||||
iHostagesRescued = 0;
|
||||
|
||||
entity eOld = self;
|
||||
|
@ -104,13 +104,18 @@ void Rules_Restart( void ) {
|
|||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
self = eFind;
|
||||
|
||||
if ( self.health > 0 ) {
|
||||
if ( self.health > 0 && iWipe == FALSE ) {
|
||||
Spawn_RespawnClient( self.team );
|
||||
} else {
|
||||
Spawn_MakeSpectator();
|
||||
Spawn_CreateClient( self.fCharModel );
|
||||
}
|
||||
|
||||
Money_GiveTeamReward();
|
||||
if ( iWipe == FALSE ) {
|
||||
Money_GiveTeamReward();
|
||||
} else {
|
||||
self.fMoney = autocvar_mp_startmoney;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the corpses/items
|
||||
|
@ -202,10 +207,12 @@ void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
|
|||
Radio_BroadcastMessage( RADIO_ROUNDDRAW );
|
||||
}
|
||||
}
|
||||
|
||||
Money_QueTeamReward( iTeamWon, iMoneyReward );
|
||||
Timer_Begin( 5, GAME_END); // Round is over, 5 seconds til a new round starts
|
||||
|
||||
iBombPlanted = 0;
|
||||
iRounds++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -228,6 +235,40 @@ void Rules_TimeOver( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Rules_SwitchTeams
|
||||
|
||||
Happens rarely
|
||||
=================
|
||||
*/
|
||||
void Rules_SwitchTeams( void ) {
|
||||
int iCTW, iTW;
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( eFind.team == TEAM_CT ) {
|
||||
eFind.team = TEAM_T;
|
||||
eFind.fCharModel -= 4;
|
||||
} else if ( eFind.team == TEAM_T ) {
|
||||
eFind.team = TEAM_CT;
|
||||
eFind.fCharModel += 4;
|
||||
}
|
||||
forceinfokey( eFind, "*team", ftos( eFind.team ) );
|
||||
}
|
||||
|
||||
iCTW = iWon_CT;
|
||||
iTW = iWon_T;
|
||||
|
||||
iWon_T = iCTW;
|
||||
iWon_CT = iTW;
|
||||
|
||||
iCTW = iAlivePlayers_CT;
|
||||
iTW = iAlivePlayers_T;
|
||||
|
||||
iAlivePlayers_CT = iTW;
|
||||
iAlivePlayers_T = iCTW;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SPAWN: info_map_parameters
|
||||
|
|
|
@ -87,6 +87,7 @@ void Timer_Update( void ) {
|
|||
|
||||
// Okay, this means that timelimit is not the only deciding factor
|
||||
if ( autocvar_mp_winlimit > 0 && fGameState != GAME_OVER ) {
|
||||
// It really doesn't matter who won. Do some logging perhaps?
|
||||
if ( iWon_CT == autocvar_mp_winlimit ) {
|
||||
Timer_Begin( 5, GAME_OVER );
|
||||
} else if ( iWon_T == autocvar_mp_winlimit ) {
|
||||
|
@ -102,7 +103,18 @@ void Timer_Update( void ) {
|
|||
|
||||
if ( fGameState == GAME_COMMENCING || fGameState == GAME_END ) {
|
||||
if ( fGameTime <= 0 ) {
|
||||
Rules_Restart();
|
||||
if ( iWon_T == 0 && iWon_CT == 0 ) {
|
||||
Money_ResetTeamReward();
|
||||
Rules_Restart( TRUE );
|
||||
} else {
|
||||
if ( autocvar_mp_halftime == TRUE && ( autocvar_mp_winlimit / 2 == iRounds ) ) {
|
||||
Money_ResetTeamReward();
|
||||
Rules_SwitchTeams();
|
||||
Rules_Restart( TRUE );
|
||||
} else {
|
||||
Rules_Restart( FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
BIN
freecs/progs.dat
BIN
freecs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue