Fixed the smoke-grenade smoke not clearing upon next round Changed in_rawinput to 0 for now, since it was causing problems Fixed the RadiusDamage function in regards to regular explosions Deleted the unnecessary lines trying to respect 'timelimit', which is deprecated afaik Changed the sizes of individual grenades so that they'll be thrown more easily across crates and corners Added an early preview of loading map overviews. They are not really usable and merely a work in progress on my end. They will be finished soon though.
106 lines
2.7 KiB
C
Executable file
106 lines
2.7 KiB
C
Executable file
/*
|
|
FreeCS Project
|
|
Copyright (C) 2016, 2017 Marco "eukara" Hladik
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
/*
|
|
=================
|
|
Timer_Begin
|
|
|
|
Initiates a new state timer
|
|
=================
|
|
*/
|
|
void Timer_Begin( float fTime, float fMode) {
|
|
if ( fMode == GAME_FREEZE ) {
|
|
fGameState = GAME_FREEZE;
|
|
} else if ( fMode == GAME_ACTIVE ) {
|
|
fGameState = GAME_ACTIVE;
|
|
} else if ( fMode == GAME_END ) {
|
|
fGameState = GAME_END;
|
|
} else if ( fMode == GAME_COMMENCING ) {
|
|
fGameState = GAME_COMMENCING;
|
|
}
|
|
|
|
fGameTime = fTime;
|
|
}
|
|
|
|
/*
|
|
=================
|
|
Timer_Update
|
|
|
|
Called once every frame to check the status of things
|
|
=================
|
|
*/
|
|
void Timer_Update( void ) {
|
|
static float fVoxTimer;
|
|
|
|
// This map has been played enough we think
|
|
if ( cvar( "mp_timelimit" ) > 0 ) {
|
|
if ( autocvar_sv_voxannounce == TRUE ) {
|
|
if ( fVoxTimer > time ) {
|
|
return;
|
|
}
|
|
|
|
float fTimeLeft = ( cvar( "mp_timelimit" ) * 60 ) - time;
|
|
for ( int i = 0; i <= 10; i++ ) {
|
|
if ( rint( fTimeLeft ) == ( i * 60 ) ) {
|
|
Vox_Broadcast( sprintf( "%s minutes remaining", Vox_TimeToString( fTimeLeft / 60 ) ) );
|
|
fVoxTimer = time + 10.0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( time >= ( cvar( "mp_timelimit" ) * 60 ) ) {
|
|
for ( int i = 0; i < iMapCycleCount; i++ ) {
|
|
if ( sMapCycle[ i ] == mapname ) {
|
|
if ( ( i + 1 ) < iMapCycleCount ) {
|
|
localcmd( sprintf( "changelevel %s\n", sMapCycle[ i + 1 ] ) );
|
|
return;
|
|
} else {
|
|
localcmd( sprintf( "changelevel %s\n", sMapCycle[ 0 ] ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( fGameState == GAME_INACTIVE ) {
|
|
return;
|
|
}
|
|
|
|
fGameTime -= frametime;
|
|
|
|
if ( fGameState == GAME_COMMENCING || fGameState == GAME_END ) {
|
|
if ( fGameTime <= 0 ) {
|
|
Rules_Restart();
|
|
}
|
|
return;
|
|
}
|
|
|
|
if ( ( fGameState == GAME_ACTIVE ) || ( fGameState == GAME_FREEZE ) ) {
|
|
if ( fGameTime <= 0 ) {
|
|
if ( fGameState == GAME_ACTIVE ) {
|
|
Rules_TimeOver();
|
|
Timer_Begin( 5, GAME_END); // Round is over, 5 seconds til a new round starts
|
|
} else {
|
|
Timer_Begin( autocvar_mp_roundtime * 60, GAME_ACTIVE ); // Unfreeze
|
|
Radio_StartMessage();
|
|
}
|
|
}
|
|
}
|
|
}
|