summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-12-28 02:32:43 +0000
committerTim Angus <tim@ngus.net>2005-12-28 02:32:43 +0000
commit1dc7e94283f026b17c1e793cbf7542872812ffda (patch)
tree33de56bca208626f1e7c77853255afc2b8244279 /src/qcommon
parent4b614e63d7da358a8a30e61a89365add79ecde9c (diff)
* Added master server to source, based on dpmaster
* Removed gametype, fraglimit and dmflags cvars * Removed CD key authentication stuff * Implemented a means to save and restore cmd context * Bumped protocol version up to 69 (same as 68) * Removed various references to punkbuster * Maps on create server menu now sorted by name * Fixed some warnings
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/cm_trace.c3
-rw-r--r--src/qcommon/cmd.c93
-rw-r--r--src/qcommon/common.c72
-rw-r--r--src/qcommon/cvar.c3
-rw-r--r--src/qcommon/files.c10
-rw-r--r--src/qcommon/q_shared.h4
-rw-r--r--src/qcommon/qcommon.h22
7 files changed, 68 insertions, 139 deletions
diff --git a/src/qcommon/cm_trace.c b/src/qcommon/cm_trace.c
index 483b0756..ee9540e3 100644
--- a/src/qcommon/cm_trace.c
+++ b/src/qcommon/cm_trace.c
@@ -738,7 +738,8 @@ static void CM_ProximityToBrush( traceWork_t *tw, cbrush_t *brush )
cbrushedge_t *edge;
float dist, minDist = 1e+10f;
float s, t;
- float sAtMin, radius, fraction;
+ float sAtMin = 0.0f;
+ float radius = 0.0f, fraction;
traceWork_t tw2;
// cheapish purely linear trace to test for intersection
diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c
index 2968f708..a3053c89 100644
--- a/src/qcommon/cmd.c
+++ b/src/qcommon/cmd.c
@@ -315,12 +315,37 @@ typedef struct cmd_function_s
} cmd_function_t;
-static int cmd_argc;
-static char *cmd_argv[MAX_STRING_TOKENS]; // points into cmd_tokenized
-static char cmd_tokenized[BIG_INFO_STRING+MAX_STRING_TOKENS]; // will have 0 bytes inserted
-static char cmd_cmd[BIG_INFO_STRING]; // the original command we received (no token processing)
+typedef struct cmdContext_s
+{
+ int argc;
+ char *argv[ MAX_STRING_TOKENS ]; // points into cmd.tokenized
+ char tokenized[ BIG_INFO_STRING + MAX_STRING_TOKENS ]; // will have 0 bytes inserted
+ char cmd[ BIG_INFO_STRING ]; // the original command we received (no token processing)
+} cmdContext_t;
+
+static cmdContext_t cmd;
+static cmdContext_t savedCmd;
+static cmd_function_t *cmd_functions; // possible commands to execute
-static cmd_function_t *cmd_functions; // possible commands to execute
+/*
+============
+Cmd_SaveCmdContext
+============
+*/
+void Cmd_SaveCmdContext( void )
+{
+ Com_Memcpy( &savedCmd, &cmd, sizeof( cmdContext_t ) );
+}
+
+/*
+============
+Cmd_RestoreCmdContext
+============
+*/
+void Cmd_RestoreCmdContext( void )
+{
+ Com_Memcpy( &cmd, &savedCmd, sizeof( cmdContext_t ) );
+}
/*
============
@@ -328,7 +353,7 @@ Cmd_Argc
============
*/
int Cmd_Argc( void ) {
- return cmd_argc;
+ return cmd.argc;
}
/*
@@ -337,10 +362,10 @@ Cmd_Argv
============
*/
char *Cmd_Argv( int arg ) {
- if ( (unsigned)arg >= cmd_argc ) {
+ if ( (unsigned)arg >= cmd.argc ) {
return "";
}
- return cmd_argv[arg];
+ return cmd.argv[arg];
}
/*
@@ -368,9 +393,9 @@ char *Cmd_Args( void ) {
int i;
cmd_args[0] = 0;
- for ( i = 1 ; i < cmd_argc ; i++ ) {
- strcat( cmd_args, cmd_argv[i] );
- if ( i != cmd_argc-1 ) {
+ for ( i = 1 ; i < cmd.argc ; i++ ) {
+ strcat( cmd_args, cmd.argv[i] );
+ if ( i != cmd.argc-1 ) {
strcat( cmd_args, " " );
}
}
@@ -392,9 +417,9 @@ char *Cmd_ArgsFrom( int arg ) {
cmd_args[0] = 0;
if (arg < 0)
arg = 0;
- for ( i = arg ; i < cmd_argc ; i++ ) {
- strcat( cmd_args, cmd_argv[i] );
- if ( i != cmd_argc-1 ) {
+ for ( i = arg ; i < cmd.argc ; i++ ) {
+ strcat( cmd_args, cmd.argv[i] );
+ if ( i != cmd.argc-1 ) {
strcat( cmd_args, " " );
}
}
@@ -423,7 +448,7 @@ they can't have pointers returned to them
============
*/
void Cmd_LiteralArgsBuffer( char *buffer, int bufferLength ) {
- Q_strncpyz( buffer, cmd_cmd, bufferLength );
+ Q_strncpyz( buffer, cmd.cmd, bufferLength );
}
/*
@@ -437,7 +462,7 @@ https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=543
*/
char *Cmd_Cmd(void)
{
- return cmd_cmd;
+ return cmd.cmd;
}
/*
@@ -462,20 +487,20 @@ void Cmd_TokenizeString( const char *text_in ) {
#endif
// clear previous args
- cmd_argc = 0;
- cmd_cmd[ 0 ] = '\0';
+ cmd.argc = 0;
+ cmd.cmd[ 0 ] = '\0';
if ( !text_in ) {
return;
}
- Q_strncpyz( cmd_cmd, text_in, sizeof(cmd_cmd) );
+ Q_strncpyz( cmd.cmd, text_in, sizeof(cmd.cmd) );
text = text_in;
- textOut = cmd_tokenized;
+ textOut = cmd.tokenized;
while ( 1 ) {
- if ( cmd_argc == MAX_STRING_TOKENS ) {
+ if ( cmd.argc == MAX_STRING_TOKENS ) {
return; // this is usually something malicious
}
@@ -510,8 +535,8 @@ void Cmd_TokenizeString( const char *text_in ) {
// handle quoted strings
// NOTE TTimo this doesn't handle \" escaping
if ( *text == '"' ) {
- cmd_argv[cmd_argc] = textOut;
- cmd_argc++;
+ cmd.argv[cmd.argc] = textOut;
+ cmd.argc++;
text++;
while ( *text && *text != '"' ) {
*textOut++ = *text++;
@@ -525,8 +550,8 @@ void Cmd_TokenizeString( const char *text_in ) {
}
// regular token
- cmd_argv[cmd_argc] = textOut;
- cmd_argc++;
+ cmd.argv[cmd.argc] = textOut;
+ cmd.argc++;
// skip until whitespace, quote, or command
while ( *text > ' ' ) {
@@ -633,7 +658,7 @@ A complete command line has been parsed, so try to execute it
============
*/
void Cmd_ExecuteString( const char *text ) {
- cmd_function_t *cmd, **prev;
+ cmd_function_t *cmdFunc, **prev;
// execute the command line
Cmd_TokenizeString( text );
@@ -642,21 +667,21 @@ void Cmd_ExecuteString( const char *text ) {
}
// check registered command functions
- for ( prev = &cmd_functions ; *prev ; prev = &cmd->next ) {
- cmd = *prev;
- if ( !Q_stricmp( cmd_argv[0],cmd->name ) ) {
+ for ( prev = &cmd_functions ; *prev ; prev = &cmdFunc->next ) {
+ cmdFunc = *prev;
+ if ( !Q_stricmp( cmd.argv[0], cmdFunc->name ) ) {
// rearrange the links so that the command will be
// near the head of the list next time it is used
- *prev = cmd->next;
- cmd->next = cmd_functions;
- cmd_functions = cmd;
+ *prev = cmdFunc->next;
+ cmdFunc->next = cmd_functions;
+ cmd_functions = cmdFunc;
// perform the action
- if ( !cmd->function ) {
+ if ( !cmdFunc->function ) {
// let the cgame or game handle it
break;
} else {
- cmd->function ();
+ cmdFunc->function ();
}
return;
}
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index 6ba479e3..231f4aa8 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
int demo_protocols[] =
-{ 66, 67, 68, 0 };
+{ 66, 67, 68, 69, 0 };
#define MAX_NUM_ARGVS 50
@@ -2229,76 +2229,6 @@ static void Com_Crash_f( void ) {
* ( int * ) 0 = 0x12345678;
}
-// TTimo: centralizing the cl_cdkey stuff after I discovered a buffer overflow problem with the dedicated server version
-// not sure it's necessary to have different defaults for regular and dedicated, but I don't want to risk it
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
-#ifndef DEDICATED
-char cl_cdkey[34] = " ";
-#else
-char cl_cdkey[34] = "123456789";
-#endif
-
-/*
-=================
-Com_ReadCDKey
-=================
-*/
-qboolean CL_CDKeyValidate( const char *key, const char *checksum );
-void Com_ReadCDKey( const char *filename ) {
- fileHandle_t f;
- char buffer[33];
- char fbuffer[MAX_OSPATH];
-
- sprintf(fbuffer, "%s/q3key", filename);
-
- FS_SV_FOpenFileRead( fbuffer, &f );
- if ( !f ) {
- Q_strncpyz( cl_cdkey, " ", 17 );
- return;
- }
-
- Com_Memset( buffer, 0, sizeof(buffer) );
-
- FS_Read( buffer, 16, f );
- FS_FCloseFile( f );
-
- if (CL_CDKeyValidate(buffer, NULL)) {
- Q_strncpyz( cl_cdkey, buffer, 17 );
- } else {
- Q_strncpyz( cl_cdkey, " ", 17 );
- }
-}
-
-/*
-=================
-Com_AppendCDKey
-=================
-*/
-void Com_AppendCDKey( const char *filename ) {
- fileHandle_t f;
- char buffer[33];
- char fbuffer[MAX_OSPATH];
-
- sprintf(fbuffer, "%s/q3key", filename);
-
- FS_SV_FOpenFileRead( fbuffer, &f );
- if (!f) {
- Q_strncpyz( &cl_cdkey[16], " ", 17 );
- return;
- }
-
- Com_Memset( buffer, 0, sizeof(buffer) );
-
- FS_Read( buffer, 16, f );
- FS_FCloseFile( f );
-
- if (CL_CDKeyValidate(buffer, NULL)) {
- strcat( &cl_cdkey[16], buffer );
- } else {
- Q_strncpyz( &cl_cdkey[16], " ", 17 );
- }
-}
-
static void Com_DetectAltivec(void)
{
// Only detect if user hasn't forcibly disabled it.
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c
index 6c0f612f..839f41ce 100644
--- a/src/qcommon/cvar.c
+++ b/src/qcommon/cvar.c
@@ -640,9 +640,6 @@ void Cvar_WriteVariables( fileHandle_t f ) {
char buffer[1024];
for (var = cvar_vars ; var ; var = var->next) {
- if( Q_stricmp( var->name, "cl_cdkey" ) == 0 ) {
- continue;
- }
if( var->flags & CVAR_ARCHIVE ) {
// write the latched value, even if it hasn't taken effect yet
if ( var->latchedString ) {
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 09926a1a..1ea34cc6 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -2702,9 +2702,6 @@ void FS_Shutdown( qboolean closemfp ) {
#endif
}
-void Com_AppendCDKey( const char *filename );
-void Com_ReadCDKey( const char *filename );
-
/*
================
FS_ReorderPurePaks
@@ -2752,7 +2749,6 @@ FS_Startup
*/
static void FS_Startup( const char *gameName ) {
const char *homePath;
- cvar_t *fs;
Com_Printf( "----- FS_Startup -----\n" );
@@ -2808,12 +2804,6 @@ static void FS_Startup( const char *gameName ) {
}
}
- Com_ReadCDKey( "base" );
- fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
- if (fs && fs->string[0] != 0) {
- Com_AppendCDKey( fs->string );
- }
-
// add our commands
Cmd_AddCommand ("path", FS_Path_f);
Cmd_AddCommand ("dir", FS_Dir_f );
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 6dd8527d..53848aa4 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -1274,8 +1274,4 @@ typedef enum _flag_status {
#define SAY_TEAM 1
#define SAY_TELL 2
-#define CDKEY_LEN 16
-#define CDCHKSUM_LEN 2
-
-
#endif // __Q_SHARED_H
diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h
index 11c332ce..843f04ef 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -227,27 +227,20 @@ PROTOCOL
==============================================================
*/
-#define PROTOCOL_VERSION 68
-// 1.31 - 67
+// 69 is identical in every way to 68 - the change is to avoid
+// confusing connecting Q3 clients
+#define PROTOCOL_VERSION 69
// maintain a list of compatible protocols for demo playing
// NOTE: that stuff only works with two digits protocols
extern int demo_protocols[];
-#define UPDATE_SERVER_NAME "update.quake3arena.com"
// override on command line, config files etc.
#ifndef MASTER_SERVER_NAME
-#define MASTER_SERVER_NAME "master.quake3arena.com"
-#endif
-#ifndef AUTHORIZE_SERVER_NAME
-#define AUTHORIZE_SERVER_NAME "authorize.quake3arena.com"
+#define MASTER_SERVER_NAME "master.tremulous.net"
#endif
#define PORT_MASTER 27950
-#define PORT_UPDATE 27951
-#ifndef PORT_AUTHORIZE
-#define PORT_AUTHORIZE 27952
-#endif
#define PORT_SERVER 27960
#define NUM_SERVER_PORTS 4 // broadcast scan this many ports after
// PORT_SERVER so a single machine can
@@ -424,6 +417,8 @@ void Cmd_ExecuteString( const char *text );
// Parses a single line of text into arguments and tries to execute it
// as if it was typed at the console
+void Cmd_SaveCmdContext( void );
+void Cmd_RestoreCmdContext( void );
/*
==============================================================
@@ -693,10 +688,6 @@ MISC
#define Q_vsnprintf vsnprintf
#endif
-// centralizing the declarations for cl_cdkey
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
-extern char cl_cdkey[34];
-
// returnbed by Sys_GetProcessorId
#define CPUID_GENERIC 0 // any unrecognized processor
@@ -916,7 +907,6 @@ qboolean SV_GameCommand( void );
// UI interface
//
qboolean UI_GameCommand( void );
-qboolean UI_usesUniqueCDKey(void);
/*
==============================================================