summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_console.c4
-rw-r--r--src/client/cl_main.c215
-rw-r--r--src/client/cl_ui.c60
-rw-r--r--src/client/client.h2
4 files changed, 28 insertions, 253 deletions
diff --git a/src/client/cl_console.c b/src/client/cl_console.c
index d80bff0f..efbf2d17 100644
--- a/src/client/cl_console.c
+++ b/src/client/cl_console.c
@@ -378,9 +378,13 @@ void CL_ConsolePrint( char *txt ) {
}
if( !skipnotify && !( cls.keyCatchers & KEYCATCH_CONSOLE ) ) {
+ Cmd_SaveCmdContext( );
+
// feed the text to cgame
Cmd_TokenizeString( txt );
CL_GameConsoleText( );
+
+ Cmd_RestoreCmdContext( );
}
color = ColorIndex(COLOR_WHITE);
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index bb322b6a..0789ac9b 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -820,116 +820,31 @@ void CL_RequestMotd( void ) {
if ( !cl_motd->integer ) {
return;
}
- Com_Printf( "Resolving %s\n", UPDATE_SERVER_NAME );
- if ( !NET_StringToAdr( UPDATE_SERVER_NAME, &cls.updateServer ) ) {
+ Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME );
+ if ( !NET_StringToAdr( MASTER_SERVER_NAME, &cls.updateServer ) ) {
Com_Printf( "Couldn't resolve address\n" );
return;
}
- cls.updateServer.port = BigShort( PORT_UPDATE );
- Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", UPDATE_SERVER_NAME,
+ cls.updateServer.port = BigShort( PORT_MASTER );
+ Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME,
cls.updateServer.ip[0], cls.updateServer.ip[1],
cls.updateServer.ip[2], cls.updateServer.ip[3],
BigShort( cls.updateServer.port ) );
-
+
info[0] = 0;
// NOTE TTimo xoring against Com_Milliseconds, otherwise we may not have a true randomization
// only srand I could catch before here is tr_noise.c l:26 srand(1001)
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=382
// NOTE: the Com_Milliseconds xoring only affects the lower 16-bit word,
// but I decided it was enough randomization
- Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
+ Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ),
+ "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
Info_SetValueForKey( info, "version", com_version->string );
- NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd \"%s\"\n", info );
-}
-
-/*
-===================
-CL_RequestAuthorization
-
-Authorization server protocol
------------------------------
-
-All commands are text in Q3 out of band packets (leading 0xff 0xff 0xff 0xff).
-
-Whenever the client tries to get a challenge from the server it wants to
-connect to, it also blindly fires off a packet to the authorize server:
-
-getKeyAuthorize <challenge> <cdkey>
-
-cdkey may be "demo"
-
-
-#OLD The authorize server returns a:
-#OLD
-#OLD keyAthorize <challenge> <accept | deny>
-#OLD
-#OLD A client will be accepted if the cdkey is valid and it has not been used by any other IP
-#OLD address in the last 15 minutes.
-
-
-The server sends a:
-
-getIpAuthorize <challenge> <ip>
-
-The authorize server returns a:
-
-ipAuthorize <challenge> <accept | deny | demo | unknown >
-
-A client will be accepted if a valid cdkey was sent by that ip (only) in the last 15 minutes.
-If no response is received from the authorize server after two tries, the client will be let
-in anyway.
-===================
-*/
-void CL_RequestAuthorization( void ) {
- char nums[64];
- int i, j, l;
- cvar_t *fs;
-
- if ( !cls.authorizeServer.port ) {
- Com_Printf( "Resolving %s\n", AUTHORIZE_SERVER_NAME );
- if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &cls.authorizeServer ) ) {
- Com_Printf( "Couldn't resolve address\n" );
- return;
- }
-
- cls.authorizeServer.port = BigShort( PORT_AUTHORIZE );
- Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", AUTHORIZE_SERVER_NAME,
- cls.authorizeServer.ip[0], cls.authorizeServer.ip[1],
- cls.authorizeServer.ip[2], cls.authorizeServer.ip[3],
- BigShort( cls.authorizeServer.port ) );
- }
- if ( cls.authorizeServer.type == NA_BAD ) {
- return;
- }
-
- if ( Cvar_VariableValue( "fs_restrict" ) ) {
- Q_strncpyz( nums, "demota", sizeof( nums ) );
- } else {
- // only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
- j = 0;
- l = strlen( cl_cdkey );
- if ( l > 32 ) {
- l = 32;
- }
- for ( i = 0 ; i < l ; i++ ) {
- if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
- || ( cl_cdkey[i] >= 'a' && cl_cdkey[i] <= 'z' )
- || ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
- ) {
- nums[j] = cl_cdkey[i];
- j++;
- }
- }
- nums[j] = 0;
- }
-
- fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
-
- NET_OutOfBandPrint(NS_CLIENT, cls.authorizeServer, va("getKeyAuthorize %i %s", fs->integer, nums) );
+ NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd%s", info );
}
/*
@@ -1519,9 +1434,6 @@ void CL_CheckForResend( void ) {
switch ( cls.state ) {
case CA_CONNECTING:
// requesting a challenge
- if ( !Sys_IsLANAddress( clc.serverAddress ) ) {
- CL_RequestAuthorization();
- }
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
break;
@@ -1596,27 +1508,24 @@ CL_MotdPacket
===================
*/
-void CL_MotdPacket( netadr_t from ) {
- char *challenge;
- char *info;
+void CL_MotdPacket( netadr_t from, const char *info ) {
+ char *v;
// if not from our server, ignore it
if ( !NET_CompareAdr( from, cls.updateServer ) ) {
return;
}
- info = Cmd_Argv(1);
-
// check challenge
- challenge = Info_ValueForKey( info, "challenge" );
- if ( strcmp( challenge, cls.updateChallenge ) ) {
+ v = Info_ValueForKey( info, "challenge" );
+ if ( strcmp( v, cls.updateChallenge ) ) {
return;
}
- challenge = Info_ValueForKey( info, "motd" );
+ v = Info_ValueForKey( info, "motd" );
Q_strncpyz( cls.updateInfoString, info, sizeof( cls.updateInfoString ) );
- Cvar_Set( "cl_motdString", challenge );
+ Cvar_Set( "cl_motdString", v );
}
/*
@@ -1706,7 +1615,7 @@ void CL_ServersResponsePacket( netadr_t from, msg_t *msg ) {
addresses[numservers].ip[1],
addresses[numservers].ip[2],
addresses[numservers].ip[3],
- addresses[numservers].port );
+ BigShort( addresses[numservers].port ) );
numservers++;
if (numservers >= MAX_SERVERSPERPACKET) {
@@ -1773,7 +1682,8 @@ Responses to broadcasts, etc
*/
void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
char *s;
- char *c;
+ char c[ BIG_INFO_STRING ];
+ char arg1[ BIG_INFO_STRING ];
MSG_BeginReadingOOB( msg );
MSG_ReadLong( msg ); // skip the -1
@@ -1782,7 +1692,8 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
Cmd_TokenizeString( s );
- c = Cmd_Argv(0);
+ Q_strncpyz( c, Cmd_Argv( 0 ), BIG_INFO_STRING );
+ Q_strncpyz( arg1, Cmd_Argv( 1 ), BIG_INFO_STRING );
Com_DPrintf ("CL packet %s: %s\n", NET_AdrToString(from), c);
@@ -1792,7 +1703,7 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
Com_Printf( "Unwanted challenge response received. Ignored.\n" );
} else {
// start sending challenge repsonse instead of challenge request packets
- clc.challenge = atoi(Cmd_Argv(1));
+ clc.challenge = atoi(arg1);
cls.state = CA_CHALLENGING;
clc.connectPacketCount = 0;
clc.connectTime = -99999;
@@ -1848,19 +1759,13 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
// echo request from server
if ( !Q_stricmp(c, "echo") ) {
- NET_OutOfBandPrint( NS_CLIENT, from, "%s", Cmd_Argv(1) );
+ NET_OutOfBandPrint( NS_CLIENT, from, "%s", arg1 );
return;
}
- // cd check
- if ( !Q_stricmp(c, "keyAuthorize") ) {
- // we don't use these now, so dump them on the floor
- return;
- }
-
- // global MOTD from id
+ // global MOTD from trem master
if ( !Q_stricmp(c, "motd") ) {
- CL_MotdPacket( from );
+ CL_MotdPacket( from, arg1 );
return;
}
@@ -2003,11 +1908,7 @@ void CL_Frame ( int msec ) {
return;
}
- if ( cls.cddialog ) {
- // bring up the cd error dialog if needed
- cls.cddialog = qfalse;
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NEED_CD );
- } else if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI )
+ if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI )
&& !com_sv_running->integer ) {
// if disconnected, bring up the menu
S_StopAllSounds();
@@ -2474,7 +2375,6 @@ static void CL_SetServerInfo(serverInfo_t *server, const char *info, int ping) {
server->netType = atoi(Info_ValueForKey(info, "nettype"));
server->minPing = atoi(Info_ValueForKey(info, "minping"));
server->maxPing = atoi(Info_ValueForKey(info, "maxping"));
- server->punkbuster = atoi(Info_ValueForKey(info, "punkbuster"));
}
server->ping = ping;
}
@@ -2605,7 +2505,6 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
cls.localServers[i].game[0] = '\0';
cls.localServers[i].gameType = 0;
cls.localServers[i].netType = from.type;
- cls.localServers[i].punkbuster = 0;
Q_strncpyz( info, MSG_ReadString( msg ), MAX_INFO_STRING );
if (strlen(info)) {
@@ -3260,69 +3159,3 @@ CL_ShowIP_f
void CL_ShowIP_f(void) {
Sys_ShowIP();
}
-
-/*
-=================
-bool CL_CDKeyValidate
-=================
-*/
-qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
- char ch;
- byte sum;
- char chs[3];
- int i, len;
-
- len = strlen(key);
- if( len != CDKEY_LEN ) {
- return qfalse;
- }
-
- if( checksum && strlen( checksum ) != CDCHKSUM_LEN ) {
- return qfalse;
- }
-
- sum = 0;
- // for loop gets rid of conditional assignment warning
- for (i = 0; i < len; i++) {
- ch = *key++;
- if (ch>='a' && ch<='z') {
- ch -= 32;
- }
- switch( ch ) {
- case '2':
- case '3':
- case '7':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'G':
- case 'H':
- case 'J':
- case 'L':
- case 'P':
- case 'R':
- case 'S':
- case 'T':
- case 'W':
- sum += ch;
- continue;
- default:
- return qfalse;
- }
- }
-
- sprintf(chs, "%02x", sum);
-
- if (checksum && !Q_stricmp(chs, checksum)) {
- return qtrue;
- }
-
- if (!checksum) {
- return qtrue;
- }
-
- return qfalse;
-}
-
-
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c
index 24186379..7351d77e 100644
--- a/src/client/cl_ui.c
+++ b/src/client/cl_ui.c
@@ -322,7 +322,6 @@ static void LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
Info_SetValueForKey( info, "gametype", va("%i",server->gameType));
Info_SetValueForKey( info, "nettype", va("%i",server->netType));
Info_SetValueForKey( info, "addr", NET_AdrToString(server->adr));
- Info_SetValueForKey( info, "punkbuster", va("%i", server->punkbuster));
Q_strncpyz(buf, info, buflen);
} else {
if (buf) {
@@ -673,44 +672,6 @@ void Key_SetCatcher( int catcher ) {
/*
====================
-CLUI_GetCDKey
-====================
-*/
-static void CLUI_GetCDKey( char *buf, int buflen ) {
- cvar_t *fs;
- fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
- if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
- Com_Memcpy( buf, &cl_cdkey[16], 16);
- buf[16] = 0;
- } else {
- Com_Memcpy( buf, cl_cdkey, 16);
- buf[16] = 0;
- }
-}
-
-
-/*
-====================
-CLUI_SetCDKey
-====================
-*/
-static void CLUI_SetCDKey( char *buf ) {
- cvar_t *fs;
- fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
- if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
- Com_Memcpy( &cl_cdkey[16], buf, 16 );
- cl_cdkey[32] = 0;
- // set the flag so the fle will be written at the next opportunity
- cvar_modifiedFlags |= CVAR_ARCHIVE;
- } else {
- Com_Memcpy( cl_cdkey, buf, 16 );
- // set the flag so the fle will be written at the next opportunity
- cvar_modifiedFlags |= CVAR_ARCHIVE;
- }
-}
-
-/*
-====================
GetConfigString
====================
*/
@@ -1005,14 +966,6 @@ long CL_UISystemCalls( long *args ) {
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
- case UI_GET_CDKEY:
- CLUI_GetCDKey( VMA(1), args[2] );
- return 0;
-
- case UI_SET_CDKEY:
- CLUI_SetCDKey( VMA(1) );
- return 0;
-
case UI_SET_PBCLSTATUS:
return 0;
@@ -1093,11 +1046,6 @@ long CL_UISystemCalls( long *args ) {
re.RemapShader( VMA(1), VMA(2), VMA(3) );
return 0;
- case UI_VERIFY_CDKEY:
- return CL_CDKeyValidate(VMA(1), VMA(2));
-
-
-
default:
Com_Error( ERR_DROP, "Bad UI system trap: %i", args[0] );
@@ -1162,14 +1110,6 @@ void CL_InitUI( void ) {
}
}
-qboolean UI_usesUniqueCDKey( void ) {
- if (uivm) {
- return (VM_Call( uivm, UI_HASUNIQUECDKEY) == qtrue);
- } else {
- return qfalse;
- }
-}
-
/*
====================
UI_GameCommand
diff --git a/src/client/client.h b/src/client/client.h
index eff15d51..e597047f 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -239,7 +239,6 @@ typedef struct {
int maxPing;
int ping;
qboolean visible;
- int punkbuster;
} serverInfo_t;
typedef struct {
@@ -382,7 +381,6 @@ int CL_GetPingQueueCount( void );
void CL_ShutdownRef( void );
void CL_InitRef( void );
-qboolean CL_CDKeyValidate( const char *key, const char *checksum );
int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen );