diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_admin.c | 52 | ||||
-rw-r--r-- | src/game/g_cmds.c | 72 | ||||
-rw-r--r-- | src/game/g_main.c | 22 |
3 files changed, 72 insertions, 74 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index c71de228..baed7026 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -144,7 +144,7 @@ g_admin_cmd_t g_admin_cmds[ ] = "pass a vote currently taking place", "(^5a|h^7)" }, - + {"pause", G_admin_pause, qfalse, "pause", "Pause (or unpause) the game.", "" @@ -682,9 +682,9 @@ void G_admin_authlog( gentity_t *ent ) ent->client->pers.admin->flags, ( level ) ? level->flags : "" ); - G_LogPrintf( "AdminAuth: %i \"%s" S_COLOR_WHITE "\" \"%s" S_COLOR_WHITE - "\" [%d] (%s): %s\n", - ent - g_entities, ent->client->pers.netname, + G_LogPrintf( "AdminAuth: %i \"%s" S_COLOR_WHITE "\" \"%s" S_COLOR_WHITE + "\" [%d] (%s): %s\n", + ent - g_entities, ent->client->pers.netname, ent->client->pers.admin->name, ent->client->pers.admin->level, ent->client->pers.guid, aflags ); } @@ -699,12 +699,12 @@ static void admin_log( gentity_t *admin, char *cmd ) args--; G_LogPrintf( "AdminCmd: %i \"%s" S_COLOR_WHITE "\" " - "(\"%s" S_COLOR_WHITE "\") [%d]: %s %s\n", + "(\"%s" S_COLOR_WHITE "\") [%d]: %s %s\n", ( admin ) ? admin->s.clientNum : -1, name, ( admin && admin->client->pers.admin ) ? admin->client->pers.admin->name : name, - ( admin && admin->client->pers.admin ) ? + ( admin && admin->client->pers.admin ) ? admin->client->pers.admin->level : 0, cmd, ConcatArgs( args ) ); @@ -847,7 +847,7 @@ qboolean G_admin_ban_check( gentity_t *ent, char *reason, int rlen ) // 0 is for perm ban if( ban->expires != 0 && ban->expires <= t ) continue; - + if( !Q_stricmp( ban->guid, ent->client->pers.guid ) || ( !G_admin_permission( ent, ADMF_IMMUNITY ) && G_AddressCompare( &ban->ip, &ent->client->pers.ip ) ) ) @@ -1289,7 +1289,7 @@ qboolean G_admin_setlevel( gentity_t *ent ) if( level.clients[ i ].pers.connected == CON_DISCONNECTED ) continue; - if( matches && level.clients[ i ].pers.admin && + if( matches && level.clients[ i ].pers.admin && level.clients[ i ].pers.admin == a ) { vic = &g_entities[ i ]; @@ -2415,14 +2415,12 @@ qboolean G_admin_showbans( gentity_t *ent ) colorlen1 += 2; } - for( colorlen2 = j = 0; ban->banner[ j ]; j++ ) { if( Q_IsColorString( &ban->banner[ j ] ) ) colorlen2 += 2; } - ADMBP( va( "%4i %*s^7 %-15s %-8s %*s^7 %-10s\n \\__ %s\n", i + 1, max_name + colorlen1, @@ -2715,9 +2713,9 @@ qboolean G_admin_restart( gentity_t *ent ) trap_Argv( 1, layout, sizeof( layout ) ); // Figure out which argument is which - if( Q_stricmp( layout, "keepteams" ) && - Q_stricmp( layout, "keepteamslock" ) && - Q_stricmp( layout, "switchteams" ) && + if( Q_stricmp( layout, "keepteams" ) && + Q_stricmp( layout, "keepteamslock" ) && + Q_stricmp( layout, "switchteams" ) && Q_stricmp( layout, "switchteamslock" ) ) { if( !Q_stricmp( layout, "*BUILTIN*" ) || @@ -2732,16 +2730,16 @@ qboolean G_admin_restart( gentity_t *ent ) return qfalse; } } - else + else { layout[ 0 ] = '\0'; - trap_Argv( 1, teampref, sizeof( teampref ) ); + trap_Argv( 1, teampref, sizeof( teampref ) ); } } - - if( trap_Argc( ) > 2 ) - trap_Argv( 2, teampref, sizeof( teampref ) ); - + + if( trap_Argc( ) > 2 ) + trap_Argv( 2, teampref, sizeof( teampref ) ); + if( !Q_stricmpn( teampref, "keepteams", 9 ) ) { for( i = 0; i < g_maxclients.integer; i++ ) @@ -2755,7 +2753,7 @@ qboolean G_admin_restart( gentity_t *ent ) cl->sess.restartTeam = cl->pers.teamSelection; } - } + } else if( !Q_stricmpn( teampref, "switchteams", 11 ) ) { for( i = 0; i < g_maxclients.integer; i++ ) @@ -2769,10 +2767,10 @@ qboolean G_admin_restart( gentity_t *ent ) cl->sess.restartTeam = TEAM_ALIENS; else if(cl->pers.teamSelection == TEAM_ALIENS ) cl->sess.restartTeam = TEAM_HUMANS; - } + } } - - if( !Q_stricmp( teampref, "switchteamslock" ) || + + if( !Q_stricmp( teampref, "switchteamslock" ) || !Q_stricmp( teampref, "keepteamslock" ) ) trap_Cvar_Set( "g_lockTeamsAtStart", "1" ); @@ -2946,7 +2944,7 @@ qboolean G_admin_builder( gentity_t *ent ) continue; VectorSubtract( traceEnt->s.pos.trBase, log->origin, dist ); - if( VectorLengthSquared( dist ) < 2.0f ) + if( VectorLengthSquared( dist ) < 2.0f ) { char logid[ 20 ] = {""}; @@ -2962,7 +2960,7 @@ qboolean G_admin_builder( gentity_t *ent ) break; } } - if ( i == level.numBuildLogs ) + if( i == level.numBuildLogs ) ADMP( va( "^3builder: ^7%s not in build log, possibly a layout item\n", BG_Buildable( traceEnt->s.modelindex )->humanName ) ); } @@ -2974,9 +2972,9 @@ qboolean G_admin_builder( gentity_t *ent ) qboolean G_admin_pause( gentity_t *ent ) { - if( !level.pausedTime ) + if( !level.pausedTime ) { - AP( va( "print \"^3pause: ^7%s^7 paused the game.\n\"", + AP( va( "print \"^3pause: ^7%s^7 paused the game.\n\"", ( ent ) ? ent->client->pers.netname : "console" ) ); level.pausedTime = 1; trap_SendServerCommand( -1, "cp \"The game has been paused. Please wait.\"" ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 49bbe3f8..87165d13 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -373,7 +373,7 @@ void Cmd_Give_f( gentity_t *ent ) ent->client->boostedTime = level.time; } } - + if( Q_stricmp( name, "gas" ) == 0 ) { ent->client->ps.eFlags |= EF_POISONCLOUDED; @@ -836,8 +836,8 @@ void G_Say( gentity_t *ent, saymode_t mode, const char *chatText ) // check if blocked by g_specChat 0 if( ( !g_specChat.integer ) && ( mode != SAY_TEAM ) && - ( ent ) && ( ent->client->pers.teamSelection == TEAM_NONE ) && - ( !G_admin_permission( ent, ADMF_NOCENSORFLOOD ) ) ) + ( ent ) && ( ent->client->pers.teamSelection == TEAM_NONE ) && + ( !G_admin_permission( ent, ADMF_NOCENSORFLOOD ) ) ) { trap_SendServerCommand( ent-g_entities, "print \"say: Global chatting for " "spectators has been disabled. You may only use team chat.\n\"" ); @@ -909,14 +909,14 @@ static void Cmd_SayArea_f( gentity_t *ent ) num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); for( i = 0; i < num; i++ ) G_SayTo( ent, &g_entities[ entityList[ i ] ], SAY_AREA, msg ); - + //Send to ADMF_SPEC_ALLCHAT candidates for( i = 0; i < level.maxclients; i++ ) { if( g_entities[ i ].client->pers.teamSelection == TEAM_NONE && G_admin_permission( &g_entities[ i ], ADMF_SPEC_ALLCHAT ) ) { - G_SayTo( ent, &g_entities[ i ], SAY_AREA, msg ); + G_SayTo( ent, &g_entities[ i ], SAY_AREA, msg ); } } } @@ -1190,7 +1190,7 @@ void Cmd_CallVote_f( gentity_t *ent ) } if( team != TEAM_NONE && - ( ent->client->pers.teamSelection != + ( ent->client->pers.teamSelection != level.clients[ clientNum ].pers.teamSelection ) ) { trap_SendServerCommand( ent-g_entities, @@ -1203,7 +1203,7 @@ void Cmd_CallVote_f( gentity_t *ent ) trap_SendServerCommand( ent-g_entities, va( "print \"%s: You must provide a reason\n\"", cmd ) ); return; - } + } } } @@ -1224,7 +1224,7 @@ void Cmd_CallVote_f( gentity_t *ent ) if( reason[ 0 ] ) { Com_sprintf( level.voteDisplayString[ team ], - sizeof( level.voteDisplayString[ team ] ), "%s for '%s'", + sizeof( level.voteDisplayString[ team ] ), "%s for '%s'", level.voteDisplayString[ team ], reason ); } } @@ -1320,20 +1320,20 @@ void Cmd_CallVote_f( gentity_t *ent ) { if(!g_suddenDeathVotePercent.integer) { - trap_SendServerCommand( ent-g_entities, + trap_SendServerCommand( ent-g_entities, "print \"Sudden Death votes have been disabled\n\"" ); return; - } - if( G_TimeTilSuddenDeath( ) <= 0 ) + } + if( G_TimeTilSuddenDeath( ) <= 0 ) { - trap_SendServerCommand( ent - g_entities, + trap_SendServerCommand( ent - g_entities, va( "print \"callvote: Sudden Death has already begun\n\"") ); return; } if( level.suddenDeathBeginTime > 0 && G_TimeTilSuddenDeath() <= g_suddenDeathVoteDelay.integer * 1000 ) { - trap_SendServerCommand( ent - g_entities, + trap_SendServerCommand( ent - g_entities, va( "print \"callvote: Sudden Death is imminent\n\"") ); return; } @@ -1693,7 +1693,7 @@ void Cmd_Class_f( gentity_t *ent ) return; } } - + //check that we are not wallwalking if( ent->client->ps.eFlags & EF_WALLCLIMB ) { @@ -1795,7 +1795,7 @@ void Cmd_Destroy_f( gentity_t *ent ) ( ( ent->client->ps.weapon >= WP_ABUILD ) && ( ent->client->ps.weapon <= WP_HBUILD ) ) ) { - // Always let the builder prevent the explosion + // Always let the builder prevent the explosion if( traceEnt->health <= 0 ) { G_QueueBuildPoints( traceEnt ); @@ -1889,18 +1889,18 @@ void Cmd_ActivateItem_f( gentity_t *ent ) { char s[ MAX_TOKEN_CHARS ]; int upgrade, weapon; - + trap_Argv( 1, s, sizeof( s ) ); - + // "weapon" aliased to whatever weapon you have if( !Q_stricmp( "weapon", s ) ) { if( ent->client->ps.weapon == WP_BLASTER && BG_PlayerCanChangeWeapon( &ent->client->ps ) ) - G_ForceWeaponChange( ent, WP_NONE ); + G_ForceWeaponChange( ent, WP_NONE ); return; } - + upgrade = BG_UpgradeByName( s )->number; weapon = BG_WeaponByName( s )->number; @@ -2014,7 +2014,7 @@ void Cmd_Buy_f( gentity_t *ent ) G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOARMOURYHERE ); return; } - + if( weapon != WP_NONE ) { //already got this? @@ -2191,10 +2191,10 @@ void Cmd_Sell_f( gentity_t *ent ) if( weapon != WP_NONE ) { weapon_t selected = BG_GetPlayerWeapon( &ent->client->ps ); - + if( !BG_PlayerCanChangeWeapon( &ent->client->ps ) ) return; - + //are we /allowed/ to sell this? if( !BG_Weapon( weapon )->purchasable ) { @@ -2517,7 +2517,7 @@ void G_StopFollowing( gentity_t *ent ) if( ent->client->pers.teamSelection == TEAM_NONE ) { - ent->client->sess.spectatorState = + ent->client->sess.spectatorState = ent->client->ps.persistant[ PERS_SPECSTATE ] = SPECTATOR_FREE; } else @@ -2560,7 +2560,7 @@ void G_FollowLockView( gentity_t *ent ) { vec3_t spawn_origin, spawn_angles; int clientNum; - + clientNum = ent->client->sess.spectatorClient; ent->client->sess.spectatorState = ent->client->ps.persistant[ PERS_SPECSTATE ] = SPECTATOR_FOLLOW; @@ -2639,26 +2639,26 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir ) // can't follow a spectator if( level.clients[ clientnum ].pers.teamSelection == TEAM_NONE ) continue; - + // if stickyspec is disabled, can't follow someone in queue either if( !ent->client->pers.stickySpec && level.clients[ clientnum ].sess.spectatorState != SPECTATOR_NOT ) continue; - + // can only follow teammates when dead and on a team - if( ent->client->pers.teamSelection != TEAM_NONE && - ( level.clients[ clientnum ].pers.teamSelection != + if( ent->client->pers.teamSelection != TEAM_NONE && + ( level.clients[ clientnum ].pers.teamSelection != ent->client->pers.teamSelection ) ) continue; - + // this is good, we can use it ent->client->sess.spectatorClient = clientnum; ent->client->sess.spectatorState = SPECTATOR_FOLLOW; - + // if this client is in the spawn queue, we need to do something special if( level.clients[ clientnum ].sess.spectatorState != SPECTATOR_NOT ) G_FollowLockView( ent ); - + return qtrue; } while( clientnum != original ); @@ -2698,7 +2698,7 @@ void Cmd_Follow_f( gentity_t *ent ) { G_ToggleFollow( ent ); } - else + else { trap_Argv( 1, arg, sizeof( arg ) ); if( G_ClientNumbersFromString( arg, pids, MAX_CLIENTS ) == 1 ) @@ -2727,8 +2727,8 @@ void Cmd_Follow_f( gentity_t *ent ) return; // if not on team spectator, you can only follow teammates - if( ent->client->pers.teamSelection != TEAM_NONE && - ( level.clients[ i ].pers.teamSelection != + if( ent->client->pers.teamSelection != TEAM_NONE && + ( level.clients[ i ].pers.teamSelection != ent->client->pers.teamSelection ) ) return; @@ -3089,7 +3089,7 @@ void ClientCommand( int clientNum ) // do tests here to reduce the amount of repeated code - if( !( command->cmdFlags & CMD_INTERMISSION ) && + if( !( command->cmdFlags & CMD_INTERMISSION ) && ( level.intermissiontime || level.pausedTime ) ) return; @@ -3248,7 +3248,7 @@ void Cmd_PrivateMessage_f( gentity_t *ent ) // send the message for( i = 0; i < pcount; i++ ) - if( G_SayTo( ent, &g_entities[ pids[ i ] ], + if( G_SayTo( ent, &g_entities[ pids[ i ] ], teamonly ? SAY_TPRIVMSG : SAY_PRIVMSG, msg ) ) count++; diff --git a/src/game/g_main.c b/src/game/g_main.c index 6bdbdea9..4cb83552 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -246,7 +246,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_layouts, "g_layouts", "", CVAR_LATCH, 0, qfalse }, { &g_layoutAuto, "g_layoutAuto", "1", CVAR_ARCHIVE, 0, qfalse }, - + { &g_emoticonsAllowedInNames, "g_emoticonsAllowedInNames", "1", CVAR_LATCH|CVAR_ARCHIVE, 0, qfalse }, { &g_admin, "g_admin", "admin.dat", CVAR_ARCHIVE, 0, qfalse }, @@ -545,7 +545,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) t = trap_RealTime( &qt ); G_LogPrintf("RealTime: %04i/%02i/%02i %02i:%02i:%02i\n", - qt.tm_year+1900, qt.tm_mon+1, qt.tm_mday, + qt.tm_year+1900, qt.tm_mon+1, qt.tm_mday, qt.tm_hour, qt.tm_min, qt.tm_sec ); } @@ -634,7 +634,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) G_CountSpawns( ); G_UpdateTeamConfigStrings( ); - + if( g_lockTeamsAtStart.integer ) { level.alienTeamLocked = qtrue; @@ -1021,7 +1021,7 @@ void G_SpawnClients( team_t team ) /* ============ G_CountSpawns - + Counts the number of spawns for each team ============ */ @@ -1054,7 +1054,7 @@ G_TimeTilSuddenDeath #define SUDDENDEATHWARNING 60000 int G_TimeTilSuddenDeath( void ) { - if( ( !g_suddenDeathTime.integer && level.suddenDeathBeginTime==0 ) || + if( ( !g_suddenDeathTime.integer && level.suddenDeathBeginTime == 0 ) || ( level.suddenDeathBeginTime < 0 ) ) return SUDDENDEATHWARNING + 1; // Always some time away @@ -1107,7 +1107,7 @@ void G_CalculateBuildPoints( void ) else if( G_TimeTilSuddenDeath( ) <= SUDDENDEATHWARNING && level.suddenDeathWarning < TW_IMMINENT ) { - trap_SendServerCommand( -1, va( "cp \"Sudden Death in %d seconds!\"", + trap_SendServerCommand( -1, va( "cp \"Sudden Death in %d seconds!\"", (int)(G_TimeTilSuddenDeath() / 1000 ) ) ); level.suddenDeathWarning = TW_IMMINENT; } @@ -1636,7 +1636,7 @@ void G_AdminMessage( gentity_t *ent, const char *msg ) int i; Com_sprintf( string, sizeof( string ), "chat %d %d \"%s\"", - ent ? ent - g_entities : -1, + ent ? ent - g_entities : -1, G_admin_permission( ent, ADMF_ADMINCHAT ) ? SAY_ADMINS : SAY_ADMINS_PUBLIC, msg ); @@ -2190,8 +2190,8 @@ void CheckCvars( void ) G_ClearDeconMarks( ); } - // If we change g_suddenDeathTime during a map, we need to update - // when sd will begin + // If we change g_suddenDeathTime during a map, we need to update + // when sd will begin if( g_suddenDeathTime.modificationCount != lastSDTimeModCount ) { lastSDTimeModCount = g_suddenDeathTime.modificationCount; @@ -2284,7 +2284,7 @@ void G_RunFrame( int levelTime ) if( level.restarted ) return; - if( level.pausedTime ) + if( level.pausedTime ) { msec = levelTime - level.time - level.pausedTime; level.pausedTime = levelTime - level.time; @@ -2295,7 +2295,7 @@ void G_RunFrame( int levelTime ) ptime3000 -= 3000; trap_SendServerCommand( -1, "cp \"The game has been paused. Please wait.\"" ); } - + // Prevents clients from getting lagged-out messages for( i = 0; i < level.maxclients; i++ ) { |