diff options
-rw-r--r-- | src/cgame/cg_consolecmds.c | 1 | ||||
-rw-r--r-- | src/client/cl_cin.c | 11 | ||||
-rw-r--r-- | src/client/cl_main.c | 2 | ||||
-rw-r--r-- | src/game/g_cmds.c | 164 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_main.c | 16 | ||||
-rw-r--r-- | src/game/g_svcmds.c | 7 | ||||
-rw-r--r-- | src/server/sv_client.c | 12 | ||||
-rw-r--r-- | src/server/sv_init.c | 6 | ||||
-rw-r--r-- | src/ui/ui_local.h | 1 | ||||
-rw-r--r-- | src/ui/ui_main.c | 27 |
11 files changed, 152 insertions, 96 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index cbd1aeb6..44b135bb 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -321,6 +321,7 @@ void CG_InitConsoleCommands( void ) trap_AddCommand( "ui_menu" ); trap_AddCommand( "mapRotation" ); trap_AddCommand( "stopMapRotation" ); + trap_AddCommand( "advanceMapRotation" ); trap_AddCommand( "alienWin" ); trap_AddCommand( "humanWin" ); } diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index f97d7712..1d8a5f89 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -1260,8 +1260,6 @@ static void RoQ_init( void ) ******************************************************************************/ static void RoQShutdown( void ) { - const char *s; - if (!cinTable[currentHandle].buf) { return; } @@ -1280,15 +1278,6 @@ static void RoQShutdown( void ) { if (cinTable[currentHandle].alterGameState) { cls.state = CA_DISCONNECTED; - // we can't just do a vstr nextmap, because - // if we are aborting the intro cinematic with - // a devmap command, nextmap would be valid by - // the time it was referenced - s = Cvar_VariableString( "nextmap" ); - if ( s[0] ) { - Cbuf_ExecuteText( EXEC_APPEND, va("%s\n", s) ); - Cvar_Set( "nextmap", "" ); - } CL_handle = -1; } cinTable[currentHandle].fileName[0] = 0; diff --git a/src/client/cl_main.c b/src/client/cl_main.c index f326632d..28e5021f 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -730,8 +730,6 @@ void CL_MapLoading( void ) { clc.lastPacketSentTime = -9999; SCR_UpdateScreen(); } else { - // clear nextmap so the cinematic shutdown doesn't execute it - Cvar_Set( "nextmap", "" ); CL_Disconnect( qtrue ); Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) ); cls.state = CA_CHALLENGING; // so the connect screen is drawn diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 875a922a..f8bbeb86 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -750,19 +750,6 @@ void Cmd_CallVote_f( gentity_t *ent ) return; } - if( !Q_stricmp( arg1, "map_restart" ) ) { } - else if( !Q_stricmp( arg1, "nextmap" ) ) { } - else if( !Q_stricmp( arg1, "map" ) ) { } - else if( !Q_stricmp( arg1, "kick" ) ) { } - else if( !Q_stricmp( arg1, "clientkick" ) ) { } - else - { - trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); - trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map <mapname>, " - "kick <player>, clientkick <clientnum>\n\"" ); - return; - } - // if there is still a vote to be executed if( level.voteExecuteTime ) { @@ -770,40 +757,77 @@ void Cmd_CallVote_f( gentity_t *ent ) trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) ); } - if( !Q_stricmp( arg1, "map" ) ) + if( !Q_stricmp( arg1, "kick" ) ) { - // special case for map changes, we want to reset the nextmap setting - // this allows a player to change maps, but not upset the map rotation - char s[ MAX_STRING_CHARS ]; - - trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof( s ) ); + char kickee[ MAX_NETNAME ]; - if( *s ) - Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s; set nextmap \"%s\"", arg1, arg2, s ); - else - Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s", arg1, arg2 ); + Q_strncpyz( kickee, arg2, sizeof( kickee ) ); + Q_CleanStr( kickee ); - Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString ); + Com_sprintf( level.voteString, sizeof( level.voteString ), + "%s \"%s\"", arg1, kickee ); + Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), + "Kick player \'%s\'", kickee ); } - else if( !Q_stricmp( arg1, "nextmap" ) ) + else if( !Q_stricmp( arg1, "clientkick" ) ) { - char s[ MAX_STRING_CHARS ]; + char kickee[ MAX_NETNAME ]; + int clientNum = 0; - trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof( s ) ); - - if( !*s ) + //check arg2 is a number + for( i = 0; arg2[ i ]; i++ ) { - trap_SendServerCommand( ent-g_entities, "print \"nextmap not set\n\"" ); - return; + if( arg2[ i ] < '0' || arg2[ i ] > '9' ) + { + clientNum = -1; + break; + } } - Com_sprintf( level.voteString, sizeof( level.voteString ), "vstr nextmap" ); - Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString ); + if( clientNum >= 0 ) + { + clientNum = atoi( arg2 ); + + if( level.clients[ clientNum ].pers.connected != CON_DISCONNECTED ) + { + Q_strncpyz( kickee, level.clients[ clientNum ].pers.netname, sizeof( kickee ) ); + Q_CleanStr( kickee ); + + Com_sprintf( level.voteString, sizeof( level.voteString ), + "clientkick %d", clientNum ); + Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), + "Kick player \'%s\'", kickee ); + } + else + return; + } + else + return; + } + else if( !Q_stricmp( arg1, "map_restart" ) ) + { + Com_sprintf( level.voteString, sizeof( level.voteString ), "%s", arg1 ); + Com_sprintf( level.voteDisplayString, + sizeof( level.voteDisplayString ), "Restart current map" ); + } + else if( !Q_stricmp( arg1, "map" ) ) + { + Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s", arg1, arg2 ); + Com_sprintf( level.voteDisplayString, + sizeof( level.voteDisplayString ), "Change to map \'%s\'", arg2 ); + } + else if( !Q_stricmp( arg1, "nextmap" ) ) + { + Com_sprintf( level.voteString, sizeof( level.voteString ), "advanceMapRotation" ); + Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), + "Skip to next map in rotation" ); } else { - Com_sprintf( level.voteString, sizeof( level.voteString ), "%s \"%s\"", arg1, arg2 ); - Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString ); + trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Valid vote commands are: map_restart, nextmap, " + "map <mapname>, kick <player>, clientkick <clientnum>\n\"" ); + return; } trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE @@ -951,28 +975,82 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) if( i >= level.maxclients ) { - trap_SendServerCommand( ent-g_entities, va( "print \"%s " + trap_SendServerCommand( ent-g_entities, va( "print \"\'%s\' " + S_COLOR_WHITE "is not a valid player on your team\n\"", arg2 ) ); + return; + } + + Com_sprintf( level.teamVoteString[ cs_offset ], + sizeof( level.teamVoteString[ cs_offset ] ), "kick \"%s\"", kickee ); + Com_sprintf( level.teamVoteDisplayString[ cs_offset ], + sizeof( level.teamVoteDisplayString[ cs_offset ] ), "Kick player \'%s\'", kickee ); + } + else if( !Q_stricmp( arg1, "teamclientkick" ) ) + { + int clientNum = 0; + char kickee[ MAX_NETNAME ]; + + //check arg2 is a number + for( i = 0; arg2[ i ]; i++ ) + { + if( arg2[ i ] < '0' || arg2[ i ] > '9' ) + { + clientNum = -1; + break; + } + } + + if( clientNum >= 0 ) + { + clientNum = atoi( arg2 ); + + for( i = 0; i < level.maxclients; i++ ) + { + if( level.clients[ i ].pers.connected == CON_DISCONNECTED ) + continue; + + if( level.clients[ i ].ps.stats[ STAT_PTEAM ] != team ) + continue; + + if( level.clients[ i ].ps.clientNum == clientNum ) + break; + } + + if( i >= level.maxclients ) + clientNum = -1; + } + + if( clientNum < 0 ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"client %s " S_COLOR_WHITE "is not a valid player on your team\n\"", arg2 ) ); return; } + + Q_strncpyz( kickee, level.clients[ clientNum ].pers.netname, sizeof( kickee ) ); + Q_CleanStr( kickee ); + + Com_sprintf( level.teamVoteString[ cs_offset ], + sizeof( level.teamVoteString[ cs_offset ] ), "clientkick %d", clientNum ); + Com_sprintf( level.teamVoteDisplayString[ cs_offset ], + sizeof( level.teamVoteDisplayString[ cs_offset ] ), "Kick player \'%s\'", kickee ); } else { trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" ); - trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: teamkick <player>\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Valid team vote commands are: teamkick <player>, " + "teamclientkick <client>\n\"" ); return; } - Com_sprintf( level.teamVoteString[ cs_offset ], - sizeof( level.teamVoteString[ cs_offset ] ), "kick \"%s\"", arg2 ); - for( i = 0 ; i < level.maxclients ; i++ ) { if( level.clients[ i ].pers.connected == CON_DISCONNECTED ) continue; if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team ) - trap_SendServerCommand( i, va("print \"%s called a team vote\n\"", ent->client->pers.netname ) ); + trap_SendServerCommand( i, va("print \"%s " S_COLOR_WHITE + "called a team vote\n\"", ent->client->pers.netname ) ); } // start the voting, the caller autoamtically votes yes @@ -989,7 +1067,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) ent->client->ps.eFlags |= EF_TEAMVOTED; trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, va( "%i", level.teamVoteTime[ cs_offset ] ) ); - trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, level.teamVoteString[ cs_offset ] ); + trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, level.teamVoteDisplayString[ cs_offset ] ); trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va( "%i", level.teamVoteYes[ cs_offset ] ) ); trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) ); } @@ -1356,7 +1434,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct ) return; } - if( !deconstruct ) + if( !deconstruct && CheatsOk( ent ) ) G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10000, 0, MOD_SUICIDE ); else G_FreeEntity( traceEnt ); diff --git a/src/game/g_local.h b/src/game/g_local.h index c528c4fb..5d35e5fb 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -542,6 +542,7 @@ typedef struct // team voting state char teamVoteString[ 2 ][ MAX_STRING_CHARS ]; + char teamVoteDisplayString[ 2 ][ MAX_STRING_CHARS ]; int teamVoteTime[ 2 ]; // level.time vote was called int teamVoteYes[ 2 ]; int teamVoteNo[ 2 ]; diff --git a/src/game/g_main.c b/src/game/g_main.c index 4a4fa2ca..98978b0a 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1388,9 +1388,8 @@ void BeginIntermission( void ) ============= ExitLevel -When the intermission has been exited, the server is either killed -or moved to a new level based on the "nextmap" cvar - +When the intermission has been exited, the server is either moved +to a new map based on the map rotation or the current map restarted ============= */ void ExitLevel( void ) @@ -1401,7 +1400,7 @@ void ExitLevel( void ) if( G_MapRotationActive( ) ) G_AdvanceMapRotation( ); else - trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" ); + trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); level.changemap = NULL; level.intermissiontime = 0; @@ -1810,14 +1809,7 @@ void CheckVote( void ) { level.voteExecuteTime = 0; - //SUPAR HAK - if( !Q_stricmp( level.voteString, "vstr nextmap" ) ) - { - level.lastWin = PTE_NONE; - LogExit( "Vote for next map." ); - } - else - trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) ); + trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) ); } if( !level.voteTime ) diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index 30caab0d..63234aba 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -542,6 +542,13 @@ qboolean ConsoleCommand( void ) return qtrue; } + if( Q_stricmp( cmd, "advanceMapRotation" ) == 0 ) + { + G_AdvanceMapRotation( ); + + return qtrue; + } + if( Q_stricmp( cmd, "alienWin" ) == 0 ) { int i; diff --git a/src/server/sv_client.c b/src/server/sv_client.c index 0272fab0..92a91bb7 100644 --- a/src/server/sv_client.c +++ b/src/server/sv_client.c @@ -110,7 +110,7 @@ void SV_DirectConnect( netadr_t from ) { version = atoi( Info_ValueForKey( userinfo, "protocol" ) ); if ( version != PROTOCOL_VERSION ) { - NET_OutOfBandPrint( NS_SERVER, from, "print\nServer uses protocol version %i.\n", PROTOCOL_VERSION ); + NET_OutOfBandPrint( NS_SERVER, from, "print\nServer uses protocol version %i", PROTOCOL_VERSION ); Com_DPrintf (" rejected connect from version %i\n", version); return; } @@ -147,7 +147,7 @@ void SV_DirectConnect( netadr_t from ) { } } if (i == MAX_CHALLENGES) { - NET_OutOfBandPrint( NS_SERVER, from, "print\nNo or bad challenge for address.\n" ); + NET_OutOfBandPrint( NS_SERVER, from, "print\nNo or bad challenge for address" ); return; } // force the IP key/value pair so the game can filter based on ip @@ -161,7 +161,7 @@ void SV_DirectConnect( netadr_t from ) { if ( !Sys_IsLANAddress( from ) ) { if ( sv_minPing->value && ping < sv_minPing->value ) { // don't let them keep trying until they get a big delay - NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for high pings only\n" ); + NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for high pings only" ); Com_DPrintf ("Client %i rejected on a too low ping\n", i); // reset the address otherwise their ping will keep increasing // with each connect message and they'd eventually be able to connect @@ -169,7 +169,7 @@ void SV_DirectConnect( netadr_t from ) { return; } if ( sv_maxPing->value && ping > sv_maxPing->value ) { - NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for low pings only\n" ); + NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is for low pings only" ); Com_DPrintf ("Client %i rejected on a too high ping\n", i); return; } @@ -251,7 +251,7 @@ void SV_DirectConnect( netadr_t from ) { } } else { - NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is full.\n" ); + NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is full" ); Com_DPrintf ("Rejected a connection.\n"); return; } @@ -287,7 +287,7 @@ gotnewcl: // we can't just use VM_ArgPtr, because that is only valid inside a VM_Call char *str = VM_ExplicitArgPtr( gvm, denied ); - NET_OutOfBandPrint( NS_SERVER, from, "print\n%s\n", str ); + NET_OutOfBandPrint( NS_SERVER, from, "print\n%s", str ); Com_DPrintf ("Game rejected a connection: %s.\n", str); return; } diff --git a/src/server/sv_init.c b/src/server/sv_init.c index c30b1228..d0a6a3c0 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -392,11 +392,6 @@ void SV_SpawnServer( char *server, qboolean killBots ) { // server has changed svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT; - // set nextmap to the same map, but it may be overriden - // by the game startup or another console command - Cvar_Set( "nextmap", "map_restart 0"); -// Cvar_Set( "nextmap", va("map %s", server) ); - for (i=0 ; i<sv_maxclients->integer ; i++) { // save when the server started for each client already connected if (svs.clients[i].state >= CS_CONNECTED) { @@ -596,7 +591,6 @@ void SV_Init (void) { sv_fps = Cvar_Get ("sv_fps", "20", CVAR_TEMP ); sv_timeout = Cvar_Get ("sv_timeout", "200", CVAR_TEMP ); sv_zombietime = Cvar_Get ("sv_zombietime", "2", CVAR_TEMP ); - Cvar_Get ("nextmap", "", CVAR_TEMP ); sv_allowDownload = Cvar_Get ("sv_allowDownload", "0", CVAR_SERVERINFO); sv_master[0] = Cvar_Get ("sv_master1", MASTER_SERVER_NAME, 0 ); diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index d8340695..c2604af3 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -820,6 +820,7 @@ typedef struct { qboolean teamLeader; char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH]; char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH]; + int clientNums[MAX_CLIENTS]; int teamClientNums[MAX_CLIENTS]; int mapCount; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index cde1c73a..c7b90a6a 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -2134,6 +2134,7 @@ static void UI_BuildPlayerList( void ) { if (info[0]) { Q_strncpyz( uiInfo.playerNames[uiInfo.playerCount], Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); Q_CleanStr( uiInfo.playerNames[uiInfo.playerCount] ); + uiInfo.clientNums[uiInfo.playerCount] = n; uiInfo.playerCount++; team2 = atoi(Info_ValueForKey(info, "t")); if (team2 == team) { @@ -4110,30 +4111,24 @@ static void UI_RunMenuScript(char **args) { if (ui_currentNetMap.integer >=0 && ui_currentNetMap.integer < uiInfo.mapCount) { trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote map %s\n",uiInfo.mapList[ui_currentNetMap.integer].mapLoadName) ); } - } else if (Q_stricmp(name, "voteKick") == 0) { - if (uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount) { - trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote kick %s\n",uiInfo.playerNames[uiInfo.playerIndex]) ); - } } - else if( Q_stricmp( name, "voteTeamKick" ) == 0 ) + else if( Q_stricmp( name, "voteKick" ) == 0 ) { if( uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount ) { - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote teamkick %s\n", uiInfo.playerNames[ uiInfo.teamIndex ] ) ); + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote clientkick %d\n", + uiInfo.clientNums[ uiInfo.playerIndex ] ) ); } } - else if (Q_stricmp(name, "voteGame") == 0) { - if (ui_netGameType.integer >= 0 && ui_netGameType.integer < uiInfo.numGameTypes) { - trap_Cmd_ExecuteText( EXEC_APPEND, va("callvote g_gametype %i\n",uiInfo.gameTypes[ui_netGameType.integer].gtEnum) ); - } - } else if (Q_stricmp(name, "voteLeader") == 0) { - if (uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount) { - trap_Cmd_ExecuteText( EXEC_APPEND, va("callteamvote leader %s\n",uiInfo.teamNames[uiInfo.teamIndex]) ); + else if( Q_stricmp( name, "voteTeamKick" ) == 0 ) + { + if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.playerCount ) + { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote teamclientkick %d\n", + uiInfo.teamClientNums[ uiInfo.teamIndex ] ) ); } } - else if (Q_stricmp(name, "addBot") == 0) { - trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s\n", UI_GetBotNameByNumber(uiInfo.botIndex), uiInfo.skillIndex+1, (uiInfo.redBlue == 0) ? "Red" : "Blue") ); - } else if (Q_stricmp(name, "addFavorite") == 0) { + else if (Q_stricmp(name, "addFavorite") == 0) { if (ui_netSource.integer != AS_FAVORITES) { char name[MAX_NAME_LENGTH]; char addr[MAX_NAME_LENGTH]; |