[iortcw] 02/10: Imported Upstream version 1.42b+20150930+dfsg1
Simon McVittie
smcv at debian.org
Sun Oct 4 23:16:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository iortcw.
commit 1d48068666a4c45d0239e77ac80e09e5d33ad943
Author: Simon McVittie <smcv at debian.org>
Date: Fri Oct 2 10:33:45 2015 +0100
Imported Upstream version 1.42b+20150930+dfsg1
---
MP/code/botlib/be_aas_routetable.c | 2 +-
MP/code/cgame/cg_newdraw.c | 2 +-
MP/code/cgame/cg_scoreboard.c | 4 +--
MP/code/client/cl_curl.c | 19 +++++++++---
MP/code/qcommon/cm_patch.c | 2 +-
MP/code/qcommon/cmd.c | 8 +++--
MP/code/qcommon/cvar.c | 3 ++
MP/code/qcommon/files.c | 63 ++++++++++++++++++++++++++++++++++++++
MP/code/qcommon/q_shared.h | 4 +++
MP/code/qcommon/qcommon.h | 4 +++
MP/code/qcommon/unzip.c | 2 +-
MP/code/sys/sys_unix.c | 34 ++++++++++++++++++++
MP/code/sys/sys_win32.c | 63 ++++++++++++++++++++++++++++++++++++++
MP/code/ui/ui_main.c | 2 +-
SP/code/botlib/be_aas_routetable.c | 2 +-
SP/code/cgame/cg_newdraw.c | 2 +-
SP/code/client/cl_curl.c | 19 +++++++++---
SP/code/qcommon/cm_patch.c | 2 +-
SP/code/qcommon/cmd.c | 8 +++--
SP/code/qcommon/cvar.c | 3 ++
SP/code/qcommon/files.c | 61 ++++++++++++++++++++++++++++++++++++
SP/code/qcommon/q_shared.h | 4 +++
SP/code/qcommon/qcommon.h | 4 +++
SP/code/qcommon/unzip.c | 2 +-
SP/code/sys/sys_unix.c | 34 ++++++++++++++++++++
SP/code/sys/sys_win32.c | 63 ++++++++++++++++++++++++++++++++++++++
SP/code/ui/ui_main.c | 2 +-
27 files changed, 394 insertions(+), 24 deletions(-)
diff --git a/MP/code/botlib/be_aas_routetable.c b/MP/code/botlib/be_aas_routetable.c
index 345bf8d..7dd793d 100644
--- a/MP/code/botlib/be_aas_routetable.c
+++ b/MP/code/botlib/be_aas_routetable.c
@@ -1383,7 +1383,7 @@ qboolean AAS_RT_GetHidePos( vec3_t srcpos, int srcnum, int srcarea, vec3_t destp
if ( !destVisLookup[rt->parentLinks[travChild->startParentLinks].parent] ) {
// success ?
if ( !botimport.AICast_VisibleFromPos( destpos, destnum, ( *aasworld ).areas[pathArea].center, srcnum, qfalse ) ) {
- // SUCESS !!
+ // SUCCESS !!
travParent = &rt->parents[rt->parentLinks[travChild->startParentLinks].parent];
break;
}
diff --git a/MP/code/cgame/cg_newdraw.c b/MP/code/cgame/cg_newdraw.c
index f30895e..21b0148 100644
--- a/MP/code/cgame/cg_newdraw.c
+++ b/MP/code/cgame/cg_newdraw.c
@@ -1883,7 +1883,7 @@ static void CG_Text_Paint_Limit( float *maxX, float x, float y, float scale, vec
continue;
} else {
float yadj = useScale * glyph->top;
- if ( CG_Text_Width( s, useScale, 1 ) + x > max ) {
+ if ( CG_Text_Width( s, scale, 1 ) + x > max ) {
*maxX = 0;
break;
}
diff --git a/MP/code/cgame/cg_scoreboard.c b/MP/code/cgame/cg_scoreboard.c
index 2e4951b..edf7d83 100644
--- a/MP/code/cgame/cg_scoreboard.c
+++ b/MP/code/cgame/cg_scoreboard.c
@@ -511,13 +511,13 @@ static int WM_DrawInfoLine( int x, int y, float fade ) {
// second round
if ( !defender ) {
if ( winner != defender ) {
- s = "Allies sucessfully beat the clock!";
+ s = "Allies successfully beat the clock!";
} else {
s = "Allies couldn't beat the clock!";
}
} else {
if ( winner != defender ) {
- s = "Axis sucessfully beat the clock!";
+ s = "Axis successfully beat the clock!";
} else {
s = "Axis couldn't beat the clock!";
}
diff --git a/MP/code/client/cl_curl.c b/MP/code/client/cl_curl.c
index 3519de0..3ff5a3d 100644
--- a/MP/code/client/cl_curl.c
+++ b/MP/code/client/cl_curl.c
@@ -220,14 +220,25 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...)
{
CURLcode result;
- va_list args;
- va_start(args, option);
- result = qcurl_easy_setopt(curl, option, args);
- va_end(args);
+ va_list argp;
+ va_start(argp, option);
+
+ if(option < CURLOPTTYPE_OBJECTPOINT) {
+ long longValue = va_arg(argp, long);
+ result = qcurl_easy_setopt(curl, option, longValue);
+ } else if(option < CURLOPTTYPE_OFF_T) {
+ void *pointerValue = va_arg(argp, void *);
+ result = qcurl_easy_setopt(curl, option, pointerValue);
+ } else {
+ curl_off_t offsetValue = va_arg(argp, curl_off_t);
+ result = qcurl_easy_setopt(curl, option, offsetValue);
+ }
+
if(result != CURLE_OK) {
Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result));
}
+ va_end(argp);
return result;
}
diff --git a/MP/code/qcommon/cm_patch.c b/MP/code/qcommon/cm_patch.c
index 6cdf0c3..784d5eb 100644
--- a/MP/code/qcommon/cm_patch.c
+++ b/MP/code/qcommon/cm_patch.c
@@ -452,7 +452,7 @@ static int numPlanes;
static patchPlane_t planes[MAX_PATCH_PLANES];
static int numFacets;
-static facet_t facets[MAX_PATCH_PLANES]; //maybe MAX_FACETS ??
+static facet_t facets[MAX_FACETS];
#define NORMAL_EPSILON 0.0001
#define DIST_EPSILON 0.02
diff --git a/MP/code/qcommon/cmd.c b/MP/code/qcommon/cmd.c
index 136b1fd..f6d49ea 100644
--- a/MP/code/qcommon/cmd.c
+++ b/MP/code/qcommon/cmd.c
@@ -661,6 +661,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete = complete;
+ return;
}
}
}
@@ -737,8 +738,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
cmd_function_t *cmd;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
- if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
- cmd->complete( args, argNum );
+ if( !Q_stricmp( command, cmd->name ) ) {
+ if ( cmd->complete ) {
+ cmd->complete( args, argNum );
+ }
+ return;
}
}
}
diff --git a/MP/code/qcommon/cvar.c b/MP/code/qcommon/cvar.c
index b121da5..235a55c 100644
--- a/MP/code/qcommon/cvar.c
+++ b/MP/code/qcommon/cvar.c
@@ -1155,6 +1155,9 @@ cvar_t *Cvar_Unset(cvar_t *cv)
{
cvar_t *next = cv->next;
+ // note what types of cvars have been modified (userinfo, archive, serverinfo, systeminfo)
+ cvar_modifiedFlags |= cv->flags;
+
if(cv->name)
Z_Free(cv->name);
if(cv->string)
diff --git a/MP/code/qcommon/files.c b/MP/code/qcommon/files.c
index 8e55976..56439ca 100644
--- a/MP/code/qcommon/files.c
+++ b/MP/code/qcommon/files.c
@@ -252,6 +252,10 @@ static cvar_t *fs_homepath;
static cvar_t *fs_apppath;
#endif
+#ifndef STANDALONE
+static cvar_t *fs_steampath;
+#endif
+
static cvar_t *fs_basepath;
static cvar_t *fs_basegame;
static cvar_t *fs_gamedirvar;
@@ -751,6 +755,24 @@ long FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
fsh[f].handleSync = qfalse;
}
+#ifndef STANDALONE
+ // Check fs_steampath too
+ if (!fsh[f].handleFiles.file.o && fs_steampath->string[0])
+ {
+ ospath = FS_BuildOSPath( fs_steampath->string, filename, "" );
+ ospath[strlen(ospath)-1] = '\0';
+
+ if ( fs_debug->integer )
+ {
+ Com_Printf( "FS_SV_FOpenFileRead (fs_steampath): %s\n", ospath );
+ }
+
+ fsh[f].handleFiles.file.o = Sys_FOpen( ospath, "rb" );
+ fsh[f].handleSync = qfalse;
+ }
+#endif
+
+
if ( !fsh[f].handleFiles.file.o )
{
f = 0;
@@ -2717,6 +2739,11 @@ int FS_GetModList( char *listbuf, int bufsize ) {
int dummy;
char **pFiles0 = NULL;
char **pFiles1 = NULL;
+#ifndef STANDALONE
+ char **pFiles2 = NULL;
+ char **pFiles3 = NULL;
+#endif
+
qboolean bDrop = qfalse;
*listbuf = 0;
@@ -2724,9 +2751,18 @@ int FS_GetModList( char *listbuf, int bufsize ) {
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
+#ifndef STANDALONE
+ pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue );
+#endif
// we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below
+#ifndef STANDALONE
+ pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+ pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 );
+#else
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+#endif
+
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) {
@@ -2768,6 +2804,17 @@ int FS_GetModList( char *listbuf, int bufsize ) {
Sys_FreeFileList( pPaks );
}
+#ifndef STANDALONE
+ /* try on steam path */
+ if ( nPaks <= 0 )
+ {
+ path = FS_BuildOSPath( fs_steampath->string, name, "" );
+ nPaks = 0;
+ pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
+ Sys_FreeFileList( pPaks );
+ }
+#endif
+
if (nPaks > 0) {
nLen = strlen(name) + 1;
// nLen is the length of the mod path
@@ -3465,6 +3512,12 @@ static void FS_Startup( const char *gameName ) {
fs_gamedirvar = Cvar_Get( "fs_game", "", CVAR_INIT | CVAR_SYSTEMINFO );
// add search path elements in reverse priority order
+#ifndef STANDALONE
+ fs_steampath = Cvar_Get ("fs_steampath", Sys_SteamPath(), CVAR_INIT|CVAR_PROTECTED );
+ if (fs_steampath->string[0]) {
+ FS_AddGameDirectory( fs_steampath->string, gameName, qtrue );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, gameName, qtrue );
}
@@ -3485,6 +3538,11 @@ static void FS_Startup( const char *gameName ) {
// check for additional base game so mods can be based upon other mods
if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) {
+#ifndef STANDALONE
+ if ( fs_steampath->string[0] ) {
+ FS_AddGameDirectory( fs_steampath->string, fs_basegame->string, qtrue );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, fs_basegame->string, qtrue );
}
@@ -3495,6 +3553,11 @@ static void FS_Startup( const char *gameName ) {
// check for additional game folder for mods
if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
+#ifndef STANDALONE
+ if ( fs_steampath->string[0] ) {
+ FS_AddGameDirectory( fs_steampath->string, fs_gamedirvar->string, qtrue );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, fs_gamedirvar->string, qtrue );
}
diff --git a/MP/code/qcommon/q_shared.h b/MP/code/qcommon/q_shared.h
index 2944e17..b79983c 100644
--- a/MP/code/qcommon/q_shared.h
+++ b/MP/code/qcommon/q_shared.h
@@ -49,6 +49,8 @@ If you have questions concerning this license or the applicable additional terms
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
#define HOMEPATH_NAME_UNIX ".foo"
#define HOMEPATH_NAME_WIN "FooBar"
+// #define STEAMPATH_NAME "Foo Bar"
+// #define STEAMPATH_APPID ""
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
#define GAMENAME_FOR_MASTER "foobar" // must NOT contain whitespace
// #define LEGACY_PROTOCOL // You probably don't need this for your standalone game
@@ -60,6 +62,8 @@ If you have questions concerning this license or the applicable additional terms
#define CLIENT_WINDOW_MIN_TITLE "iowolfmp"
#define HOMEPATH_NAME_UNIX ".iortcw"
#define HOMEPATH_NAME_WIN "RTCW"
+ #define STEAMPATH_NAME "Return To Castle Wolfenstein"
+ #define STEAMPATH_APPID "9010"
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
#define GAMENAME_FOR_MASTER "wolfmp"
#define LEGACY_PROTOCOL
diff --git a/MP/code/qcommon/qcommon.h b/MP/code/qcommon/qcommon.h
index 0727d4e..2ba91bb 100644
--- a/MP/code/qcommon/qcommon.h
+++ b/MP/code/qcommon/qcommon.h
@@ -1230,6 +1230,10 @@ char *Sys_Cwd( void );
char *Sys_DefaultBasePath( void );
char *Sys_DefaultInstallPath( void );
+#ifndef STANDALONE
+char *Sys_SteamPath(void);
+#endif
+
#ifdef MACOS_X
char *Sys_DefaultAppPath(void);
#endif
diff --git a/MP/code/qcommon/unzip.c b/MP/code/qcommon/unzip.c
index b5043c1..d35965c 100644
--- a/MP/code/qcommon/unzip.c
+++ b/MP/code/qcommon/unzip.c
@@ -151,7 +151,7 @@ typedef struct
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
+ IN assertion: the stream s has been successfully opened for reading.
*/
diff --git a/MP/code/sys/sys_unix.c b/MP/code/sys/sys_unix.c
index e4bbc4a..8558749 100644
--- a/MP/code/sys/sys_unix.c
+++ b/MP/code/sys/sys_unix.c
@@ -44,6 +44,11 @@ qboolean stdinIsATTY;
// Used to determine where to store user-specific files
static char homePath[ MAX_OSPATH ] = { 0 };
+#ifndef STANDALONE
+// Used to store the Steam RTCW installation path
+static char steamPath[ MAX_OSPATH ] = { 0 };
+#endif
+
/*
==================
Sys_DefaultHomePath
@@ -78,6 +83,33 @@ char *Sys_DefaultHomePath(void)
return homePath;
}
+#ifndef STANDALONE
+/*
+================
+Sys_SteamPath
+================
+*/
+char *Sys_SteamPath( void )
+{
+ // Disabled since Steam doesn't let you install RTCW on Mac/Linux
+#if 0
+ char *p;
+
+ if( ( p = getenv( "HOME" ) ) != NULL )
+ {
+#ifdef MACOS_X
+ char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
+#else
+ char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
+#endif
+ Com_sprintf(steamPath, sizeof(steamPath), "%s%s", p, steamPathEnd);
+ }
+#endif
+
+ return steamPath;
+}
+#endif
+
/*
================
Sys_Milliseconds
@@ -123,6 +155,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
if( !fp )
return qfalse;
+ setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
+
if( fread( string, sizeof( byte ), len, fp ) != len )
{
fclose( fp );
diff --git a/MP/code/sys/sys_win32.c b/MP/code/sys/sys_win32.c
index 84dce76..2e23bc5 100644
--- a/MP/code/sys/sys_win32.c
+++ b/MP/code/sys/sys_win32.c
@@ -42,6 +42,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// Used to determine where to store user-specific files
static char homePath[ MAX_OSPATH ] = { 0 };
+#ifndef STANDALONE
+// Used to store the Steam RTCW installation path
+static char steamPath[ MAX_OSPATH ] = { 0 };
+#endif
+
#ifndef DEDICATED
static UINT timerResolution = 0;
#endif
@@ -127,6 +132,64 @@ char *Sys_DefaultHomePath( void )
return homePath;
}
+#ifndef STANDALONE
+/*
+================
+Sys_SteamPath
+================
+*/
+char *Sys_SteamPath( void )
+{
+#if defined(STEAMPATH_NAME) || defined(STEAMPATH_APPID)
+ HKEY steamRegKey;
+ DWORD pathLen = MAX_OSPATH;
+ qboolean finishPath = qfalse;
+
+#ifdef STEAMPATH_APPID
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+ }
+
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+ }
+#endif
+
+#ifdef STEAMPATH_NAME
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "SteamPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ if (RegQueryValueEx(steamRegKey, "InstallPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+
+ if (steamPath[0])
+ finishPath = qtrue;
+ }
+#endif
+
+ if (steamPath[0])
+ {
+ if (pathLen == MAX_OSPATH)
+ pathLen--;
+
+ steamPath[pathLen] = '\0';
+
+ if (finishPath)
+ Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
+ }
+#endif
+
+ return steamPath;
+}
+#endif
+
/*
================
Sys_Milliseconds
diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index e85163e..cb7b5d3 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -974,7 +974,7 @@ static void Text_Paint_Limit( float *maxX, float x, float y, float scale, vec4_t
continue;
} else {
float yadj = useScale * glyph->top;
- if ( Text_Width( s, useScale, 1 ) + x > max ) {
+ if ( Text_Width( s, scale, 1 ) + x > max ) {
*maxX = 0;
break;
}
diff --git a/SP/code/botlib/be_aas_routetable.c b/SP/code/botlib/be_aas_routetable.c
index dbeb920..c0ed4d0 100644
--- a/SP/code/botlib/be_aas_routetable.c
+++ b/SP/code/botlib/be_aas_routetable.c
@@ -1382,7 +1382,7 @@ qboolean AAS_RT_GetHidePos( vec3_t srcpos, int srcnum, int srcarea, vec3_t destp
if ( !destVisLookup[rt->parentLinks[travChild->startParentLinks].parent] ) {
// success ?
if ( !botimport.AICast_VisibleFromPos( destpos, destnum, ( *aasworld ).areas[pathArea].center, srcnum, qfalse ) ) {
- // SUCESS !!
+ // SUCCESS !!
travParent = &rt->parents[rt->parentLinks[travChild->startParentLinks].parent];
break;
}
diff --git a/SP/code/cgame/cg_newdraw.c b/SP/code/cgame/cg_newdraw.c
index 5a57b92..73a5422 100644
--- a/SP/code/cgame/cg_newdraw.c
+++ b/SP/code/cgame/cg_newdraw.c
@@ -1822,7 +1822,7 @@ static void CG_Text_Paint_Limit( float *maxX, float x, float y, int font, float
continue;
} else {
float yadj = useScale * glyph->top;
- if ( CG_Text_Width( s, font, useScale, 1 ) + x > max ) {
+ if ( CG_Text_Width( s, font, scale, 1 ) + x > max ) {
*maxX = 0;
break;
}
diff --git a/SP/code/client/cl_curl.c b/SP/code/client/cl_curl.c
index 3519de0..3ff5a3d 100644
--- a/SP/code/client/cl_curl.c
+++ b/SP/code/client/cl_curl.c
@@ -220,14 +220,25 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...)
{
CURLcode result;
- va_list args;
- va_start(args, option);
- result = qcurl_easy_setopt(curl, option, args);
- va_end(args);
+ va_list argp;
+ va_start(argp, option);
+
+ if(option < CURLOPTTYPE_OBJECTPOINT) {
+ long longValue = va_arg(argp, long);
+ result = qcurl_easy_setopt(curl, option, longValue);
+ } else if(option < CURLOPTTYPE_OFF_T) {
+ void *pointerValue = va_arg(argp, void *);
+ result = qcurl_easy_setopt(curl, option, pointerValue);
+ } else {
+ curl_off_t offsetValue = va_arg(argp, curl_off_t);
+ result = qcurl_easy_setopt(curl, option, offsetValue);
+ }
+
if(result != CURLE_OK) {
Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result));
}
+ va_end(argp);
return result;
}
diff --git a/SP/code/qcommon/cm_patch.c b/SP/code/qcommon/cm_patch.c
index 19814c3..45e246d 100644
--- a/SP/code/qcommon/cm_patch.c
+++ b/SP/code/qcommon/cm_patch.c
@@ -425,7 +425,7 @@ static int numPlanes;
static patchPlane_t planes[MAX_PATCH_PLANES];
static int numFacets;
-static facet_t facets[MAX_PATCH_PLANES]; //maybe MAX_FACETS ??
+static facet_t facets[MAX_FACETS];
#define NORMAL_EPSILON 0.0001
#define DIST_EPSILON 0.02
diff --git a/SP/code/qcommon/cmd.c b/SP/code/qcommon/cmd.c
index 86b4423..cf91a60 100644
--- a/SP/code/qcommon/cmd.c
+++ b/SP/code/qcommon/cmd.c
@@ -663,6 +663,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete = complete;
+ return;
}
}
}
@@ -739,8 +740,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
cmd_function_t *cmd;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
- if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
- cmd->complete( args, argNum );
+ if( !Q_stricmp( command, cmd->name ) ) {
+ if ( cmd->complete ) {
+ cmd->complete( args, argNum );
+ }
+ return;
}
}
}
diff --git a/SP/code/qcommon/cvar.c b/SP/code/qcommon/cvar.c
index c52a8e7..7aae44d 100644
--- a/SP/code/qcommon/cvar.c
+++ b/SP/code/qcommon/cvar.c
@@ -1116,6 +1116,9 @@ cvar_t *Cvar_Unset(cvar_t *cv)
{
cvar_t *next = cv->next;
+ // note what types of cvars have been modified (userinfo, archive, serverinfo, systeminfo)
+ cvar_modifiedFlags |= cv->flags;
+
if(cv->name)
Z_Free(cv->name);
if(cv->string)
diff --git a/SP/code/qcommon/files.c b/SP/code/qcommon/files.c
index 02725a9..fad5a99 100644
--- a/SP/code/qcommon/files.c
+++ b/SP/code/qcommon/files.c
@@ -255,6 +255,10 @@ static cvar_t *fs_homepath;
static cvar_t *fs_apppath;
#endif
+#ifndef STANDALONE
+static cvar_t *fs_steampath;
+#endif
+
static cvar_t *fs_basepath;
static cvar_t *fs_basegame;
static cvar_t *fs_gamedirvar;
@@ -858,6 +862,23 @@ long FS_SV_FOpenFileRead(const char *filename, fileHandle_t *fp)
fsh[f].handleSync = qfalse;
}
+#ifndef STANDALONE
+ // Check fs_steampath too
+ if (!fsh[f].handleFiles.file.o && fs_steampath->string[0])
+ {
+ ospath = FS_BuildOSPath( fs_steampath->string, filename, "" );
+ ospath[strlen(ospath)-1] = '\0';
+
+ if ( fs_debug->integer )
+ {
+ Com_Printf( "FS_SV_FOpenFileRead (fs_steampath): %s\n", ospath );
+ }
+
+ fsh[f].handleFiles.file.o = Sys_FOpen( ospath, "rb" );
+ fsh[f].handleSync = qfalse;
+ }
+#endif
+
if ( !fsh[f].handleFiles.file.o )
{
f = 0;
@@ -2723,6 +2744,10 @@ int FS_GetModList( char *listbuf, int bufsize ) {
int dummy;
char **pFiles0 = NULL;
char **pFiles1 = NULL;
+#ifndef STANDALONE
+ char **pFiles2 = NULL;
+ char **pFiles3 = NULL;
+#endif
qboolean bDrop = qfalse;
*listbuf = 0;
@@ -2730,9 +2755,18 @@ int FS_GetModList( char *listbuf, int bufsize ) {
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
+#ifndef STANDALONE
+ pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue );
+#endif
// we searched for mods in the three paths
// it is likely that we have duplicate names now, which we will cleanup below
+#ifndef STANDALONE
+ pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+ pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 );
+#else
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+#endif
+
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) {
@@ -2774,6 +2808,17 @@ int FS_GetModList( char *listbuf, int bufsize ) {
Sys_FreeFileList( pPaks );
}
+#ifndef STANDALONE
+ /* try on steam path */
+ if ( nPaks <= 0 )
+ {
+ path = FS_BuildOSPath( fs_steampath->string, name, "" );
+ nPaks = 0;
+ pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
+ Sys_FreeFileList( pPaks );
+ }
+#endif
+
if (nPaks > 0) {
nLen = strlen(name) + 1;
// nLen is the length of the mod path
@@ -3470,6 +3515,12 @@ static void FS_Startup( const char *gameName )
fs_gamedirvar = Cvar_Get( "fs_game", "", CVAR_INIT | CVAR_SYSTEMINFO );
// add search path elements in reverse priority order
+#ifndef STANDALONE
+ fs_steampath = Cvar_Get ("fs_steampath", Sys_SteamPath(), CVAR_INIT|CVAR_PROTECTED );
+ if (fs_steampath->string[0]) {
+ FS_AddGameDirectory( fs_steampath->string, gameName );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, gameName );
}
@@ -3490,6 +3541,11 @@ static void FS_Startup( const char *gameName )
// check for additional base game so mods can be based upon other mods
if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) {
+#ifndef STANDALONE
+ if ( fs_steampath->string[0] ) {
+ FS_AddGameDirectory( fs_steampath->string, fs_basegame->string );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, fs_basegame->string );
}
@@ -3500,6 +3556,11 @@ static void FS_Startup( const char *gameName )
// check for additional game folder for mods
if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
+#ifndef STANDALONE
+ if ( fs_steampath->string[0] ) {
+ FS_AddGameDirectory( fs_steampath->string, fs_gamedirvar->string );
+ }
+#endif
if ( fs_basepath->string[0] ) {
FS_AddGameDirectory( fs_basepath->string, fs_gamedirvar->string );
}
diff --git a/SP/code/qcommon/q_shared.h b/SP/code/qcommon/q_shared.h
index fd377a3..0e74c7c 100644
--- a/SP/code/qcommon/q_shared.h
+++ b/SP/code/qcommon/q_shared.h
@@ -47,6 +47,8 @@ If you have questions concerning this license or the applicable additional terms
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
#define HOMEPATH_NAME_UNIX ".foo"
#define HOMEPATH_NAME_WIN "FooBar"
+// #define STEAMPATH_NAME "Foo Bar"
+// #define STEAMPATH_APPID ""
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
#define GAMENAME_FOR_MASTER "foobar" // must NOT contain whitespace
// #define LEGACY_PROTOCOL // You probably don't need this for your standalone game
@@ -57,6 +59,8 @@ If you have questions concerning this license or the applicable additional terms
#define CLIENT_WINDOW_MIN_TITLE "iowolfsp"
#define HOMEPATH_NAME_UNIX ".iortcw"
#define HOMEPATH_NAME_WIN "RTCW"
+ #define STEAMPATH_NAME "Return To Castle Wolfenstein"
+ #define STEAMPATH_APPID "9010"
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
#define GAMENAME_FOR_MASTER "wolfsp"
#define LEGACY_PROTOCOL
diff --git a/SP/code/qcommon/qcommon.h b/SP/code/qcommon/qcommon.h
index 425e9a4..a3f7fae 100644
--- a/SP/code/qcommon/qcommon.h
+++ b/SP/code/qcommon/qcommon.h
@@ -1146,6 +1146,10 @@ char *Sys_Cwd( void );
char *Sys_DefaultBasePath( void );
char *Sys_DefaultInstallPath( void );
+#ifndef STANDALONE
+char *Sys_SteamPath(void);
+#endif
+
#ifdef MACOS_X
char *Sys_DefaultAppPath(void);
#endif
diff --git a/SP/code/qcommon/unzip.c b/SP/code/qcommon/unzip.c
index b5043c1..d35965c 100644
--- a/SP/code/qcommon/unzip.c
+++ b/SP/code/qcommon/unzip.c
@@ -151,7 +151,7 @@ typedef struct
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
+ IN assertion: the stream s has been successfully opened for reading.
*/
diff --git a/SP/code/sys/sys_unix.c b/SP/code/sys/sys_unix.c
index 84dc1ef..888f005 100644
--- a/SP/code/sys/sys_unix.c
+++ b/SP/code/sys/sys_unix.c
@@ -44,6 +44,11 @@ qboolean stdinIsATTY;
// Used to determine where to store user-specific files
static char homePath[ MAX_OSPATH ] = { 0 };
+#ifndef STANDALONE
+// Used to store the Steam RTCW installation path
+static char steamPath[ MAX_OSPATH ] = { 0 };
+#endif
+
/*
==================
Sys_DefaultHomePath
@@ -78,6 +83,33 @@ char *Sys_DefaultHomePath(void)
return homePath;
}
+#ifndef STANDALONE
+/*
+================
+Sys_SteamPath
+================
+*/
+char *Sys_SteamPath( void )
+{
+ // Disabled since Steam doesn't let you install RTCW on Mac/Linux
+#if 0
+ char *p;
+
+ if( ( p = getenv( "HOME" ) ) != NULL )
+ {
+#ifdef MACOS_X
+ char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
+#else
+ char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
+#endif
+ Com_sprintf(steamPath, sizeof(steamPath), "%s%s", p, steamPathEnd);
+ }
+#endif
+
+ return steamPath;
+}
+#endif
+
/*
================
Sys_Milliseconds
@@ -123,6 +155,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
if( !fp )
return qfalse;
+ setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
+
if( fread( string, sizeof( byte ), len, fp ) != len )
{
fclose( fp );
diff --git a/SP/code/sys/sys_win32.c b/SP/code/sys/sys_win32.c
index 8f67cc7..6fa2994 100644
--- a/SP/code/sys/sys_win32.c
+++ b/SP/code/sys/sys_win32.c
@@ -42,6 +42,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// Used to determine where to store user-specific files
static char homePath[ MAX_OSPATH ] = { 0 };
+#ifndef STANDALONE
+// Used to store the Steam RTCW installation path
+static char steamPath[ MAX_OSPATH ] = { 0 };
+#endif
+
#ifndef DEDICATED
static UINT timerResolution = 0;
#endif
@@ -127,6 +132,64 @@ char *Sys_DefaultHomePath( void )
return homePath;
}
+#ifndef STANDALONE
+/*
+================
+Sys_SteamPath
+================
+*/
+char *Sys_SteamPath( void )
+{
+#if defined(STEAMPATH_NAME) || defined(STEAMPATH_APPID)
+ HKEY steamRegKey;
+ DWORD pathLen = MAX_OSPATH;
+ qboolean finishPath = qfalse;
+
+#ifdef STEAMPATH_APPID
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+ }
+
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+ }
+#endif
+
+#ifdef STEAMPATH_NAME
+ if (!steamPath[0] && !RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
+ {
+ pathLen = MAX_OSPATH;
+ if (RegQueryValueEx(steamRegKey, "SteamPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ if (RegQueryValueEx(steamRegKey, "InstallPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
+ steamPath[0] = '\0';
+
+ if (steamPath[0])
+ finishPath = qtrue;
+ }
+#endif
+
+ if (steamPath[0])
+ {
+ if (pathLen == MAX_OSPATH)
+ pathLen--;
+
+ steamPath[pathLen] = '\0';
+
+ if (finishPath)
+ Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
+ }
+#endif
+
+ return steamPath;
+}
+#endif
+
/*
================
Sys_Milliseconds
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index 08bf92d..0083a2f 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -619,7 +619,7 @@ static void Text_Paint_Limit(float *maxX, float x, float y, int font, float scal
continue;
} else {
float yadj = useScale * glyph->top;
- if (Text_Width(s, font, useScale, 1) + x > max) {
+ if (Text_Width(s, font, scale, 1) + x > max) {
*maxX = 0;
break;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list