aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
Diffstat (limited to 'code/qcommon')
-rw-r--r--code/qcommon/cm_trace.c17
-rw-r--r--code/qcommon/common.c260
-rw-r--r--code/qcommon/cvar.c26
-rw-r--r--code/qcommon/files.c594
-rw-r--r--code/qcommon/net_ip.c16
-rw-r--r--code/qcommon/q_math.c9
-rw-r--r--code/qcommon/q_platform.h2
-rw-r--r--code/qcommon/q_shared.c34
-rw-r--r--code/qcommon/q_shared.h24
-rw-r--r--code/qcommon/qcommon.h102
-rw-r--r--code/qcommon/vm.c17
-rw-r--r--code/qcommon/vm_interpreted.c2
-rw-r--r--code/qcommon/vm_local.h1
-rw-r--r--code/qcommon/vm_x86.c14
-rw-r--r--code/qcommon/vm_x86_64.c2
15 files changed, 543 insertions, 577 deletions
diff --git a/code/qcommon/cm_trace.c b/code/qcommon/cm_trace.c
index 44ca5f8..a2873b1 100644
--- a/code/qcommon/cm_trace.c
+++ b/code/qcommon/cm_trace.c
@@ -41,7 +41,7 @@ BASIC MATH
RotatePoint
================
*/
-void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME
+void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // FIXME
vec3_t tvec;
VectorCopy(point, tvec);
@@ -55,7 +55,7 @@ void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // bk: FIXME
TransposeMatrix
================
*/
-void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // bk: FIXME
+void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // FIXME
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@@ -1067,17 +1067,6 @@ void CM_TraceThroughTree( traceWork_t *tw, int num, float p1f, float p2f, vec3_t
if ( tw->isPoint ) {
offset = 0;
} else {
-#if 0 // bk010201 - DEAD
- // an axial brush right behind a slanted bsp plane
- // will poke through when expanded, so adjust
- // by sqrt(3)
- offset = fabs(tw->extents[0]*plane->normal[0]) +
- fabs(tw->extents[1]*plane->normal[1]) +
- fabs(tw->extents[2]*plane->normal[2]);
-
- offset *= 2;
- offset = tw->maxOffset;
-#endif
// this is silly
offset = 2048;
}
@@ -1276,7 +1265,7 @@ void CM_Trace( trace_t *results, const vec3_t start, const vec3_t end, vec3_t mi
//
if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2]) {
if ( model ) {
-#ifdef ALWAYS_BBOX_VS_BBOX // bk010201 - FIXME - compile time flag?
+#ifdef ALWAYS_BBOX_VS_BBOX // FIXME - compile time flag?
if ( model == BOX_MODEL_HANDLE || model == CAPSULE_MODEL_HANDLE) {
tw.sphere.use = qfalse;
CM_TestInLeaf( &tw, &cmod->leaf );
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 3c37656..c8aaaeb 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -56,7 +56,6 @@ static fileHandle_t logfile;
fileHandle_t com_journalFile; // events are written here
fileHandle_t com_journalDataFile; // config files are written here
-cvar_t *com_viewlog;
cvar_t *com_speeds;
cvar_t *com_developer;
cvar_t *com_dedicated;
@@ -80,9 +79,9 @@ cvar_t *sv_paused;
cvar_t *cl_packetdelay;
cvar_t *sv_packetdelay;
cvar_t *com_cameraMode;
-#if defined(_WIN32) && defined(_DEBUG)
-cvar_t *com_noErrorInterrupt;
-#endif
+cvar_t *com_ansiColor;
+cvar_t *com_unfocused;
+cvar_t *com_minimized;
// com_speeds times
int time_game;
@@ -161,10 +160,9 @@ void QDECL Com_Printf( const char *fmt, ... ) {
return;
}
- // echo to console if we're not a dedicated server
- if ( com_dedicated && !com_dedicated->integer ) {
- CL_ConsolePrint( msg );
- }
+#ifndef DEDICATED
+ CL_ConsolePrint( msg );
+#endif
// echo to dedicated console and early console
Sys_Print( msg );
@@ -246,16 +244,6 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
static int errorCount;
int currentTime;
-#if defined(_WIN32) && defined(_DEBUG)
- if ( code != ERR_DISCONNECT && code != ERR_NEED_CD ) {
- if (!com_noErrorInterrupt->integer) {
- __asm {
- int 0x03
- }
- }
- }
-#endif
-
// when we are running automated scripts, make sure we
// know if anything failed
if ( com_buildScript && com_buildScript->integer ) {
@@ -1126,7 +1114,6 @@ typedef struct memstatic_s {
byte mem[2];
} memstatic_t;
-// bk001204 - initializer brackets
memstatic_t emptystring =
{ {(sizeof(memblock_t)+2 + 3) & ~3, TAG_STATIC, NULL, NULL, ZONEID}, {'\0', '\0'} };
memstatic_t numberstring[] = {
@@ -1385,7 +1372,6 @@ Com_InitZoneMemory
*/
void Com_InitSmallZoneMemory( void ) {
s_smallZoneTotal = 512 * 1024;
- // bk001205 - was malloc
smallzone = calloc( s_smallZoneTotal, 1 );
if ( !smallzone ) {
Com_Error( ERR_FATAL, "Small zone data failed to allocate %1.1f megs", (float)s_smallZoneTotal / (1024*1024) );
@@ -1411,7 +1397,6 @@ void Com_InitZoneMemory( void ) {
s_zoneTotal = cv->integer * 1024 * 1024;
}
- // bk001205 - was malloc
mainzone = calloc( s_zoneTotal, 1 );
if ( !mainzone ) {
Com_Error( ERR_FATAL, "Zone data failed to allocate %i megs", s_zoneTotal / (1024*1024) );
@@ -1536,8 +1521,6 @@ void Com_InitHunkMemory( void ) {
s_hunkTotal = cv->integer * 1024 * 1024;
}
-
- // bk001205 - was malloc
s_hunkData = calloc( s_hunkTotal + 31, 1 );
if ( !s_hunkData ) {
Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) );
@@ -1901,14 +1884,9 @@ journaled file
===================================================================
*/
-// bk001129 - here we go again: upped from 64
-// FIXME TTimo blunt upping from 256 to 1024
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=5
#define MAX_PUSHED_EVENTS 1024
-// bk001129 - init, also static
static int com_pushedEventsHead = 0;
static int com_pushedEventsTail = 0;
-// bk001129 - static
static sysEvent_t com_pushedEvents[MAX_PUSHED_EVENTS];
/*
@@ -1942,6 +1920,125 @@ void Com_InitJournaling( void ) {
}
/*
+========================================================================
+
+EVENT LOOP
+
+========================================================================
+*/
+
+#define MAX_QUEUED_EVENTS 256
+#define MASK_QUEUED_EVENTS ( MAX_QUEUED_EVENTS - 1 )
+
+static sysEvent_t eventQueue[ MAX_QUEUED_EVENTS ];
+static int eventHead = 0;
+static int eventTail = 0;
+static byte sys_packetReceived[ MAX_MSGLEN ];
+
+/*
+================
+Com_QueueEvent
+
+A time of 0 will get the current time
+Ptr should either be null, or point to a block of data that can
+be freed by the game later.
+================
+*/
+void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr )
+{
+ sysEvent_t *ev;
+
+ ev = &eventQueue[ eventHead & MASK_QUEUED_EVENTS ];
+
+ if ( eventHead - eventTail >= MAX_QUEUED_EVENTS )
+ {
+ Com_Printf("Com_QueueEvent: overflow\n");
+ // we are discarding an event, but don't leak memory
+ if ( ev->evPtr )
+ {
+ Z_Free( ev->evPtr );
+ }
+ eventTail++;
+ }
+
+ eventHead++;
+
+ if ( time == 0 )
+ {
+ time = Sys_Milliseconds();
+ }
+
+ ev->evTime = time;
+ ev->evType = type;
+ ev->evValue = value;
+ ev->evValue2 = value2;
+ ev->evPtrLength = ptrLength;
+ ev->evPtr = ptr;
+}
+
+/*
+================
+Com_GetSystemEvent
+
+================
+*/
+sysEvent_t Com_GetSystemEvent( void )
+{
+ sysEvent_t ev;
+ char *s;
+ msg_t netmsg;
+ netadr_t adr;
+
+ // return if we have data
+ if ( eventHead > eventTail )
+ {
+ eventTail++;
+ return eventQueue[ ( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
+ }
+
+ // check for console commands
+ s = Sys_ConsoleInput();
+ if ( s )
+ {
+ char *b;
+ int len;
+
+ len = strlen( s ) + 1;
+ b = Z_Malloc( len );
+ strcpy( b, s );
+ Com_QueueEvent( 0, SE_CONSOLE, 0, 0, len, b );
+ }
+
+ // check for network packets
+ MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
+ if ( Sys_GetPacket ( &adr, &netmsg ) )
+ {
+ netadr_t *buf;
+ int len;
+
+ // copy out to a seperate buffer for qeueing
+ len = sizeof( netadr_t ) + netmsg.cursize;
+ buf = Z_Malloc( len );
+ *buf = adr;
+ memcpy( buf+1, netmsg.data, netmsg.cursize );
+ Com_QueueEvent( 0, SE_PACKET, 0, 0, len, buf );
+ }
+
+ // return if we have data
+ if ( eventHead > eventTail )
+ {
+ eventTail++;
+ return eventQueue[ ( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
+ }
+
+ // create an empty event to return
+ memset( &ev, 0, sizeof( ev ) );
+ ev.evTime = Sys_Milliseconds();
+
+ return ev;
+}
+
+/*
=================
Com_GetRealEvent
=================
@@ -1964,7 +2061,7 @@ sysEvent_t Com_GetRealEvent( void ) {
}
}
} else {
- ev = Sys_GetEvent();
+ ev = Com_GetSystemEvent();
// write the journal value out if needed
if ( com_journal->integer == 1 ) {
@@ -1990,7 +2087,6 @@ sysEvent_t Com_GetRealEvent( void ) {
Com_InitPushEvent
=================
*/
-// bk001129 - added
void Com_InitPushEvent( void ) {
// clear the static buffer array
// this requires SE_NONE to be accepted as a valid but NOP event
@@ -2009,7 +2105,7 @@ Com_PushEvent
*/
void Com_PushEvent( sysEvent_t *event ) {
sysEvent_t *ev;
- static int printedWarning = 0; // bk001129 - init, bk001204 - explicit int
+ static int printedWarning = 0;
ev = &com_pushedEvents[ com_pushedEventsHead & (MAX_PUSHED_EVENTS-1) ];
@@ -2110,7 +2206,6 @@ int Com_EventLoop( void ) {
switch ( ev.evType ) {
default:
- // bk001129 - was ev.evTime
Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
break;
case SE_NONE:
@@ -2322,7 +2417,7 @@ void Com_AppendCDKey( const char *filename ) {
}
}
-#ifndef DEDICATED // bk001204
+#ifndef DEDICATED
/*
=================
Com_WriteCDKey
@@ -2378,7 +2473,7 @@ static void Com_DetectAltivec(void)
static qboolean altivec = qfalse;
static qboolean detected = qfalse;
if (!detected) {
- altivec = Sys_DetectAltivec();
+ altivec = ( Sys_GetProcessorFeatures( ) & CF_ALTIVEC );
detected = qtrue;
}
@@ -2397,13 +2492,17 @@ Com_Init
void Com_Init( char *commandLine ) {
char *s;
- Com_Printf( "%s %s %s\n", SVN_VERSION, PLATFORM_STRING, __DATE__ );
+ Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
if ( setjmp (abortframe) ) {
Sys_Error ("Error during initialization");
}
- // bk001129 - do this before anything else decides to push events
+ // Clear queues
+ Com_Memset( &eventQueue[ 0 ], 0, MAX_QUEUED_EVENTS * sizeof( sysEvent_t ) );
+ Com_Memset( &sys_packetReceived[ 0 ], 0, MAX_MSGLEN * sizeof( byte ) );
+
+ // do this before anything else decides to push events
Com_InitPushEvent();
Com_InitSmallZoneMemory();
@@ -2473,7 +2572,6 @@ void Com_Init( char *commandLine ) {
com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
com_dropsim = Cvar_Get ("com_dropsim", "0", CVAR_CHEAT);
- com_viewlog = Cvar_Get( "viewlog", "0", CVAR_CHEAT );
com_speeds = Cvar_Get ("com_speeds", "0", 0);
com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT);
com_cameraMode = Cvar_Get ("com_cameraMode", "0", CVAR_CHEAT);
@@ -2485,18 +2583,12 @@ void Com_Init( char *commandLine ) {
com_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM);
com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM);
com_buildScript = Cvar_Get( "com_buildScript", "0", 0 );
+ com_ansiColor = Cvar_Get( "com_ansiColor", "0", CVAR_ARCHIVE );
- com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
-
-#if defined(_WIN32) && defined(_DEBUG)
- com_noErrorInterrupt = Cvar_Get( "com_noErrorInterrupt", "0", 0 );
-#endif
+ com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM );
+ com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
- if ( com_dedicated->integer ) {
- if ( !com_viewlog->integer ) {
- Cvar_Set( "viewlog", "1" );
- }
- }
+ com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
if ( com_developer && com_developer->integer ) {
Cmd_AddCommand ("error", Com_Error_f);
@@ -2516,10 +2608,9 @@ void Com_Init( char *commandLine ) {
SV_Init();
com_dedicated->modified = qfalse;
- if ( !com_dedicated->integer ) {
- CL_Init();
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- }
+#ifndef DEDICATED
+ CL_Init();
+#endif
// set com_frameTime so that if a map is started on the
// command line it will still be able to count on com_frameTime
@@ -2541,7 +2632,7 @@ void Com_Init( char *commandLine ) {
// start in full screen ui mode
Cvar_Set("r_uiFullScreen", "1");
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
// make sure single player is off by default
Cvar_Set("ui_singlePlayerActive", "0");
@@ -2550,9 +2641,9 @@ void Com_Init( char *commandLine ) {
// always set the cvar, but only print the info if it makes sense.
Com_DetectAltivec();
- #if idppc
+#if idppc
Com_Printf ("Altivec support is %s\n", com_altivec->integer ? "enabled" : "disabled");
- #endif
+#endif
Com_Printf ("--- Common Initialization Complete ---\n");
}
@@ -2583,7 +2674,7 @@ Writes key bindings and archived cvars to config file if modified
===============
*/
void Com_WriteConfiguration( void ) {
-#ifndef DEDICATED // bk001204
+#ifndef DEDICATED
cvar_t *fs;
#endif
// if we are quiting without fully initializing, make sure
@@ -2599,7 +2690,7 @@ void Com_WriteConfiguration( void ) {
Com_WriteConfigToFile( "q3config.cfg" );
- // bk001119 - tentative "not needed for dedicated"
+ // not needed for dedicated
#ifndef DEDICATED
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
@@ -2708,8 +2799,6 @@ void Com_Frame( void ) {
return; // an ERR_DROP was thrown
}
- // bk001204 - init to zero.
- // also: might be clobbered by `longjmp' or `vfork'
timeBeforeFirstEvents =0;
timeBeforeServer =0;
timeBeforeEvents =0;
@@ -2723,14 +2812,6 @@ void Com_Frame( void ) {
// write config file if anything changed
Com_WriteConfiguration();
- // if "viewlog" has been modified, show or hide the log console
- if ( com_viewlog->modified ) {
- if ( !com_dedicated->value ) {
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- }
- com_viewlog->modified = qfalse;
- }
-
//
// main event loop
//
@@ -2783,42 +2864,39 @@ void Com_Frame( void ) {
Cvar_Get( "dedicated", "0", 0 );
com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) {
- CL_Init();
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- } else {
- CL_Shutdown();
- Sys_ShowConsole( 1, qtrue );
+ SV_Shutdown( "dedicated set to 0" );
+ CL_FlushMemory();
}
}
+#ifndef DEDICATED
//
// client system
//
- if ( !com_dedicated->integer ) {
- //
- // run event loop a second time to get server to client packets
- // without a frame of latency
- //
- if ( com_speeds->integer ) {
- timeBeforeEvents = Sys_Milliseconds ();
- }
- Com_EventLoop();
- Cbuf_Execute ();
+ //
+ // run event loop a second time to get server to client packets
+ // without a frame of latency
+ //
+ if ( com_speeds->integer ) {
+ timeBeforeEvents = Sys_Milliseconds ();
+ }
+ Com_EventLoop();
+ Cbuf_Execute ();
- //
- // client side
- //
- if ( com_speeds->integer ) {
- timeBeforeClient = Sys_Milliseconds ();
- }
+ //
+ // client side
+ //
+ if ( com_speeds->integer ) {
+ timeBeforeClient = Sys_Milliseconds ();
+ }
- CL_Frame( msec );
+ CL_Frame( msec );
- if ( com_speeds->integer ) {
- timeAfter = Sys_Milliseconds ();
- }
+ if ( com_speeds->integer ) {
+ timeAfter = Sys_Milliseconds ();
}
+#endif
//
// report timing information
diff --git a/code/qcommon/cvar.c b/code/qcommon/cvar.c
index 6e229c4..23c014e 100644
--- a/code/qcommon/cvar.c
+++ b/code/qcommon/cvar.c
@@ -511,8 +511,20 @@ qboolean Cvar_Command( void ) {
if ( Cmd_Argc() == 1 ) {
Com_TruncateLongString( string, v->string );
Com_TruncateLongString( resetString, v->resetString );
- Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\" default:\"%s" S_COLOR_WHITE "\"\n",
- v->name, string, resetString );
+ Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\"",
+ v->name, string );
+
+ if ( !( v->flags & CVAR_ROM ) ) {
+ if ( !Q_stricmp( string, resetString ) ) {
+ Com_Printf (", the default" );
+ } else {
+ Com_Printf (" default:\"%s" S_COLOR_WHITE "\"",
+ resetString );
+ }
+ }
+
+ Com_Printf ("\n");
+
if ( v->latchedString ) {
Com_TruncateLongString( latchedString, v->latchedString );
Com_Printf( "latched: \"%s\"\n", latchedString );
@@ -895,8 +907,8 @@ updates an interpreted modules' version of a cvar
=====================
*/
void Cvar_Update( vmCvar_t *vmCvar ) {
- cvar_t *cv = NULL; // bk001129
- assert(vmCvar); // bk
+ cvar_t *cv = NULL;
+ assert(vmCvar);
if ( (unsigned)vmCvar->handle >= cvar_numIndexes ) {
Com_Error( ERR_DROP, "Cvar_Update: handle out of range" );
@@ -911,16 +923,10 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
return; // variable might have been cleared by a cvar_restart
}
vmCvar->modificationCount = cv->modificationCount;
- // bk001129 - mismatches.
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
cv->string,
strlen(cv->string));
- // bk001212 - Q_strncpyz guarantees zero padding and dest[MAX_CVAR_VALUE_STRING-1]==0
- // bk001129 - paranoia. Never trust the destination string.
- // bk001129 - beware, sizeof(char*) is always 4 (for cv->string).
- // sizeof(vmCvar->string) always MAX_CVAR_VALUE_STRING
- //Q_strncpyz( vmCvar->string, cv->string, sizeof( vmCvar->string ) ); // id
Q_strncpyz( vmCvar->string, cv->string, MAX_CVAR_VALUE_STRING );
vmCvar->value = cv->value;
diff --git a/code/qcommon/files.c b/code/qcommon/files.c
index 8220f6f..af5eaec 100644
--- a/code/qcommon/files.c
+++ b/code/qcommon/files.c
@@ -51,15 +51,6 @@ command line to allow code debugging in a different directory. Basepath cannot
be modified at all after startup. Any files that are created (demos, screenshots,
etc) will be created reletive to the base path, so base path should usually be writable.
-The "cd path" is the path to an alternate hierarchy that will be searched if a file
-is not located in the base path. A user can do a partial install that copies some
-data to a base path created on their hard drive and leave the rest on the cd. Files
-are never writen to the cd path. It defaults to a value set by the installer, like
-"e:\quake3", but it can be overridden with "+set fs_cdpath g:\quake3".
-
-If a user runs the game directly from a CD, the base path would be on the CD. This
-should still function correctly, but all file writes will fail (harmlessly).
-
The "home path" is the path used for all write access. On win32 systems we have "base path"
== "home path", but on *nix systems the base installation is usually readonly, and
"home path" points to ~/.q3a or similar
@@ -93,21 +84,6 @@ trying to restrict demo / oem versions of the game with code changes. Demo / oe
should be exactly the same executables as release versions, but with different data that
automatically restricts where game media can come from to prevent add-ons from working.
-After the paths are initialized, quake will look for the product.txt file. If not
-found and verified, the game will run in restricted mode. In restricted mode, only
-files contained in demoq3/pak0.pk3 will be available for loading, and only if the zip header is
-verified to not have been modified. A single exception is made for q3config.cfg. Files
-can still be written out in restricted mode, so screenshots and demos are allowed.
-Restricted mode can be tested by setting "+set fs_restrict 1" on the command line, even
-if there is a valid product.txt under the basepath or cdpath.
-
-If not running in restricted mode, and a file is not found in any local filesystem,
-an attempt will be made to download it and save it under the base path.
-
-If the "fs_copyfiles" cvar is set to 1, then every time a file is sourced from the cd
-path, it will be copied over to the base path. This is a development aid to help build
-test releases and to copy working sets over slow network links.
-
File search order: when FS_FOpenFileRead gets called it will go through the fs_searchpaths
structure and stop on the first successful hit. fs_searchpaths is built with successive
calls to FS_AddGameDirectory
@@ -260,10 +236,7 @@ static cvar_t *fs_debug;
static cvar_t *fs_homepath;
static cvar_t *fs_basepath;
static cvar_t *fs_basegame;
-static cvar_t *fs_cdpath;
-static cvar_t *fs_copyfiles;
static cvar_t *fs_gamedirvar;
-static cvar_t *fs_restrict;
static searchpath_t *fs_searchpaths;
static int fs_readCount; // total bytes read
static int fs_loadCount; // total files read
@@ -362,7 +335,7 @@ int FS_LoadStack( void )
{
return fs_loadStack;
}
-
+
/*
================
return a hash value for the filename
@@ -676,8 +649,9 @@ fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
/*
===========
FS_SV_FOpenFileRead
-search for a file somewhere below the home path, base path or cd path
-we search in that order, matching FS_SV_FOpenFileRead order
+
+Search for a file somewhere below the home path then base path
+in that order
===========
*/
int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
@@ -696,7 +670,7 @@ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
// don't let sound stutter
S_ClearSoundBuffer();
- // search homepath
+ // search homepath
ospath = FS_BuildOSPath( fs_homepath->string, filename, "" );
// remove trailing slash
ospath[strlen(ospath)-1] = '\0';
@@ -707,48 +681,30 @@ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
fsh[f].handleSync = qfalse;
- if (!fsh[f].handleFiles.file.o)
- {
- // NOTE TTimo on non *nix systems, fs_homepath == fs_basepath, might want to avoid
- if (Q_stricmp(fs_homepath->string,fs_basepath->string))
- {
- // search basepath
- ospath = FS_BuildOSPath( fs_basepath->string, filename, "" );
- ospath[strlen(ospath)-1] = '\0';
-
- if ( fs_debug->integer )
- {
- Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath );
- }
-
- fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
- fsh[f].handleSync = qfalse;
-
- if ( !fsh[f].handleFiles.file.o )
- {
- f = 0;
- }
- }
- }
+ if (!fsh[f].handleFiles.file.o)
+ {
+ // If fs_homepath == fs_basepath, don't bother
+ if (Q_stricmp(fs_homepath->string,fs_basepath->string))
+ {
+ // search basepath
+ ospath = FS_BuildOSPath( fs_basepath->string, filename, "" );
+ ospath[strlen(ospath)-1] = '\0';
+
+ if ( fs_debug->integer )
+ {
+ Com_Printf( "FS_SV_FOpenFileRead (fs_basepath): %s\n", ospath );
+ }
+
+ fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
+ fsh[f].handleSync = qfalse;
+ }
+
+ if ( !fsh[f].handleFiles.file.o )
+ {
+ f = 0;
+ }
+ }
- if (!fsh[f].handleFiles.file.o) {
- // search cd path
- ospath = FS_BuildOSPath( fs_cdpath->string, filename, "" );
- ospath[strlen(ospath)-1] = '\0';
-
- if (fs_debug->integer)
- {
- Com_Printf( "FS_SV_FOpenFileRead (fs_cdpath) : %s\n", ospath );
- }
-
- fsh[f].handleFiles.file.o = fopen( ospath, "rb" );
- fsh[f].handleSync = qfalse;
-
- if( !fsh[f].handleFiles.file.o ) {
- f = 0;
- }
- }
-
*fp = f;
if (f) {
return FS_filelength(f);
@@ -836,9 +792,6 @@ void FS_FCloseFile( fileHandle_t f ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
- if (fsh[f].streamed) {
- Sys_EndStreamedFile(f);
- }
if (fsh[f].zipFile == qtrue) {
unzCloseCurrentFile( fsh[f].handleFiles.file.z );
if ( fsh[f].handleFiles.unique ) {
@@ -1155,12 +1108,12 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
// if we are running restricted, the only files we
// will allow to come from the directory are .cfg files
l = strlen( filename );
- // FIXME TTimo I'm not sure about the fs_numServerPaks test
- // if you are using FS_ReadFile to find out if a file exists,
- // this test can make the search fail although the file is in the directory
- // I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
- // turned out I used FS_FileExists instead
- if ( fs_restrict->integer || fs_numServerPaks ) {
+ // FIXME TTimo I'm not sure about the fs_numServerPaks test
+ // if you are using FS_ReadFile to find out if a file exists,
+ // this test can make the search fail although the file is in the directory
+ // I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
+ // turned out I used FS_FileExists instead
+ if ( fs_numServerPaks ) {
if ( Q_stricmp( filename + l - 4, ".cfg" ) // for config files
&& Q_stricmp( filename + l - 5, ".menu" ) // menu files
@@ -1186,7 +1139,7 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
&& Q_stricmp( filename + l - 4, ".dat" ) ) { // for journal files
fs_fakeChkSum = random();
}
-
+
Q_strncpyz( fsh[*file].name, filename, sizeof( fsh[*file].name ) );
fsh[*file].zipFile = qfalse;
if ( fs_debug->integer ) {
@@ -1194,15 +1147,6 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
dir->path, dir->gamedir );
}
- // if we are getting it from the cdpath, optionally copy it
- // to the basepath
- if ( fs_copyfiles->integer && !Q_stricmp( dir->path, fs_cdpath->string ) ) {
- char *copypath;
-
- copypath = FS_BuildOSPath( fs_basepath->string, dir->gamedir, filename );
- FS_CopyFile( netpath, copypath );
- }
-
return FS_filelength (*file);
}
}
@@ -1235,7 +1179,7 @@ int FS_Read2( void *buffer, int len, fileHandle_t f ) {
if (fsh[f].streamed) {
int r;
fsh[f].streamed = qfalse;
- r = Sys_StreamedRead( buffer, len, 1, f);
+ r = FS_Read( buffer, len, f );
fsh[f].streamed = qtrue;
return r;
} else {
@@ -1371,7 +1315,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
if (fsh[f].streamed) {
fsh[f].streamed = qfalse;
- Sys_StreamSeek( f, offset, origin );
+ FS_Seek( f, offset, origin );
fsh[f].streamed = qtrue;
}
@@ -1946,7 +1890,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
char *name;
// don't scan directories for files if we are pure or restricted
- if ( fs_restrict->integer || fs_numServerPaks ) {
+ if ( fs_numServerPaks ) {
continue;
} else {
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
@@ -2060,58 +2004,51 @@ FIXME TTimo those two should move to common.c next to Sys_ListFiles
*/
static unsigned int Sys_CountFileList(char **list)
{
- int i = 0;
+ int i = 0;
- if (list)
- {
- while (*list)
- {
- list++;
- i++;
- }
- }
- return i;
+ if (list)
+ {
+ while (*list)
+ {
+ list++;
+ i++;
+ }
+ }
+ return i;
}
-static char** Sys_ConcatenateFileLists( char **list0, char **list1, char **list2 )
+static char** Sys_ConcatenateFileLists( char **list0, char **list1 )
{
- int totalLength = 0;
- char** cat = NULL, **dst, **src;
-
- totalLength += Sys_CountFileList(list0);
- totalLength += Sys_CountFileList(list1);
- totalLength += Sys_CountFileList(list2);
-
- /* Create new list. */
- dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
-
- /* Copy over lists. */
- if (list0)
- {
- for (src = list0; *src; src++, dst++)
- *dst = *src;
- }
- if (list1)
- {
- for (src = list1; *src; src++, dst++)
- *dst = *src;
- }
- if (list2)
- {
- for (src = list2; *src; src++, dst++)
- *dst = *src;
- }
-
- // Terminate the list
- *dst = NULL;
-
- // Free our old lists.
- // NOTE: not freeing their content, it's been merged in dst and still being used
- if (list0) Z_Free( list0 );
- if (list1) Z_Free( list1 );
- if (list2) Z_Free( list2 );
-
- return cat;
+ int totalLength = 0;
+ char** cat = NULL, **dst, **src;
+
+ totalLength += Sys_CountFileList(list0);
+ totalLength += Sys_CountFileList(list1);
+
+ /* Create new list. */
+ dst = cat = Z_Malloc( ( totalLength + 1 ) * sizeof( char* ) );
+
+ /* Copy over lists. */
+ if (list0)
+ {
+ for (src = list0; *src; src++, dst++)
+ *dst = *src;
+ }
+ if (list1)
+ {
+ for (src = list1; *src; src++, dst++)
+ *dst = *src;
+ }
+
+ // Terminate the list
+ *dst = NULL;
+
+ // Free our old lists.
+ // NOTE: not freeing their content, it's been merged in dst and still being used
+ if (list0) Z_Free( list0 );
+ if (list1) Z_Free( list1 );
+
+ return cat;
}
/*
@@ -2124,116 +2061,106 @@ The directories are searched in base path, cd path and home path
================
*/
int FS_GetModList( char *listbuf, int bufsize ) {
- int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen;
- char **pFiles = NULL;
- char **pPaks = NULL;
- char *name, *path;
- char descPath[MAX_OSPATH];
- fileHandle_t descHandle;
-
- int dummy;
- char **pFiles0 = NULL;
- char **pFiles1 = NULL;
- char **pFiles2 = NULL;
- qboolean bDrop = qfalse;
-
- *listbuf = 0;
- nMods = nPotential = nTotal = 0;
-
- pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
- pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
- pFiles2 = Sys_ListFiles( fs_cdpath->string, NULL, NULL, &dummy, qtrue );
- // we searched for mods in the three paths
- // it is likely that we have duplicate names now, which we will cleanup below
- pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1, pFiles2 );
- nPotential = Sys_CountFileList(pFiles);
-
- for ( i = 0 ; i < nPotential ; i++ ) {
- name = pFiles[i];
- // NOTE: cleaner would involve more changes
- // ignore duplicate mod directories
- if (i!=0) {
- bDrop = qfalse;
- for(j=0; j<i; j++)
- {
- if (Q_stricmp(pFiles[j],name)==0) {
- // this one can be dropped
- bDrop = qtrue;
- break;
- }
- }
- }
- if (bDrop) {
- continue;
- }
- // we drop "baseq3" "." and ".."
- if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
- // now we need to find some .pk3 files to validate the mod
- // NOTE TTimo: (actually I'm not sure why .. what if it's a mod under developement with no .pk3?)
- // we didn't keep the information when we merged the directory names, as to what OS Path it was found under
- // so it could be in base path, cd path or home path
- // we will try each three of them here (yes, it's a bit messy)
- path = FS_BuildOSPath( fs_basepath->string, name, "" );
- nPaks = 0;
- pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse);
- Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present
-
- /* Try on cd path */
- if( nPaks <= 0 ) {
- path = FS_BuildOSPath( fs_cdpath->string, name, "" );
- nPaks = 0;
- pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
- Sys_FreeFileList( pPaks );
- }
-
- /* try on home path */
- if ( nPaks <= 0 )
- {
- path = FS_BuildOSPath( fs_homepath->string, name, "" );
- nPaks = 0;
- pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
- Sys_FreeFileList( pPaks );
- }
-
- if (nPaks > 0) {
- nLen = strlen(name) + 1;
- // nLen is the length of the mod path
- // we need to see if there is a description available
- descPath[0] = '\0';
- strcpy(descPath, name);
- strcat(descPath, "/description.txt");
- nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
- if ( nDescLen > 0 && descHandle) {
- FILE *file;
- file = FS_FileForHandle(descHandle);
- Com_Memset( descPath, 0, sizeof( descPath ) );
- nDescLen = fread(descPath, 1, 48, file);
- if (nDescLen >= 0) {
- descPath[nDescLen] = '\0';
- }
- FS_FCloseFile(descHandle);
- } else {
- strcpy(descPath, name);
- }
- nDescLen = strlen(descPath) + 1;
-
- if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) {
- strcpy(listbuf, name);
- listbuf += nLen;
- strcpy(listbuf, descPath);
- listbuf += nDescLen;
- nTotal += nLen + nDescLen;
- nMods++;
- }
- else {
- break;
- }
- }
- }
- }
- Sys_FreeFileList( pFiles );
-
- return nMods;
+ int nMods, i, j, nTotal, nLen, nPaks, nPotential, nDescLen;
+ char **pFiles = NULL;
+ char **pPaks = NULL;
+ char *name, *path;
+ char descPath[MAX_OSPATH];
+ fileHandle_t descHandle;
+
+ int dummy;
+ char **pFiles0 = NULL;
+ char **pFiles1 = NULL;
+ qboolean bDrop = qfalse;
+
+ *listbuf = 0;
+ nMods = nPotential = nTotal = 0;
+
+ pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
+ pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
+ // we searched for mods in the three paths
+ // it is likely that we have duplicate names now, which we will cleanup below
+ pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+ nPotential = Sys_CountFileList(pFiles);
+
+ for ( i = 0 ; i < nPotential ; i++ ) {
+ name = pFiles[i];
+ // NOTE: cleaner would involve more changes
+ // ignore duplicate mod directories
+ if (i!=0) {
+ bDrop = qfalse;
+ for(j=0; j<i; j++)
+ {
+ if (Q_stricmp(pFiles[j],name)==0) {
+ // this one can be dropped
+ bDrop = qtrue;
+ break;
+ }
+ }
+ }
+ if (bDrop) {
+ continue;
+ }
+ // we drop "baseq3" "." and ".."
+ if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
+ // now we need to find some .pk3 files to validate the mod
+ // NOTE TTimo: (actually I'm not sure why .. what if it's a mod under developement with no .pk3?)
+ // we didn't keep the information when we merged the directory names, as to what OS Path it was found under
+ // so it could be in base path, cd path or home path
+ // we will try each three of them here (yes, it's a bit messy)
+ path = FS_BuildOSPath( fs_basepath->string, name, "" );
+ nPaks = 0;
+ pPaks = Sys_ListFiles(path, ".pk3", NULL, &nPaks, qfalse);
+ Sys_FreeFileList( pPaks ); // we only use Sys_ListFiles to check wether .pk3 files are present
+
+ /* try on home path */
+ if ( nPaks <= 0 )
+ {
+ path = FS_BuildOSPath( fs_homepath->string, name, "" );
+ nPaks = 0;
+ pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
+ Sys_FreeFileList( pPaks );
+ }
+
+ if (nPaks > 0) {
+ nLen = strlen(name) + 1;
+ // nLen is the length of the mod path
+ // we need to see if there is a description available
+ descPath[0] = '\0';
+ strcpy(descPath, name);
+ strcat(descPath, "/description.txt");
+ nDescLen = FS_SV_FOpenFileRead( descPath, &descHandle );
+ if ( nDescLen > 0 && descHandle) {
+ FILE *file;
+ file = FS_FileForHandle(descHandle);
+ Com_Memset( descPath, 0, sizeof( descPath ) );
+ nDescLen = fread(descPath, 1, 48, file);
+ if (nDescLen >= 0) {
+ descPath[nDescLen] = '\0';
+ }
+ FS_FCloseFile(descHandle);
+ } else {
+ strcpy(descPath, name);
+ }
+ nDescLen = strlen(descPath) + 1;
+
+ if (nTotal + nLen + 1 + nDescLen + 1 < bufsize) {
+ strcpy(listbuf, name);
+ listbuf += nLen;
+ strcpy(listbuf, descPath);
+ listbuf += nDescLen;
+ nTotal += nLen + nDescLen;
+ nMods++;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
+ Sys_FreeFileList( pFiles );
+
+ return nMods;
}
@@ -2300,7 +2227,7 @@ Ignore case and seprator char distinctions
*/
int FS_PathCmp( const char *s1, const char *s2 ) {
int c1, c2;
-
+
do {
c1 = *s1++;
c2 = *s2++;
@@ -2429,9 +2356,6 @@ void FS_Path_f( void ) {
/*
============
FS_TouchFile_f
-
-The only purpose of this function is to allow game script files to copy
-arbitrary files furing an "fs_copyfiles 1" run.
============
*/
void FS_TouchFile_f( void ) {
@@ -2477,8 +2401,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
int numfiles;
char **pakfiles;
- // this fixes the case where fs_basepath is the same as fs_cdpath
- // which happens on full installs
+ // Unique
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->dir && !Q_stricmp(sp->dir->path, path) && !Q_stricmp(sp->dir->gamedir, dir)) {
return; // we've already got this one
@@ -2609,10 +2532,10 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
// Make sure the server cannot make us write to non-quake3 directories.
if(FS_CheckDirTraversal(fs_serverReferencedPakNames[i]))
- {
+ {
Com_Printf("WARNING: Invalid download name %s\n", fs_serverReferencedPakNames[i]);
- continue;
- }
+ continue;
+ }
for ( sp = fs_searchpaths ; sp ; sp = sp->next ) {
if ( sp->pack && sp->pack->checksum == fs_serverReferencedPaks[i] ) {
@@ -2624,54 +2547,55 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
if ( !havepak && fs_serverReferencedPakNames[i] && *fs_serverReferencedPakNames[i] ) {
// Don't got it
- if (dlstring)
- {
- // We need this to make sure we won't hit the end of the buffer or the server could
- // overwrite non-pk3 files on clients by writing so much crap into neededpaks that
- // Q_strcat cuts off the .pk3 extension.
-
- origpos += strlen(origpos);
-
- // Remote name
- Q_strcat( neededpaks, len, "@");
- Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
- Q_strcat( neededpaks, len, ".pk3" );
-
- // Local name
- Q_strcat( neededpaks, len, "@");
- // Do we have one with the same name?
- if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
- {
- char st[MAX_ZPATH];
- // We already have one called this, we need to download it to another name
- // Make something up with the checksum in it
- Com_sprintf( st, sizeof( st ), "%s.%08x.pk3", fs_serverReferencedPakNames[i], fs_serverReferencedPaks[i] );
- Q_strcat( neededpaks, len, st );
- } else
- {
- Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
- Q_strcat( neededpaks, len, ".pk3" );
- }
-
- // Find out whether it might have overflowed the buffer and don't add this file to the
- // list if that is the case.
- if(strlen(origpos) + (origpos - neededpaks) >= len - 1)
- {
- *origpos = '\0';
- break;
- }
- }
- else
- {
- Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
- Q_strcat( neededpaks, len, ".pk3" );
- // Do we have one with the same name?
- if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
- {
- Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
- }
- Q_strcat( neededpaks, len, "\n");
- }
+ if (dlstring)
+ {
+ // We need this to make sure we won't hit the end of the buffer or the server could
+ // overwrite non-pk3 files on clients by writing so much crap into neededpaks that
+ // Q_strcat cuts off the .pk3 extension.
+
+ origpos += strlen(origpos);
+
+ // Remote name
+ Q_strcat( neededpaks, len, "@");
+ Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
+ Q_strcat( neededpaks, len, ".pk3" );
+
+ // Local name
+ Q_strcat( neededpaks, len, "@");
+ // Do we have one with the same name?
+ if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
+ {
+ char st[MAX_ZPATH];
+ // We already have one called this, we need to download it to another name
+ // Make something up with the checksum in it
+ Com_sprintf( st, sizeof( st ), "%s.%08x.pk3", fs_serverReferencedPakNames[i], fs_serverReferencedPaks[i] );
+ Q_strcat( neededpaks, len, st );
+ }
+ else
+ {
+ Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
+ Q_strcat( neededpaks, len, ".pk3" );
+ }
+
+ // Find out whether it might have overflowed the buffer and don't add this file to the
+ // list if that is the case.
+ if(strlen(origpos) + (origpos - neededpaks) >= len - 1)
+ {
+ *origpos = '\0';
+ break;
+ }
+ }
+ else
+ {
+ Q_strcat( neededpaks, len, fs_serverReferencedPakNames[i] );
+ Q_strcat( neededpaks, len, ".pk3" );
+ // Do we have one with the same name?
+ if ( FS_SV_FileExists( va( "%s.pk3", fs_serverReferencedPakNames[i] ) ) )
+ {
+ Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
+ }
+ Q_strcat( neededpaks, len, "\n");
+ }
}
}
@@ -2731,7 +2655,7 @@ void FS_Shutdown( qboolean closemfp ) {
void Com_AppendCDKey( const char *filename );
void Com_ReadCDKey( const char *filename );
-
+
/*
================
FS_ReorderPurePaks
@@ -2745,14 +2669,14 @@ static void FS_ReorderPurePaks( void )
int i;
searchpath_t **p_insert_index, // for linked list reordering
**p_previous; // when doing the scan
-
+
// only relevant when connected to pure server
if ( !fs_numServerPaks )
return;
-
+
fs_reordered = qfalse;
-
- p_insert_index = &fs_searchpaths; // we insert in order at the beginning of the list
+
+ p_insert_index = &fs_searchpaths; // we insert in order at the beginning of the list
for ( i = 0 ; i < fs_numServerPaks ; i++ ) {
p_previous = p_insert_index; // track the pointer-to-current-item
for (s = *p_insert_index; s; s = s->next) {
@@ -2767,7 +2691,7 @@ static void FS_ReorderPurePaks( void )
p_insert_index = &s->next;
break; // iterate to next server pack
}
- p_previous = &s->next;
+ p_previous = &s->next;
}
}
}
@@ -2777,43 +2701,35 @@ static void FS_ReorderPurePaks( void )
FS_Startup
================
*/
-static void FS_Startup( const char *gameName ) {
- const char *homePath;
+static void FS_Startup( const char *gameName )
+{
+ const char *homePath;
cvar_t *fs;
Com_Printf( "----- FS_Startup -----\n" );
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
- fs_copyfiles = Cvar_Get( "fs_copyfiles", "0", CVAR_INIT );
- fs_cdpath = Cvar_Get ("fs_cdpath", Sys_DefaultCDPath(), CVAR_INIT );
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
- homePath = Sys_DefaultHomePath();
- if (!homePath || !homePath[0]) {
+ homePath = Sys_DefaultHomePath();
+ if (!homePath || !homePath[0]) {
homePath = fs_basepath->string;
}
fs_homepath = Cvar_Get ("fs_homepath", homePath, CVAR_INIT );
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
- fs_restrict = Cvar_Get ("fs_restrict", "", CVAR_INIT );
// add search path elements in reverse priority order
- if (fs_cdpath->string[0]) {
- FS_AddGameDirectory( fs_cdpath->string, gameName );
- }
if (fs_basepath->string[0]) {
FS_AddGameDirectory( fs_basepath->string, gameName );
}
- // fs_homepath is somewhat particular to *nix systems, only add if relevant
- // NOTE: same filtering below for mods and basegame
- if (fs_basepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
+ // fs_homepath is somewhat particular to *nix systems, only add if relevant
+ // NOTE: same filtering below for mods and basegame
+ if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
FS_AddGameDirectory ( fs_homepath->string, gameName );
}
-
+
// check for additional base game so mods can be based upon other mods
if ( fs_basegame->string[0] && !Q_stricmp( gameName, BASEGAME ) && Q_stricmp( fs_basegame->string, gameName ) ) {
- if (fs_cdpath->string[0]) {
- FS_AddGameDirectory(fs_cdpath->string, fs_basegame->string);
- }
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
}
@@ -2824,9 +2740,6 @@ static void FS_Startup( const char *gameName ) {
// check for additional game folder for mods
if ( fs_gamedirvar->string[0] && !Q_stricmp( gameName, BASEGAME ) && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
- if (fs_cdpath->string[0]) {
- FS_AddGameDirectory(fs_cdpath->string, fs_gamedirvar->string);
- }
if (fs_basepath->string[0]) {
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
}
@@ -2850,7 +2763,7 @@ static void FS_Startup( const char *gameName ) {
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=506
// reorder the pure pk3 files according to server order
FS_ReorderPurePaks();
-
+
// print the current search paths
FS_Path_f();
@@ -3326,12 +3239,9 @@ void FS_InitFilesystem( void ) {
// we have to specially handle this, because normal command
// line variable sets don't happen until after the filesystem
// has already been initialized
- Com_StartupVariable( "fs_cdpath" );
Com_StartupVariable( "fs_basepath" );
Com_StartupVariable( "fs_homepath" );
Com_StartupVariable( "fs_game" );
- Com_StartupVariable( "fs_copyfiles" );
- Com_StartupVariable( "fs_restrict" );
// try to start up normally
FS_Startup( BASEGAME );
@@ -3343,13 +3253,10 @@ void FS_InitFilesystem( void ) {
// graphics screen when the font fails to load
if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
- // bk001208 - SafeMode see below, FIXME?
}
Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));
-
- // bk001208 - SafeMode see below, FIXME?
}
@@ -3386,7 +3293,6 @@ void FS_Restart( int checksumFeed ) {
Cvar_Set("fs_gamedirvar", lastValidGame);
lastValidBase[0] = '\0';
lastValidGame[0] = '\0';
- Cvar_Set( "fs_restrict", "0" );
FS_Restart(checksumFeed);
Com_Error( ERR_DROP, "Invalid game folder\n" );
return;
@@ -3394,7 +3300,6 @@ void FS_Restart( int checksumFeed ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
}
- // bk010116 - new check before safeMode
if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) {
// skip the q3config.cfg if "safe" is on the command line
if ( !Com_SafeMode() ) {
@@ -3474,7 +3379,6 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
fsh[*f].streamed = qfalse;
if (mode == FS_READ) {
- Sys_BeginStreamedFile( *f, 0x4000 );
fsh[*f].streamed = qtrue;
}
}
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index 9248db3..dadfbd3 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -1026,28 +1026,22 @@ void NET_Shutdown( void ) {
====================
NET_Sleep
-Sleeps msec or until net socket is ready
+Sleeps msec or until something happens on the network or stdin
====================
*/
void NET_Sleep( int msec ) {
struct timeval timeout;
fd_set fdset;
-#ifndef _WIN32 //FIXME
- extern qboolean stdin_active;
-#endif
int highestfd = 0;
if (!com_dedicated->integer)
return; // we're not a server, just run full speed
FD_ZERO(&fdset);
-#ifndef _WIN32 //FIXME
- if (stdin_active)
- {
- FD_SET(0, &fdset); // stdin is processed too
- highestfd = 1;
- }
-#endif
+
+ FD_SET(fileno(stdin), &fdset);
+ highestfd = fileno(stdin) + 1;
+
if(ip_socket)
{
FD_SET(ip_socket, &fdset); // network socket
diff --git a/code/qcommon/q_math.c b/code/qcommon/q_math.c
index ae2de69..bfaa60a 100644
--- a/code/qcommon/q_math.c
+++ b/code/qcommon/q_math.c
@@ -447,7 +447,7 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
inv_denom = DotProduct( normal, normal );
#ifndef Q3_VM
- assert( Q_fabs(inv_denom) != 0.0f ); // bk010122 - zero vectors get here
+ assert( Q_fabs(inv_denom) != 0.0f ); // zero vectors get here
#endif
inv_denom = 1.0f / inv_denom;
@@ -515,7 +515,6 @@ float Q_rsqrt( float number )
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
- //assert( !isnan(y) ); // bk010122 - FPE?
return y;
}
@@ -1110,17 +1109,11 @@ vec_t VectorNormalize2( const vec3_t v, vec3_t out) {
if (length)
{
-#ifndef Q3_VM // bk0101022 - FPE related
-// assert( ((Q_fabs(v[0])!=0.0f) || (Q_fabs(v[1])!=0.0f) || (Q_fabs(v[2])!=0.0f)) );
-#endif
ilength = 1/length;
out[0] = v[0]*ilength;
out[1] = v[1]*ilength;
out[2] = v[2]*ilength;
} else {
-#ifndef Q3_VM // bk0101022 - FPE related
-// assert( ((Q_fabs(v[0])==0.0f) && (Q_fabs(v[1])==0.0f) && (Q_fabs(v[2])==0.0f)) );
-#endif
VectorClear( out );
}
diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h
index 2d4306a..4468904 100644
--- a/code/qcommon/q_platform.h
+++ b/code/qcommon/q_platform.h
@@ -168,7 +168,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//=============================================================== FreeBSD ===
-#ifdef __FreeBSD__ // rb010123
+#ifdef __FreeBSD__
#include <machine/endian.h>
diff --git a/code/qcommon/q_shared.c b/code/qcommon/q_shared.c
index a68b283..81e4e80 100644
--- a/code/qcommon/q_shared.c
+++ b/code/qcommon/q_shared.c
@@ -734,7 +734,6 @@ Safe strncpy that ensures a trailing zero
=============
*/
void Q_strncpyz( char *dest, const char *src, int destsize ) {
- // bk001129 - also NULL dest
if ( !dest ) {
Com_Error( ERR_FATAL, "Q_strncpyz: NULL dest" );
}
@@ -752,7 +751,6 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) {
int Q_stricmpn (const char *s1, const char *s2, int n) {
int c1, c2;
- // bk001129 - moved in 1.17 fix not in id codebase
if ( s1 == NULL ) {
if ( s2 == NULL )
return 0;
@@ -846,6 +844,38 @@ void Q_strcat( char *dest, int size, const char *src ) {
Q_strncpyz( dest + l1, src, size - l1 );
}
+/*
+* Find the first occurrence of find in s.
+*/
+const char *Q_stristr( const char *s, const char *find)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0)
+ {
+ if (c >= 'a' && c <= 'z')
+ {
+ c -= ('a' - 'A');
+ }
+ len = strlen(find);
+ do
+ {
+ do
+ {
+ if ((sc = *s++) == 0)
+ return NULL;
+ if (sc >= 'a' && sc <= 'z')
+ {
+ sc -= ('a' - 'A');
+ }
+ } while (sc != c);
+ } while (Q_stricmpn(s, find, len) != 0);
+ s--;
+ }
+ return s;
+}
+
int Q_PrintStrlen( const char *string ) {
int len;
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index fcd48e0..12dd36e 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -26,14 +26,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
-#define Q3_VERSION "ioQ3 1.33"
-#ifndef SVN_VERSION
- #define SVN_VERSION Q3_VERSION
+#define Q3_VERSION_BASE "ioq3 1.35"
+#ifdef SVN_VERSION
+# define Q3_VERSION Q3_VERSION_BASE "_SVN" SVN_VERSION
+#else
+# define Q3_VERSION Q3_VERSION_BASE
#endif
-#define CLIENT_WINDOW_TITLE "ioquake3"
-#define CLIENT_WINDOW_ICON "ioq3"
-#define CONSOLE_WINDOW_TITLE "ioquake3 console"
-#define CONSOLE_WINDOW_ICON "ioq3 console"
+
+#define CLIENT_WINDOW_TITLE "ioquake3"
+#define CLIENT_WINDOW_MIN_TITLE "ioq3"
// 1.32 released 7-10-2002
#define BASEGAME "baseq3"
@@ -262,14 +263,6 @@ void *Hunk_AllocDebug( int size, ha_pref preference, char *label, char *file, in
void *Hunk_Alloc( int size, ha_pref preference );
#endif
-#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(MACOS_X)
-// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
-// custom Snd_Memset implementation for glibc memset bug workaround
-void Snd_Memset (void* dest, const int val, const size_t count);
-#else
-#define Snd_Memset Com_Memset
-#endif
-
#define Com_Memset memset
#define Com_Memcpy memcpy
@@ -678,6 +671,7 @@ int Q_stricmpn (const char *s1, const char *s2, int n);
char *Q_strlwr( char *s1 );
char *Q_strupr( char *s1 );
char *Q_strrchr( const char* string, int c );
+const char *Q_stristr( const char *s, const char *find);
// buffer size safe library replacements
void Q_strncpyz( char *dest, const char *src, int destsize );
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 6382843..a563ef9 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -687,13 +687,11 @@ MISC
==============================================================
*/
-// TTimo
// vsnprintf is ISO/IEC 9899:1999
// abstracting this to make it portable
#ifdef WIN32
#define Q_vsnprintf _vsnprintf
#else
-// TODO: do we need Mac define?
#define Q_vsnprintf vsnprintf
#endif
@@ -701,21 +699,45 @@ MISC
// 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
+// returned by Sys_GetProcessorFeatures
+typedef enum
+{
+ CF_RDTSC = 1 << 0,
+ CF_MMX = 1 << 1,
+ CF_MMX_EXT = 1 << 2,
+ CF_3DNOW = 1 << 3,
+ CF_3DNOW_EXT = 1 << 4,
+ CF_SSE = 1 << 5,
+ CF_SSE2 = 1 << 6,
+ CF_ALTIVEC = 1 << 7
+} cpuFeatures_t;
-#define CPUID_AXP 0x10
+// centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
+#define MAXPRINTMSG 4096
-#define CPUID_INTEL_UNSUPPORTED 0x20 // Intel 386/486
-#define CPUID_INTEL_PENTIUM 0x21 // Intel Pentium or PPro
-#define CPUID_INTEL_MMX 0x22 // Intel Pentium/MMX or P2/MMX
-#define CPUID_INTEL_KATMAI 0x23 // Intel Katmai
-#define CPUID_AMD_3DNOW 0x30 // AMD K6 3DNOW!
+typedef enum {
+ // SE_NONE must be zero
+ SE_NONE = 0, // evTime is still valid
+ SE_KEY, // evValue is a key code, evValue2 is the down flag
+ SE_CHAR, // evValue is an ascii char
+ SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
+ SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127)
+ SE_CONSOLE, // evPtr is a char*
+ SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength
+} sysEventType_t;
+
+typedef struct {
+ int evTime;
+ sysEventType_t evType;
+ int evValue, evValue2;
+ int evPtrLength; // bytes of data pointed to by evPtr, for journaling
+ void *evPtr; // this must be manually freed if not NULL
+} sysEvent_t;
-// TTimo
-// centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
-#define MAXPRINTMSG 4096
+void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr );
+int Com_EventLoop( void );
+sysEvent_t Com_GetSystemEvent( void );
char *CopyString( const char *in );
void Info_Print( const char *s );
@@ -726,7 +748,7 @@ void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf,
void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void Com_Quit_f( void );
-int Com_EventLoop( void );
+
int Com_Milliseconds( void ); // will be journaled properly
unsigned Com_BlockChecksum( const void *buffer, int length );
char *Com_MD5File(const char *filename, int length, const char *prefix, int prefix_len);
@@ -748,12 +770,14 @@ extern cvar_t *com_speeds;
extern cvar_t *com_timescale;
extern cvar_t *com_sv_running;
extern cvar_t *com_cl_running;
-extern cvar_t *com_viewlog; // 0 = hidden, 1 = visible, 2 = minimized
extern cvar_t *com_version;
extern cvar_t *com_blood;
extern cvar_t *com_buildScript; // for building release pak files
extern cvar_t *com_journal;
extern cvar_t *com_cameraMode;
+extern cvar_t *com_ansiColor;
+extern cvar_t *com_unfocused;
+extern cvar_t *com_minimized;
extern cvar_t *com_altivec;
// both client and server must agree to pause
@@ -897,7 +921,7 @@ void CL_ShutdownAll( void );
void CL_FlushMemory( void );
// dump all memory on an error
-void CL_StartHunkUsers( void );
+void CL_StartHunkUsers( qboolean rendererOnly );
// start all the client stuff using the hunk
void Key_WriteBindings( fileHandle_t f );
@@ -942,31 +966,9 @@ typedef enum {
MAX_JOYSTICK_AXIS
} joystickAxis_t;
-typedef enum {
- // bk001129 - make sure SE_NONE is zero
- SE_NONE = 0, // evTime is still valid
- SE_KEY, // evValue is a key code, evValue2 is the down flag
- SE_CHAR, // evValue is an ascii char
- SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
- SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127)
- SE_CONSOLE, // evPtr is a char*
- SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength
-} sysEventType_t;
-
-typedef struct {
- int evTime;
- sysEventType_t evType;
- int evValue, evValue2;
- int evPtrLength; // bytes of data pointed to by evPtr, for journaling
- void *evPtr; // this must be manually freed if not NULL
-} sysEvent_t;
-
-sysEvent_t Sys_GetEvent( void );
-
void Sys_Init (void);
// general development dll loading for virtual machine testing
-// fqpath param added 7/20/02 by T.Ray - Sys_LoadDll is only called in vm.c at this time
void * QDECL Sys_LoadDll( const char *name, char *fqpath , intptr_t (QDECL **entryPoint)(int, ...),
intptr_t (QDECL *systemcalls)(intptr_t, ...) );
void Sys_UnloadDll( void *dllHandle );
@@ -1003,17 +1005,12 @@ qboolean Sys_RandomBytes( byte *string, int len );
// the system console is shown when a dedicated server is running
void Sys_DisplaySystemConsole( qboolean show );
-int Sys_GetProcessorId( void );
-
-void Sys_BeginStreamedFile( fileHandle_t f, int readahead );
-void Sys_EndStreamedFile( fileHandle_t f );
-int Sys_StreamedRead( void *buffer, int size, int count, fileHandle_t f );
-void Sys_StreamSeek( fileHandle_t f, int offset, int origin );
+cpuFeatures_t Sys_GetProcessorFeatures( void );
-void Sys_ShowConsole( int level, qboolean quitOnClose );
void Sys_SetErrorText( const char *text );
void Sys_SendPacket( int length, const void *data, netadr_t to );
+qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
qboolean Sys_StringToAdr( const char *s, netadr_t *a );
//Does NOT parse port numbers, only base addresses.
@@ -1021,29 +1018,20 @@ qboolean Sys_StringToAdr( const char *s, netadr_t *a );
qboolean Sys_IsLANAddress (netadr_t adr);
void Sys_ShowIP(void);
-qboolean Sys_CheckCD( void );
-
void Sys_Mkdir( const char *path );
char *Sys_Cwd( void );
-void Sys_SetDefaultCDPath(const char *path);
-char *Sys_DefaultCDPath(void);
void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void);
void Sys_SetDefaultHomePath(const char *path);
char *Sys_DefaultHomePath(void);
+const char *Sys_Dirname( char *path );
+const char *Sys_Basename( char *path );
+char *Sys_ConsoleInput(void);
char **Sys_ListFiles( const char *directory, const char *extension, char *filter, int *numfiles, qboolean wantsubs );
void Sys_FreeFileList( char **list );
-void Sys_BeginProfiling( void );
-void Sys_EndProfiling( void );
-
qboolean Sys_LowPhysicalMemory( void );
-unsigned int Sys_ProcessorCount( void );
-
-int Sys_MonkeyShouldBeSpanked( void );
-
-qboolean Sys_DetectAltivec( void );
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
* Compression book. The ranks are not actually stored, but implicitly defined
diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
index 0e35791..ecc29c1 100644
--- a/code/qcommon/vm.c
+++ b/code/qcommon/vm.c
@@ -36,8 +36,8 @@ and one exported function: Perform
#include "vm_local.h"
-vm_t *currentVM = NULL; // bk001212
-vm_t *lastVM = NULL; // bk001212
+vm_t *currentVM = NULL;
+vm_t *lastVM = NULL;
int vm_debugLevel;
#define MAX_VM 3
@@ -543,13 +543,6 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls;
- // never allow dll loading with a demo
- if ( interpret == VMI_NATIVE ) {
- if ( Cvar_VariableValue( "fs_restrict" ) ) {
- interpret = VMI_COMPILED;
- }
- }
-
if ( interpret == VMI_NATIVE ) {
// try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name );
@@ -655,7 +648,7 @@ void *VM_ArgPtr( intptr_t intValue ) {
if ( !intValue ) {
return NULL;
}
- // bk001220 - currentVM is missing on reconnect
+ // currentVM is missing on reconnect
if ( currentVM==NULL )
return NULL;
@@ -672,7 +665,7 @@ void *VM_ExplicitArgPtr( vm_t *vm, intptr_t intValue ) {
return NULL;
}
- // bk010124 - currentVM is missing on reconnect here as well?
+ // currentVM is missing on reconnect here as well?
if ( currentVM==NULL )
return NULL;
@@ -773,7 +766,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
#endif
}
- if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
+ if ( oldVM != NULL )
currentVM = oldVM;
return r;
}
diff --git a/code/qcommon/vm_interpreted.c b/code/qcommon/vm_interpreted.c
index a6be7c7..3a41e6b 100644
--- a/code/qcommon/vm_interpreted.c
+++ b/code/qcommon/vm_interpreted.c
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vm_local.h"
//#define DEBUG_VM
-#ifdef DEBUG_VM // bk001204
+#ifdef DEBUG_VM
static char *opnames[256] = {
"OP_UNDEF",
diff --git a/code/qcommon/vm_local.h b/code/qcommon/vm_local.h
index 24f996a..8e81b36 100644
--- a/code/qcommon/vm_local.h
+++ b/code/qcommon/vm_local.h
@@ -160,7 +160,6 @@ struct vm_s {
int breakFunction; // increment breakCount on function entry to this
int breakCount;
-// fqpath member added 7/20/02 by T.Ray
char fqpath[MAX_QPATH+1] ;
byte *jumpTableTargets;
diff --git a/code/qcommon/vm_x86.c b/code/qcommon/vm_x86.c
index 8b6e4a1..ac8dd1a 100644
--- a/code/qcommon/vm_x86.c
+++ b/code/qcommon/vm_x86.c
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h>
#endif
-#ifdef __FreeBSD__ // rb0101023
+#ifdef __FreeBSD__
#include <sys/types.h>
#endif
@@ -77,13 +77,11 @@ static int asmCallPtr = (int)AsmCall;
#else // _MSC_VER
#if defined( FTOL_PTR )
-// bk001213 - BEWARE: does not work! UI menu etc. broken - stack!
-// bk001119 - added: int gftol( float x ) { return (int)x; }
-int qftol( void ); // bk001213 - label, see unix/ftol.nasm
-int qftol027F( void ); // bk001215 - fixed FPU control variants
+int qftol( void );
+int qftol027F( void );
int qftol037F( void );
-int qftol0E7F( void ); // bk010102 - fixed bogus bits (duh)
+int qftol0E7F( void );
int qftol0F7F( void );
@@ -95,7 +93,7 @@ static int asmCallPtr = (int)doAsmCall;
#endif
-static int callMask = 0; // bk001213 - init
+static int callMask = 0;
static int instruction, pass;
static int lastConst = 0;
@@ -1020,7 +1018,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
EmitString( "D9 1F" ); // fstp dword ptr [edi]
break;
case OP_CVFI:
-#ifndef FTOL_PTR // WHENHELLISFROZENOVER // bk001213 - was used in 1.17
+#ifndef FTOL_PTR // WHENHELLISFROZENOVER
// not IEEE complient, but simple and fast
EmitString( "D9 07" ); // fld dword ptr [edi]
EmitString( "DB 1F" ); // fistp dword ptr [edi]
diff --git a/code/qcommon/vm_x86_64.c b/code/qcommon/vm_x86_64.c
index 1d6ca63..c0fbfb0 100644
--- a/code/qcommon/vm_x86_64.c
+++ b/code/qcommon/vm_x86_64.c
@@ -109,7 +109,7 @@ static long callAsmCall(long callProgramStack, long callSyscallNum)
return ret;
}
-#ifdef DEBUG_VM // bk001204
+#ifdef DEBUG_VM
static char *opnames[256] = {
"OP_UNDEF",