diff options
Diffstat (limited to 'src/game/g_main.c')
-rw-r--r-- | src/game/g_main.c | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c index dd258c13..82647557 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -128,6 +128,8 @@ vmCvar_t g_adminParseSay; vmCvar_t g_adminNameProtect; vmCvar_t g_adminTempBan; +vmCvar_t g_dretchPunt; + vmCvar_t g_privateMessages; vmCvar_t g_tag; @@ -157,7 +159,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse }, - { &g_friendlyFire, "g_friendlyFire", "0", CVAR_ARCHIVE, 0, qtrue }, + { &g_friendlyFire, "g_friendlyFire", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, { &g_friendlyFireAliens, "g_friendlyFireAliens", "0", CVAR_ARCHIVE, 0, qtrue }, { &g_friendlyFireHumans, "g_friendlyFireHumans", "0", CVAR_ARCHIVE, 0, qtrue }, { &g_friendlyBuildableFire, "g_friendlyBuildableFire", "0", CVAR_ARCHIVE, 0, qtrue }, @@ -234,6 +236,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_currentMap, "g_currentMap", "0", 0, 0, qfalse }, { &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse }, { &g_shove, "g_shove", "0.0", CVAR_ARCHIVE, 0, qfalse }, + { &g_mapConfigs, "g_mapConfigs", "", CVAR_ARCHIVE, 0, qfalse }, { NULL, "g_mapConfigsLoaded", "0", CVAR_ROM, 0, qfalse }, @@ -246,6 +249,8 @@ static cvarTable_t gameCvarTable[ ] = { &g_adminNameProtect, "g_adminNameProtect", "1", CVAR_ARCHIVE, 0, qfalse }, { &g_adminTempBan, "g_adminTempBan", "120", CVAR_ARCHIVE, 0, qfalse }, + { &g_dretchPunt, "g_dretchPunt", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_privateMessages, "g_privateMessages", "1", CVAR_ARCHIVE, 0, qfalse }, { &g_tag, "g_tag", "main", CVAR_INIT, 0, qfalse }, @@ -739,9 +744,9 @@ int QDECL SortRanks( const void *a, const void *b ) cb = &level.clients[ *(int *)b ]; // then sort by score - if( ca->ps.persistant[ PERS_SCORE ] > cb->ps.persistant[ PERS_SCORE ] ) + if( ca->pers.score > cb->pers.score ) return -1; - else if( ca->ps.persistant[ PERS_SCORE ] < cb->ps.persistant[ PERS_SCORE ] ) + else if( ca->pers.score < cb->pers.score ) return 1; else return 0; @@ -823,17 +828,42 @@ int G_PeekSpawnQueue( spawnQueue_t *sq ) /* ============ +G_SearchSpawnQueue + +Look to see if clientNum is already in the spawnQueue +============ +*/ +qboolean G_SearchSpawnQueue( spawnQueue_t *sq, int clientNum ) +{ + int i; + + for( i = 0; i < MAX_CLIENTS; i++ ) + { + if( sq->clients[ i ] == clientNum ) + return qtrue; + } + + return qfalse; +} + +/* +============ G_PushSpawnQueue Add an element to the back of the spawn queue ============ */ -void G_PushSpawnQueue( spawnQueue_t *sq, int clientNum ) +qboolean G_PushSpawnQueue( spawnQueue_t *sq, int clientNum ) { + // don't add the same client more than once + if( G_SearchSpawnQueue( sq, clientNum ) ) + return qfalse; + sq->back = QUEUE_PLUS1( sq->back ); sq->clients[ sq->back ] = clientNum; g_entities[ clientNum ].client->ps.pm_flags |= PMF_QUEUED; + return qtrue; } /* @@ -967,7 +997,7 @@ void G_SpawnClients( pTeam_t team ) clientNum = G_PeekSpawnQueue( sq ); ent = &g_entities[ clientNum ]; - if( ( spawn = SelectTremulousSpawnPoint( team, + if( ( spawn = G_SelectTremulousSpawnPoint( team, ent->client->pers.lastDeathLocation, spawn_origin, spawn_angles ) ) ) { @@ -1272,10 +1302,6 @@ and team change. void CalculateRanks( void ) { int i; - int rank; - int score; - int newScore; - gclient_t *cl; char P[ MAX_CLIENTS + 1 ] = {""}; int ff = 0; @@ -1340,30 +1366,6 @@ void CalculateRanks( void ) qsort( level.sortedClients, level.numConnectedClients, sizeof( level.sortedClients[ 0 ] ), SortRanks ); - // set the rank value for all clients that are connected and not spectators - rank = -1; - score = 0; - for( i = 0; i < level.numPlayingClients; i++ ) - { - cl = &level.clients[ level.sortedClients[ i ] ]; - newScore = cl->ps.persistant[ PERS_SCORE ]; - - if( i == 0 || newScore != score ) - { - rank = i; - // assume we aren't tied until the next client is checked - level.clients[ level.sortedClients[ i ] ].ps.persistant[ PERS_RANK ] = rank; - } - else - { - // we are tied with the previous client - level.clients[ level.sortedClients[ i - 1 ] ].ps.persistant[ PERS_RANK ] = rank; - level.clients[ level.sortedClients[ i ] ].ps.persistant[ PERS_RANK ] = rank; - } - - score = newScore; - } - // see if it is time to end the level CheckExitRules( ); @@ -1449,7 +1451,7 @@ void FindIntermissionPoint( void ) if( !ent ) { // the map creator forgot to put in an intermission point... - SelectSpawnPoint( vec3_origin, level.intermission_origin, level.intermission_angle ); + G_SelectSpawnPoint( vec3_origin, level.intermission_origin, level.intermission_angle ); } else { @@ -2358,7 +2360,6 @@ void G_RunFrame( int levelTime ) G_SpawnClients( PTE_ALIENS ); G_SpawnClients( PTE_HUMANS ); G_CalculateAvgPlayers( ); - G_UpdateZaps( msec ); // see if it is time to end the level CheckExitRules( ); @@ -2383,5 +2384,7 @@ void G_RunFrame( int levelTime ) trap_Cvar_Set( "g_listEntity", "0" ); } + + level.frameMsec = trap_Milliseconds(); } |