Browse Source

Merge remote-tracking branch 'ioquake/master' into urt

pull/23/head
Mickaël Thomas 2 years ago
parent
commit
5b48419ec5
79 changed files with 302 additions and 261 deletions
  1. +9
    -9
      ChangeLog
  2. +10
    -4
      Makefile
  3. +1
    -1
      README.ioq3.md
  4. +7
    -0
      SECURITY.md
  5. +1
    -1
      code/botlib/aasfile.h
  6. +1
    -1
      code/botlib/be_aas_bspq3.c
  7. +3
    -3
      code/botlib/be_aas_cluster.c
  8. +1
    -1
      code/botlib/be_aas_main.c
  9. +3
    -3
      code/botlib/be_aas_reach.c
  10. +5
    -1
      code/botlib/be_aas_route.c
  11. +3
    -3
      code/botlib/be_aas_sample.c
  12. +2
    -2
      code/botlib/be_ai_chat.c
  13. +1
    -1
      code/botlib/be_ai_gen.c
  14. +3
    -3
      code/botlib/be_ai_move.c
  15. +1
    -1
      code/botlib/be_ai_weight.c
  16. +1
    -1
      code/botlib/be_ai_weight.h
  17. +1
    -20
      code/botlib/be_interface.c
  18. +4
    -1
      code/botlib/l_log.c
  19. +2
    -2
      code/botlib/l_script.c
  20. +1
    -1
      code/cgame/cg_public.h
  21. +2
    -2
      code/client/cl_cgame.c
  22. +1
    -1
      code/client/cl_input.c
  23. +4
    -4
      code/client/cl_keys.c
  24. +16
    -14
      code/client/cl_main.c
  25. +1
    -1
      code/client/cl_parse.c
  26. +1
    -1
      code/client/snd_adpcm.c
  27. +1
    -1
      code/client/snd_dma.c
  28. +1
    -1
      code/client/snd_mix.c
  29. +1
    -1
      code/game/bg_public.h
  30. +1
    -1
      code/q3_ui/ui_local.h
  31. +7
    -7
      code/qcommon/cm_patch.c
  32. +3
    -3
      code/qcommon/cm_polylib.c
  33. +8
    -8
      code/qcommon/cm_trace.c
  34. +2
    -2
      code/qcommon/cmd.c
  35. +14
    -26
      code/qcommon/common.c
  36. +32
    -2
      code/qcommon/cvar.c
  37. +42
    -3
      code/qcommon/files.c
  38. +1
    -1
      code/qcommon/huffman.c
  39. +5
    -2
      code/qcommon/md4.c
  40. +0
    -45
      code/qcommon/msg.c
  41. +1
    -1
      code/qcommon/net_chan.c
  42. +4
    -3
      code/qcommon/q_shared.c
  43. +7
    -4
      code/qcommon/q_shared.h
  44. +2
    -1
      code/qcommon/qcommon.h
  45. +1
    -1
      code/qcommon/surfaceflags.h
  46. +3
    -3
      code/qcommon/unzip.c
  47. +2
    -2
      code/qcommon/unzip.h
  48. +2
    -2
      code/qcommon/vm_powerpc.c
  49. +1
    -1
      code/qcommon/vm_x86.c
  50. +2
    -2
      code/renderercommon/tr_image_png.c
  51. +1
    -1
      code/renderercommon/tr_public.h
  52. +1
    -1
      code/renderercommon/tr_types.h
  53. +2
    -2
      code/renderergl1/tr_backend.c
  54. +2
    -2
      code/renderergl1/tr_bsp.c
  55. +2
    -2
      code/renderergl1/tr_image.c
  56. +2
    -2
      code/renderergl1/tr_light.c
  57. +2
    -2
      code/renderergl1/tr_local.h
  58. +3
    -3
      code/renderergl1/tr_shade.c
  59. +2
    -2
      code/renderergl1/tr_shade_calc.c
  60. +6
    -6
      code/renderergl1/tr_shader.c
  61. +2
    -2
      code/renderergl1/tr_surface.c
  62. +2
    -2
      code/renderergl2/tr_backend.c
  63. +1
    -1
      code/renderergl2/tr_bsp.c
  64. +1
    -1
      code/renderergl2/tr_fbo.c
  65. +2
    -2
      code/renderergl2/tr_image.c
  66. +3
    -3
      code/renderergl2/tr_light.c
  67. +1
    -1
      code/renderergl2/tr_local.h
  68. +3
    -3
      code/renderergl2/tr_shade.c
  69. +1
    -1
      code/renderergl2/tr_shade_calc.c
  70. +16
    -5
      code/renderergl2/tr_shader.c
  71. +1
    -1
      code/renderergl2/tr_vbo.c
  72. +2
    -2
      code/server/server.h
  73. +1
    -2
      code/server/sv_client.c
  74. +3
    -3
      code/server/sv_init.c
  75. +1
    -1
      code/server/sv_main.c
  76. +1
    -1
      code/server/sv_snapshot.c
  77. +1
    -1
      code/sys/sys_unix.c
  78. +8
    -0
      code/sys/sys_win32.c
  79. +1
    -1
      opengl2-readme.md

+ 9
- 9
ChangeLog View File

@@ -634,7 +634,7 @@
#1 current directory
#2 fs_homepath
#3 fs_basepath
this was needed to make mod developement easier
this was needed to make mod development easier

2001-10-09 Timothee Besset <ttimo@idsoftware.com>
+ https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=51
@@ -814,7 +814,7 @@
* rebuilding 1.28b, various fixes on linux build:
- SetProgramPath was renamed to Sys_SetDefaultCDPath in unix_shared.c
updated unix_main.c accordingly
- some prototypes in qgl.h are guarded by #ifndef GL_VERSION_1_2 (ARB extentions)
- some prototypes in qgl.h are guarded by #ifndef GL_VERSION_1_2 (ARB extensions)
those prototypes are needed by linux_glimp for importing functions and casting, added a #ifdef __linux__
(not a clean solution)
- game/q_shared.h
@@ -861,7 +861,7 @@
2001-04-23 Timothee Besset <ttimo@idsoftware.com>

* cleanup the mod selection code, remove duplicates
* some issues with release builds, my main developement box doesn't build stable binaries with release settings
* some issues with release builds, my main development box doesn't build stable binaries with release settings
removing -fomit-frame-pointer seems to fix (there's probably a performance hit)
see OMIT-FRAME-POINTER.txt

@@ -984,7 +984,7 @@
//* or // /* or variations of this. I reverted to exact mirror
image of SOS to be sure - short of removing it's too easy to mistake
live code for dead one.
Later: have to change 5 occurences to avoid gcc complaints about
Later: have to change 5 occurrences to avoid gcc complaints about
nested comment tokens.
TODO: somebody please get rid of the cruft in here.

@@ -1235,7 +1235,7 @@
* code/game/g_cmds.c (G_SayTo): CON_CONNECTED.
* code/game/ai_main.c: HOOK added (SOS).
* code/botlib/be_aas_move.c (AAS_HorizontalVelocityForJump):
correct fix for FPE occuring (SOS).
correct fix for FPE occurring (SOS).
* code/game/ai_dmq3.c: initmove.viewoffset (SOS).

* code/game/q_math.c: guard asser/isnan with Q3_VM (q3asm).
@@ -1679,7 +1679,7 @@
* code/game/q_shared.c: Q_strncpyz does zero padding (duh).
Note: calls strncpy, which does a zero fill up to destsize.
If destsize exceeds memory size, zero padding will overwrite
adjacent memory. Suspicion was this happend to botimport.
adjacent memory. Suspicion was this happened to botimport.

* code/qcommon/cvar.c: possible problem in Q_strncpyz call.

@@ -1783,7 +1783,7 @@
* TEST: running with RC4 data files.
TODO: "bot library used before setup" (Q3+TA)
TODO: Q3 old mods wreak havoc (graceful bounce)
TODO: supress "FreeType code not available" in renderer
TODO: suppress "FreeType code not available" in renderer
TODO: can't move in Q3
TODO: items flicker in Q3
TODO: no decals in Q3
@@ -2015,7 +2015,7 @@
* TEST: tried executing a script - get bounced.
TODO: is there any way to jump into a map?
TODO: cl_cinematics 0 (supress all fullscreen RoQ)
TODO: cl_cinematics 0 (suppress all fullscreen RoQ)
Next: used r_logfile 200 in Win32 (RC4) and Linux.
There is a buckload of setup code seemingly not done
at all in Linux? Either that, or logging is enabled
@@ -2983,7 +2983,7 @@
Modules:
code: the Q3 engine code, including a jpeg-6/ copy
common: code shared by tools
libs: code shared by tools, inlcuding a jpeg6/ copy
libs: code shared by tools, including a jpeg6/ copy
q3asm: VM bytecode assembly
q3data: misc. Q3 data conversions
q3map: BSP builder


+ 10
- 4
Makefile View File

@@ -399,15 +399,22 @@ ifeq ($(PLATFORM),darwin)
LIBS = -framework Cocoa
CLIENT_LIBS=
RENDERER_LIBS=
OPTIMIZEVM=
OPTIMIZEVM = -O3

# Default minimum Mac OS X version
ifeq ($(MACOSX_VERSION_MIN),)
MACOSX_VERSION_MIN=10.7
endif

# Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo '$(MACOSX_VERSION_MIN) * 100' | bc | cut -d. -f1)
MACOSX_MAJOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f1)
MACOSX_MINOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f2)
ifeq ($(shell test $(MACOSX_MINOR) -gt 9; echo $$?),0)
# Multiply and then remove decimal. 10.10 -> 101000.0 -> 101000
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_MAJOR) * 10000 + $(MACOSX_MINOR) * 100" | bc | cut -d. -f1)
else
# Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_VERSION_MIN) * 100" | bc | cut -d. -f1)
endif

LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
BASE_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) \
@@ -415,7 +422,6 @@ ifeq ($(PLATFORM),darwin)

ifeq ($(ARCH),ppc)
BASE_CFLAGS += -arch ppc -faltivec
OPTIMIZEVM += -O3
endif
ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -arch ppc64 -faltivec


+ 1
- 1
README.ioq3.md View File

@@ -11,7 +11,7 @@ The intent of this project is to provide a baseline Quake 3 which may be used
for further development and baseq3 fun.
Some of the major features currently implemented are:

* SDL backend
* SDL 2 backend
* OpenAL sound API support (multiple speaker support and better sound
quality)
* Full x86_64 support on Linux


+ 7
- 0
SECURITY.md View File

@@ -0,0 +1,7 @@
## ioquake3 Security
We take security very seriously at ioquake3. We welcome any peer review of our 100% free software source code to ensure nobody's ioquake3 clients or servers are ever compromised or hacked.

### Where should I report security issues?

In order to give the community time to respond and upgrade we strongly urge you report all security issues privately.
Please contact zachary@ioquake.org directly to provide details and repro steps and we will respond ASAP.

+ 1
- 1
code/botlib/aasfile.h View File

@@ -191,7 +191,7 @@ typedef struct aas_edge_s
//edge index, negative if vertexes are reversed
typedef int aas_edgeindex_t;

//a face bounds an area, often it will also seperate two areas
//a face bounds an area, often it will also separate two areas
typedef struct aas_face_s
{
int planenum; //number of the plane this face is in


+ 1
- 1
code/botlib/be_aas_bspq3.c View File

@@ -70,7 +70,7 @@ typedef struct bsp_entity_s
bsp_epair_t *epairs;
} bsp_entity_t;

//id Sofware BSP data
//id Software BSP data
typedef struct bsp_s
{
//true when bsp file is loaded


+ 3
- 3
code/botlib/be_aas_cluster.c View File

@@ -1168,7 +1168,7 @@ void AAS_RemoveNotClusterClosingPortals(void)
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
//if the area already has a cluster set
if (aasworld.areasettings[otherareanum].cluster) continue;
//another cluster is seperated by this portal
//another cluster is separated by this portal
numseperatedclusters++;
//flood the cluster
AAS_FloodCluster_r(otherareanum, numseperatedclusters);
@@ -1185,13 +1185,13 @@ void AAS_RemoveNotClusterClosingPortals(void)
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) continue;
//if the area already has a cluster set
if (aasworld.areasettings[otherareanum].cluster) continue;
//another cluster is seperated by this portal
//another cluster is separated by this portal
numseperatedclusters++;
//flood the cluster
AAS_FloodCluster_r(otherareanum, numseperatedclusters);
AAS_FloodClusterReachabilities(numseperatedclusters);
} //end for
//a portal must seperate no more and no less than 2 clusters
//a portal must separate no more and no less than 2 clusters
if (numseperatedclusters != 2)
{
aasworld.areasettings[i].contents &= ~AREACONTENTS_CLUSTERPORTAL;


+ 1
- 1
code/botlib/be_aas_main.c View File

@@ -241,7 +241,7 @@ int AAS_LoadFiles(const char *mapname)
return BLERR_NOERROR;
} //end of the function AAS_LoadFiles
//===========================================================================
// called everytime a map changes
// called every time a map changes
//
// Parameter: -
// Returns: -


+ 3
- 3
code/botlib/be_aas_reach.c View File

@@ -439,7 +439,7 @@ int AAS_BestReachableArea(vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalor
//VectorSubtract(absmaxs, bbmins, absmaxs);
//link an invalid (-1) entity
areas = AAS_LinkEntityClientBBox(absmins, absmaxs, -1, PRESENCE_CROUCH);
//get the reachable link arae
//get the reachable link area
areanum = AAS_BestReachableLinkArea(areas);
//unlink the invalid entity
AAS_UnlinkFromAreas(areas);
@@ -1416,7 +1416,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
//if there IS water the sv_maxwaterjump height below the bestend point
if (aasworld.areasettings[AAS_PointAreaNum(testpoint)].areaflags & AREA_LIQUID)
{
//don't create rediculous water jump reachabilities from areas very far below
//don't create ridiculous water jump reachabilities from areas very far below
//the water surface
if (water_bestdist < aassettings.phys_maxwaterjump + 24)
{
@@ -3054,7 +3054,7 @@ void AAS_Reachability_Elevator(void)
bottomorg[2] += 24;
} //end else
//look at adjacent areas around the top of the plat
//make larger steps to outside the plat everytime
//make larger steps to outside the plat every time
for (n = 0; n < 3; n++)
{
for (k = 0; k < 3; k++)


+ 5
- 1
code/botlib/be_aas_route.c View File

@@ -1603,7 +1603,7 @@ int AAS_AreaRouteToGoalArea(int areanum, vec3_t origin, int goalareanum, int tra
*reachnum = 0;
return qtrue;
}
//
//check !AAS_AreaReachability(areanum) with custom developer-only debug message
if (areanum <= 0 || areanum >= aasworld.numareas)
{
if (botDeveloper)
@@ -1620,6 +1620,10 @@ int AAS_AreaRouteToGoalArea(int areanum, vec3_t origin, int goalareanum, int tra
} //end if
return qfalse;
} //end if
if (!aasworld.areasettings[areanum].numreachableareas || !aasworld.areasettings[goalareanum].numreachableareas)
{
return qfalse;
} //end if
// make sure the routing cache doesn't grow to large
while(AvailableMemory() < 1 * 1024 * 1024) {
if (!AAS_FreeOldestCache()) break;


+ 3
- 3
code/botlib/be_aas_sample.c View File

@@ -688,7 +688,7 @@ aas_trace_t AAS_TraceClientBBox(vec3_t start, vec3_t end, int presencetype,
side = front < 0;
//first put the end part of the line on the stack (back side)
VectorCopy(cur_mid, tstack_p->start);
//not necesary to store because still on stack
//not necessary to store because still on stack
//VectorCopy(cur_end, tstack_p->end);
tstack_p->planenum = aasnode->planenum;
tstack_p->nodenum = aasnode->children[!side];
@@ -874,7 +874,7 @@ int AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int max
side = front < 0;
//first put the end part of the line on the stack (back side)
VectorCopy(cur_mid, tstack_p->start);
//not necesary to store because still on stack
//not necessary to store because still on stack
//VectorCopy(cur_end, tstack_p->end);
tstack_p->planenum = aasnode->planenum;
tstack_p->nodenum = aasnode->children[!side];
@@ -959,7 +959,7 @@ qboolean AAS_InsideFace(aas_face_t *face, vec3_t pnormal, vec3_t point, float ep
//edge) and through both the edge vector and the normal vector
//of the plane
AAS_OrthogonalToVectors(edgevec, pnormal, sepnormal);
//check on wich side of the above plane the point is
//check on which side of the above plane the point is
//this is done by checking the sign of the dot product of the
//vector orthogonal vector from above and the vector from the
//origin (first vertex of edge) to the point


+ 2
- 2
code/botlib/be_ai_chat.c View File

@@ -553,11 +553,11 @@ void StringReplaceWords(char *string, char *synonym, char *replacement)

//find the synonym in the string
str = StringContainsWord(string, synonym, qfalse);
//if the synonym occured in the string
//if the synonym occurred in the string
while(str)
{
//if the synonym isn't part of the replacement which is already in the string
//usefull for abreviations
//useful for abbreviations
str2 = StringContainsWord(string, replacement, qfalse);
while(str2)
{


+ 1
- 1
code/botlib/be_ai_gen.c View File

@@ -62,7 +62,7 @@ int GeneticSelection(int numranks, float *rankings)
} //end for
if (sum > 0)
{
//select a bot where the ones with the higest rankings have
//select a bot where the ones with the highest rankings have
//the highest chance of being selected
//sum *= random();
for (i = 0; i < numranks; i++)


+ 3
- 3
code/botlib/be_ai_move.c View File

@@ -1605,7 +1605,7 @@ bot_moveresult_t BotTravel_WalkOffLedge(bot_movestate_t *ms, aas_reachability_t
VectorSubtract(reach->start, ms->origin, dir);
VectorNormalize(dir);
BotCheckBlocked(ms, dir, qtrue, &result);
//if the reachability start and end are practially above each other
//if the reachability start and end are practically above each other
VectorSubtract(reach->end, reach->start, dir);
dir[2] = 0;
reachhordist = VectorLength(dir);
@@ -2744,7 +2744,7 @@ bot_moveresult_t BotTravel_RocketJump(bot_movestate_t *ms, aas_reachability_t *r
result.ideal_viewangles[PITCH] = 90;
//set the view angles directly
EA_View(ms->client, result.ideal_viewangles);
//view is important for the movment
//view is important for the movement
result.flags |= MOVERESULT_MOVEMENTVIEWSET;
//select the rocket launcher
EA_SelectWeapon(ms->client, (int) weapindex_rocketlauncher->value);
@@ -2804,7 +2804,7 @@ bot_moveresult_t BotTravel_BFGJump(bot_movestate_t *ms, aas_reachability_t *reac
result.ideal_viewangles[PITCH] = 90;
//set the view angles directly
EA_View(ms->client, result.ideal_viewangles);
//view is important for the movment
//view is important for the movement
result.flags |= MOVERESULT_MOVEMENTVIEWSET;
//select the rocket launcher
EA_SelectWeapon(ms->client, (int) weapindex_bfg10k->value);


+ 1
- 1
code/botlib/be_ai_weight.c View File

@@ -726,7 +726,7 @@ void EvolveFuzzySeperator_r(fuzzyseperator_t *fs)
//every once in a while an evolution leap occurs, mutation
if (random() < 0.01) fs->weight += crandom() * (fs->maxweight - fs->minweight);
else fs->weight += crandom() * (fs->maxweight - fs->minweight) * 0.5;
//modify bounds if necesary because of mutation
//modify bounds if necessary because of mutation
if (fs->weight < fs->minweight) fs->minweight = fs->weight;
else if (fs->weight > fs->maxweight) fs->maxweight = fs->weight;
} //end else if


+ 1
- 1
code/botlib/be_ai_weight.h View File

@@ -64,7 +64,7 @@ typedef struct weightconfig_s
weightconfig_t *ReadWeightConfig(char *filename);
//free a weight configuration
void FreeWeightConfig(weightconfig_t *config);
//writes a weight configuration, returns true if successfull
//writes a weight configuration, returns true if successful
qboolean WriteWeightConfig(char *filename, weightconfig_t *config);
//find the fuzzy weight with the given name
int FindFuzzyWeight(weightconfig_t *wc, char *name);


+ 1
- 20
code/botlib/be_interface.c View File

@@ -144,26 +144,7 @@ int Export_BotLibSetup(void)

if(botDeveloper)
{
char *homedir, *gamedir, *basegame;
char logfilename[MAX_OSPATH];

homedir = LibVarGetString("homedir");
gamedir = LibVarGetString("gamedir");
basegame = LibVarGetString("basegame");

if (*homedir)
{
if(*gamedir)
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, gamedir, PATH_SEP);
else if(*basegame)
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, basegame, PATH_SEP);
else
Com_sprintf(logfilename, sizeof(logfilename), "%s%c" BASEGAME "%cbotlib.log", homedir, PATH_SEP, PATH_SEP);
}
else
Com_sprintf(logfilename, sizeof(logfilename), "botlib.log");
Log_Open(logfilename);
Log_Open("botlib.log");
}

botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");


+ 4
- 1
code/botlib/l_log.c View File

@@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <string.h>

#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
#include "botlib.h"
#include "be_interface.h" //for botimport.Print
#include "l_libvar.h"
@@ -58,6 +59,7 @@ static logfile_t logfile;
//===========================================================================
void Log_Open(char *filename)
{
char *ospath;
if (!LibVarValue("log", "0")) return;
if (!filename || !strlen(filename))
{
@@ -69,7 +71,8 @@ void Log_Open(char *filename)
botimport.Print(PRT_ERROR, "log file %s is already opened\n", logfile.filename);
return;
} //end if
logfile.fp = fopen(filename, "wb");
ospath = FS_BuildOSPath(Cvar_VariableString("fs_homepath"), Cvar_VariableString("fs_game"), filename);
logfile.fp = fopen(ospath, "wb");
if (!logfile.fp)
{
botimport.Print(PRT_ERROR, "can't open the log file %s\n", filename);


+ 2
- 2
code/botlib/l_script.c View File

@@ -218,7 +218,7 @@ char *PunctuationFromNum(script_t *script, int num)
{
if (script->punctuations[i].n == num) return script->punctuations[i].p;
} //end for
return "unkown punctuation";
return "unknown punctuation";
} //end of the function PunctuationFromNum
//===========================================================================
//
@@ -836,7 +836,7 @@ int PS_ReadPrimitive(script_t *script, token_t *token)
token->string[len] = 0;
//copy the token into the script structure
Com_Memcpy(&script->token, token, sizeof(token_t));
//primitive reading successfull
//primitive reading successful
return 1;
} //end of the function PS_ReadPrimitive
//============================================================================


+ 1
- 1
code/cgame/cg_public.h View File

@@ -206,7 +206,7 @@ typedef enum {

CG_SHUTDOWN,
// void (*CG_Shutdown)( void );
// oportunity to flush and close any open files
// opportunity to flush and close any open files

CG_CONSOLE_COMMAND,
// qboolean (*CG_ConsoleCommand)( void );


+ 2
- 2
code/client/cl_cgame.c View File

@@ -341,7 +341,7 @@ rescan:
// the clientLevelShot command is used during development
// to generate 128*128 screenshots from the intermission
// point of levels for the menu system to use
// we pass it along to the cgame to make apropriate adjustments,
// we pass it along to the cgame to make appropriate adjustments,
// but we also clear the console and notify lines here
if ( !strcmp( cmd, "clientLevelShot" ) ) {
// don't do it if we aren't running the server locally,
@@ -1026,7 +1026,7 @@ void CL_SetCGameTime( void ) {
}

// if we are playing a demo back, we can just keep reading
// messages from the demo file until the cgame definately
// messages from the demo file until the cgame definitely
// has valid snapshots to interpolate between

// a timedemo will always use a deterministic set of time samples


+ 1
- 1
code/client/cl_input.c View File

@@ -320,7 +320,7 @@ void CL_KeyMove( usercmd_t *cmd ) {

//
// adjust for speed key / running
// the walking flag is to keep animations consistant
// the walking flag is to keep animations consistent
// even during acceleration and develeration
//
if ( in_speed.active ^ cl_run->integer ) {


+ 4
- 4
code/client/cl_keys.c View File

@@ -177,7 +177,7 @@ keyname_t keynames[] =

{"PAUSE", K_PAUSE},
{"SEMICOLON", ';'}, // because a raw semicolon seperates commands
{"SEMICOLON", ';'}, // because a raw semicolon separates commands

{"WORLD_0", K_WORLD_0},
{"WORLD_1", K_WORLD_1},
@@ -933,7 +933,7 @@ void Key_SetBinding( int keynum, const char *binding ) {
keys[keynum].binding = CopyString( binding );

// consider this like modifying an archived cvar, so the
// file write will be triggered at the next oportunity
// file write will be triggered at the next opportunity
cvar_modifiedFlags |= CVAR_ARCHIVE;
}

@@ -1353,7 +1353,7 @@ void CL_KeyDownEvent( int key, unsigned time )
// send the bound action
CL_ParseBinding( key, qtrue, time );

// distribute the key down event to the apropriate handler
// distribute the key down event to the appropriate handler
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) {
Console_Key( key );
} else if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
@@ -1440,7 +1440,7 @@ void CL_CharEvent( int key ) {
return;
}

// distribute the key down event to the apropriate handler
// distribute the key down event to the appropriate handler
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
{
Field_CharEvent( &g_consoleField, key );


+ 16
- 14
code/client/cl_main.c View File

@@ -578,7 +578,7 @@ CLIENT RELIABLE COMMAND COMMUNICATION
======================
CL_AddReliableCommand

The given command will be transmitted to the server, and is gauranteed to
The given command will be transmitted to the server, and is guaranteed to
not have future usercmd_t executed before it is executed
======================
*/
@@ -636,6 +636,7 @@ CL_WriteDemoMessage
Dumps the current net message, prefixed by the length
====================
*/

void CL_WriteDemoMessage ( msg_t *msg, int headerBytes ) {
int len, swlen;

@@ -829,7 +830,6 @@ void CL_Record_f( void ) {
clc.spDemoRecording = qfalse;
}


Q_strncpyz( clc.demoName, demoName, sizeof( clc.demoName ) );

// don't start saving messages until a non-delta compressed message is received
@@ -1168,7 +1168,6 @@ static void CL_CompleteDemoName( char *args, int argNum )
}
}


/*
====================
CL_PlayDemo_f
@@ -1188,7 +1187,7 @@ void CL_PlayDemo_f( void ) {
int protocol, i;
char retry[MAX_OSPATH];
#endif
if (Cmd_Argc() != 2) {
Com_Printf ("demo <demoname>\n");
return;
@@ -1198,7 +1197,6 @@ void CL_PlayDemo_f( void ) {
// 2 means don't force disconnect of local client
Cvar_Set( "sv_killserver", "2" );


// open the demo file
Q_strncpyz( arg, Cmd_Argv(1), sizeof( arg ) );
@@ -1221,22 +1219,24 @@ void CL_PlayDemo_f( void ) {

for(i = 0; demo_protocols[i]; i++)
{
if (demo_protocols[i] == protocol)
if(demo_protocols[i] == protocol)
break;
}

if(demo_protocols[i] || protocol == com_protocol->integer
# ifdef LEGACY_PROTOCOL
|| protocol == com_legacyprotocol->integer
# endif
)
{
Com_sprintf (name, sizeof(name), "demos/%s", arg);
FS_FOpenFileRead( name, &clc.demofile, qtrue );
Com_sprintf(name, sizeof(name), "demos/%s", arg);
FS_FOpenFileRead(name, &clc.demofile, qtrue);
}
else
{
int len;
Com_Printf("Protocol %d not supported for demos\n", protocol);

Com_Printf("Protocol %d not supported for demos\n", protocol);
len = ext_test - arg;

if(len >= ARRAY_LEN(retry))
@@ -1334,6 +1334,7 @@ void CL_PlayDemo_f( void ) {
else
clc.compat = qfalse;
#endif

// read demo messages until connected
while ( clc.state >= CA_CONNECTED && clc.state < CA_PRIMED ) {
CL_ReadDemoMessage();
@@ -1432,7 +1433,7 @@ void CL_ClearMemory(qboolean shutdownRef)
CL_ShutdownAll(shutdownRef);

// if not running a server clear the whole hunk
if ( !com_sv_running->integer ) {
if ( !com_sv_running || !com_sv_running->integer ) {
// clear the whole hunk
Hunk_Clear();
// clear collision map data
@@ -1834,7 +1835,7 @@ void CL_Connect_f( void ) {
clc.state = CA_CONNECTING;
// Set a client challenge number that ideally is mirrored back by the server.
clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds();
clc.challenge = (((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds();
}

Key_SetCatcher( 0 );
@@ -2026,7 +2027,7 @@ void CL_Vid_Restart_f( void ) {
CL_ShutdownCGame();
// shutdown the renderer and clear the renderer interface
CL_ShutdownRef();
// client is no longer pure untill new checksums are sent
// client is no longer pure until new checksums are sent
CL_ResetPureClientAtServer();
// clear pak references
FS_ClearPakReferences( FS_UI_REF | FS_CGAME_REF );
@@ -2037,7 +2038,7 @@ void CL_Vid_Restart_f( void ) {
cls.cgameStarted = qfalse;
cls.soundRegistered = qfalse;

// unpause so the cgame definately gets a snapshot and renders a frame
// unpause so the cgame definitely gets a snapshot and renders a frame
Cvar_Set("cl_paused", "0");

// initialize the renderer interface
@@ -2153,6 +2154,7 @@ Called when all downloading has been completed
=================
*/
void CL_DownloadsComplete( void ) {

#ifdef USE_CURL
if (clc.cURLDisconnected || clc.downloadRestart) {
// if we downloaded files we need to restart the file system
@@ -3429,7 +3431,7 @@ void CL_InitRef( void ) {

re = *ret;

// unpause so the cgame definately gets a snapshot and renders a frame
// unpause so the cgame definitely gets a snapshot and renders a frame
Cvar_Set( "cl_paused", "0" );
}



+ 1
- 1
code/client/cl_parse.c View File

@@ -588,7 +588,7 @@ void CL_SystemInfoChanged( void ) {
// ehw!
if (!Q_stricmp(key, "fs_game"))
{
if(FS_CheckDirTraversal(value))
if(FS_InvalidGameDir(value))
{
Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s\n", value);
continue;


+ 1
- 1
code/client/snd_adpcm.c View File

@@ -25,7 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*
** Intel/DVI ADPCM coder/decoder.
**
** The algorithm for this coder was taken from the IMA Compatability Project
** The algorithm for this coder was taken from the IMA Compatibility Project
** proceedings, Vol 2, Number 2; May 1992.
**
** Version 1.2, 18-Dec-92.


+ 1
- 1
code/client/snd_dma.c View File

@@ -433,7 +433,7 @@ void S_SpatializeOrigin (vec3_t origin, int master_vol, int *left_vol, int *righ

const float dist_mult = SOUND_ATTENUATE;
// calculate stereo seperation and distance attenuation
// calculate stereo separation and distance attenuation
VectorSubtract(origin, listener_origin, source_vec);

dist = VectorNormalize(source_vec);


+ 1
- 1
code/client/snd_mix.c View File

@@ -515,7 +515,7 @@ static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int cou
static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
// must be in a separate function or G3 systems will crash.
S_PaintChannelFrom16_altivec( ch, sc, count, sampleOffset, bufferOffset );
return;
}


+ 1
- 1
code/game/bg_public.h View File

@@ -210,7 +210,7 @@ typedef enum {
STAT_ARMOR,
STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?)
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
STAT_MAX_HEALTH // health / armor limit, changable by handicap
STAT_MAX_HEALTH // health / armor limit, changeable by handicap
} statIndex_t;




+ 1
- 1
code/q3_ui/ui_local.h View File

@@ -221,7 +221,7 @@ typedef struct
int width;
int height;
int columns;
int seperation;
int separation;
} menulist_s;

typedef struct


+ 7
- 7
code/qcommon/cm_patch.c View File

@@ -1105,7 +1105,7 @@ static void CM_PatchCollideFromGrid( cGrid_t *grid, patchCollide_t *pf ) {
numFacets++;
}
} else {
// two seperate triangles
// two separate triangles
facet->surfacePlane = gridPlanes[i][j][0];
facet->numBorders = 3;
facet->borderPlanes[0] = borders[EN_TOP];
@@ -1214,7 +1214,7 @@ struct patchCollide_s *CM_GeneratePatchCollide( int width, int height, vec3_t *p
CM_RemoveDegenerateColumns( &grid );

// we now have a grid of points exactly on the curve
// the aproximate surface defined by these points will be
// the approximate surface defined by these points will be
// collided against
pf = Hunk_Alloc( sizeof( *pf ), h_high );
ClearBounds( pf->bounds[0], pf->bounds[1] );
@@ -1369,7 +1369,7 @@ int CM_CheckFacetPlane(float *plane, vec3_t start, vec3_t end, float *enterFrac,
return qfalse;
}

// if it doesn't cross the plane, the plane isn't relevent
// if it doesn't cross the plane, the plane isn't relevant
if (d1 <= 0 && d2 <= 0 ) {
return qtrue;
}
@@ -1433,7 +1433,7 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
if ( tw->sphere.use ) {
// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;

// find the closest point on the capsule to the plane
@@ -1472,7 +1472,7 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *
plane[3] = planes->plane[3];
}
if ( tw->sphere.use ) {
// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;

// find the closest point on the capsule to the plane
@@ -1561,7 +1561,7 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
if ( tw->sphere.use ) {
// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;

// find the closest point on the capsule to the plane
@@ -1594,7 +1594,7 @@ qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchColli
plane[3] = planes->plane[3];
}
if ( tw->sphere.use ) {
// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;

// find the closest point on the capsule to the plane


+ 3
- 3
code/qcommon/cm_polylib.c View File

@@ -353,7 +353,7 @@ void ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist,
return;
}

maxpts = in->numpoints+4; // cant use counts[0]+2 because
maxpts = in->numpoints+4; // can't use counts[0]+2 because
// of fp grouping errors

*front = f = AllocWinding (maxpts);
@@ -462,7 +462,7 @@ void ChopWindingInPlace (winding_t **inout, vec3_t normal, vec_t dist, vec_t eps
if (!counts[1])
return; // inout stays the same

maxpts = in->numpoints+4; // cant use counts[0]+2 because
maxpts = in->numpoints+4; // can't use counts[0]+2 because
// of fp grouping errors

f = AllocWinding (maxpts);
@@ -574,7 +574,7 @@ void CheckWinding (winding_t *w)
if (d < -ON_EPSILON || d > ON_EPSILON)
Com_Error (ERR_DROP, "CheckWinding: point off plane");
// check the edge isnt degenerate
// check the edge isn't degenerate
p2 = w->p[j];
VectorSubtract (p2, p1, dir);


+ 8
- 8
code/qcommon/cm_trace.c View File

@@ -189,7 +189,7 @@ void CM_TestBoxInBrush( traceWork_t *tw, cbrush_t *brush ) {
side = brush->sides + i;
plane = side->plane;

// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
dist = plane->dist + tw->sphere.radius;
// find the closest point on the capsule to the plane
t = DotProduct( plane->normal, tw->sphere.offset );
@@ -214,7 +214,7 @@ void CM_TestBoxInBrush( traceWork_t *tw, cbrush_t *brush ) {
side = brush->sides + i;
plane = side->plane;

// adjust the plane distance apropriately for mins/maxs
// adjust the plane distance appropriately for mins/maxs
dist = plane->dist - DotProduct( tw->offsets[ plane->signbits ], plane->normal );

d1 = DotProduct( tw->start, plane->normal ) - dist;
@@ -517,7 +517,7 @@ void CM_TraceThroughBrush( traceWork_t *tw, cbrush_t *brush ) {
side = brush->sides + i;
plane = side->plane;

// adjust the plane distance apropriately for radius
// adjust the plane distance appropriately for radius
dist = plane->dist + tw->sphere.radius;

// find the closest point on the capsule to the plane
@@ -548,7 +548,7 @@ void CM_TraceThroughBrush( traceWork_t *tw, cbrush_t *brush ) {
return;
}

// if it doesn't cross the plane, the plane isn't relevent
// if it doesn't cross the plane, the plane isn't relevant
if (d1 <= 0 && d2 <= 0 ) {
continue;
}
@@ -584,7 +584,7 @@ void CM_TraceThroughBrush( traceWork_t *tw, cbrush_t *brush ) {
side = brush->sides + i;
plane = side->plane;

// adjust the plane distance apropriately for mins/maxs
// adjust the plane distance appropriately for mins/maxs
dist = plane->dist - DotProduct( tw->offsets[ plane->signbits ], plane->normal );

d1 = DotProduct( tw->start, plane->normal ) - dist;
@@ -602,7 +602,7 @@ void CM_TraceThroughBrush( traceWork_t *tw, cbrush_t *brush ) {
return;
}

// if it doesn't cross the plane, the plane isn't relevent
// if it doesn't cross the plane, the plane isn't relevant
if (d1 <= 0 && d2 <= 0 ) {
continue;
}
@@ -1059,7 +1059,7 @@ void CM_TraceThroughTree( traceWork_t *tw, int num, float p1f, float p2f, vec3_t
node = cm.nodes + num;
plane = node->plane;

// adjust the plane distance apropriately for mins/maxs
// adjust the plane distance appropriately for mins/maxs
if ( plane->type < 3 ) {
t1 = p1[plane->type] - plane->dist;
t2 = p2[plane->type] - plane->dist;
@@ -1204,7 +1204,7 @@ void CM_Trace( trace_t *results, const vec3_t start, const vec3_t end, vec3_t mi

tw.maxOffset = tw.size[1][0] + tw.size[1][1] + tw.size[1][2];

// tw.offsets[signbits] = vector to apropriate corner from origin
// tw.offsets[signbits] = vector to appropriate corner from origin
tw.offsets[0][0] = tw.size[0][0];
tw.offsets[0][1] = tw.size[0][1];
tw.offsets[0][2] = tw.size[0][2];


+ 2
- 2
code/qcommon/cmd.c View File

@@ -532,8 +532,8 @@ void Cmd_Args_Sanitize(void)
Cmd_TokenizeString

Parses the given string into command line tokens.
The text is copied to a seperate buffer and 0 characters
are inserted in the apropriate place, The argv array
The text is copied to a separate buffer and 0 characters
are inserted in the appropriate place, The argv array
will point into this temporary buffer.
============
*/


+ 14
- 26
code/qcommon/common.c View File

@@ -46,7 +46,7 @@ int demo_protocols[] =
int com_argc;
char *com_argv[MAX_NUM_ARGVS+1];

jmp_buf abortframe; // an ERR_DROP occured, exit the entire frame
jmp_buf abortframe; // an ERR_DROP occurred, exit the entire frame


FILE *debuglogfile;
@@ -159,7 +159,7 @@ void Com_EndRedirect (void)
Com_Printf

Both client and server can use this, and it will output
to the apropriate place.
to the appropriate place.

A raw string should NEVER be passed as fmt, because of "%f" type crashers.
=============
@@ -376,7 +376,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
Com_Quit_f

Both client and server can use this, and it will
do the apropriate things.
do the appropriate things.
=============
*/
void Com_Quit_f( void ) {
@@ -404,7 +404,7 @@ void Com_Quit_f( void ) {

COMMAND LINE FUNCTIONS

+ characters seperate the commandLine string into multiple console
+ characters separate the commandLine string into multiple console
command lines.

All of these are valid:
@@ -536,7 +536,7 @@ void Com_StartupVariable( const char *match ) {
Com_AddStartupCommands

Adds command line parameters as script statements
Commands are seperated by + signs
Commands are separated by + signs

Returns qtrue if any late commands were added, which
will keep the demoloop from immediately starting
@@ -823,19 +823,19 @@ typedef struct {
} memzone_t;

// main zone for all "dynamic" memory allocation
memzone_t *mainzone;
static memzone_t *mainzone;
// we also have a small zone for small allocations that would only
// fragment the main zone (think of cvar and cmd strings)
memzone_t *smallzone;
static memzone_t *smallzone;

void Z_CheckHeap( void );
static void Z_CheckHeap( void );

/*
========================
Z_ClearZone
========================
*/
void Z_ClearZone( memzone_t *zone, int size ) {
static void Z_ClearZone( memzone_t *zone, int size ) {
memblock_t *block;
// set the entire zone to one free block
@@ -860,7 +860,7 @@ void Z_ClearZone( memzone_t *zone, int size ) {
Z_AvailableZoneMemory
========================
*/
int Z_AvailableZoneMemory( memzone_t *zone ) {
static int Z_AvailableZoneMemory( memzone_t *zone ) {
return zone->size - zone->used;
}

@@ -1105,7 +1105,7 @@ void *S_Malloc( int size ) {
Z_CheckHeap
========================
*/
void Z_CheckHeap( void ) {
static void Z_CheckHeap( void ) {
memblock_t *block;
for (block = mainzone->blocklist.next ; ; block = block->next) {
@@ -1238,7 +1238,7 @@ char *CopyString( const char *in ) {
==============================================================================

Goals:
reproducable without history effects -- no out of memory errors on weird map to map changes
reproducible without history effects -- no out of memory errors on weird map to map changes
allow restarting of the client without fragmentation
minimize total pages in use at run time
minimize total pages needed during load time
@@ -2468,16 +2468,7 @@ Expose possibility to change current running mod to the user

void Com_GameRestart_f(void)
{
if(!FS_FilenameCompare(Cmd_Argv(1), com_basegame->string))
{
// This is the standard base game. Servers and clients should
// use "" and not the standard basegame name because this messes
// up pak file negotiation and lots of other stuff
Cvar_Set("fs_game", "");
}
else
Cvar_Set("fs_game", Cmd_Argv(1));
Cvar_Set("fs_game", Cmd_Argv(1));

Com_GameRestart(0, qtrue);
}
@@ -2619,10 +2610,7 @@ void Com_Init( char *commandLine ) {
CL_InitKeyCommands();

com_basegame = Cvar_Get("com_basegame", BASEGAME, CVAR_INIT);
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT);
if(!com_basegame->string[0])
Cvar_ForceReset("com_basegame");
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT|CVAR_PROTECTED);

FS_InitFilesystem ();



+ 32
- 2
code/qcommon/cvar.c View File

@@ -1332,12 +1332,42 @@ void Cvar_Register(vmCvar_t *vmCvar, const char *varName, const char *defaultVal
// flags. Unfortunately some historical game code (including single player
// baseq3) sets both flags. We unset CVAR_ROM for such cvars.
if ((flags & (CVAR_ARCHIVE | CVAR_ROM)) == (CVAR_ARCHIVE | CVAR_ROM)) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: Unsetting CVAR_ROM cvar '%s', "
Com_DPrintf( S_COLOR_YELLOW "WARNING: Unsetting CVAR_ROM from cvar '%s', "
"since it is also CVAR_ARCHIVE\n", varName );
flags &= ~CVAR_ROM;
}

cv = Cvar_Get(varName, defaultValue, flags | CVAR_VM_CREATED);
// Don't allow VM to specific a different creator or other internal flags.
if ( flags & CVAR_USER_CREATED ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to set CVAR_USER_CREATED on cvar '%s'\n", varName );
flags &= ~CVAR_USER_CREATED;
}
if ( flags & CVAR_SERVER_CREATED ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to set CVAR_SERVER_CREATED on cvar '%s'\n", varName );
flags &= ~CVAR_SERVER_CREATED;
}
if ( flags & CVAR_PROTECTED ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to set CVAR_PROTECTED on cvar '%s'\n", varName );
flags &= ~CVAR_PROTECTED;
}
if ( flags & CVAR_MODIFIED ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to set CVAR_MODIFIED on cvar '%s'\n", varName );
flags &= ~CVAR_MODIFIED;
}
if ( flags & CVAR_NONEXISTENT ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to set CVAR_NONEXISTENT on cvar '%s'\n", varName );
flags &= ~CVAR_NONEXISTENT;
}

cv = Cvar_FindVar(varName);

// Don't modify cvar if it's protected.
if ( cv && ( cv->flags & CVAR_PROTECTED ) ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to register protected cvar '%s' with value '%s'%s\n",
varName, defaultValue, ( flags & ~cv->flags ) != 0 ? " and new flags" : "" );
} else {
cv = Cvar_Get(varName, defaultValue, flags | CVAR_VM_CREATED);
}

if (!vmCvar)
return;


+ 42
- 3
code/qcommon/files.c View File

@@ -88,7 +88,7 @@ File search order: when FS_FOpenFileRead gets called it will go through the fs_s
structure and stop on the first successful hit. fs_searchpaths is built with successive
calls to FS_AddGameDirectory

Additionaly, we search in several subdirectories:
Additionally, we search in several subdirectories:
current game is the current mode
base game is a variable to allow mods based on other mods
(such as baseq3 + missionpack content combination in a mod for instance)
@@ -1413,7 +1413,7 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF
}
else
{
// When file is NULL, we're querying the existance of the file
// When file is NULL, we're querying the existence of the file
// If we've got here, it doesn't exist
return 0;
}
@@ -3087,6 +3087,23 @@ qboolean FS_CheckDirTraversal(const char *checkdir)
return qfalse;
}

/*
================
FS_InvalidGameDir

return true if path is a reference to current directory or directory traversal
or a sub-directory
================
*/
qboolean FS_InvalidGameDir( const char *gamedir ) {
if ( !strcmp( gamedir, "." ) || !strcmp( gamedir, ".." )
|| strchr( gamedir, '/' ) || strchr( gamedir, '\\' ) ) {
return qtrue;
}

return qfalse;
}

/*
================
FS_ComparePaks
@@ -3436,6 +3453,27 @@ static void FS_Startup( const char *gameName )
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
#endif

if (!gameName[0]) {
Cvar_ForceReset( "com_basegame" );
}

if (!FS_FilenameCompare(fs_gamedirvar->string, gameName)) {
// This is the standard base game. Servers and clients should
// use "" and not the standard basegame name because this messes
// up pak file negotiation and lots of other stuff
Cvar_ForceReset( "fs_game" );
}

if (FS_InvalidGameDir(gameName)) {
Com_Error( ERR_DROP, "Invalid com_basegame '%s'", gameName );
}
if (FS_InvalidGameDir(fs_basegame->string)) {
Com_Error( ERR_DROP, "Invalid fs_basegame '%s'", fs_basegame->string );
}
if (FS_InvalidGameDir(fs_gamedirvar->string)) {
Com_Error( ERR_DROP, "Invalid fs_game '%s'", fs_gamedirvar->string );
}

// add search path elements in reverse priority order

if (fs_lowPriorityDownloads->integer) {
@@ -3506,6 +3544,7 @@ static void FS_Startup( const char *gameName )
}
}


// add our commands
Cmd_AddCommand ("path", FS_Path_f);
Cmd_AddCommand ("dir", FS_Dir_f );
@@ -3938,7 +3977,7 @@ void FS_SetExtraPure( const char *mapname, const char *extrapaks )
================
FS_InitFilesystem

Called only at inital startup, not when the filesystem
Called only at initial startup, not when the filesystem
is resetting due to a game change
================
*/


+ 1
- 1
code/qcommon/huffman.c View File

@@ -401,7 +401,7 @@ void Huff_Compress(msg_t *mbuf, int offset) {
huff_t huff;

size = mbuf->cursize - offset;
buffer = mbuf->data+ + offset;
buffer = mbuf->data + offset;

if (size<=0) {
return;


+ 5
- 2
code/qcommon/md4.c View File

@@ -106,8 +106,11 @@ static void copy64(uint32_t *M, byte *in)
int i;

for (i=0;i<16;i++)
M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
(in[i*4+1]<<8) | (in[i*4+0]<<0);
M[i] =
((uint32_t)in[i*4+3] << 24) |
((uint32_t)in[i*4+2] << 16) |
((uint32_t)in[i*4+1] << 8) |
((uint32_t)in[i*4+0] << 0) ;
}

static void copy4(byte *out,uint32_t x)


+ 0
- 45
code/qcommon/msg.c View File

@@ -556,55 +556,10 @@ int MSG_HashKey(const char *string, int maxlen) {
return hash;
}

/*
=============================================================================

delta functions
=============================================================================
*/

extern cvar_t *cl_shownet;

#define LOG(x) if( cl_shownet && cl_shownet->integer == 4 ) { Com_Printf("%s ", x ); };

void MSG_WriteDelta( msg_t *msg, int oldV, int newV, int bits ) {
if ( oldV == newV ) {
MSG_WriteBits( msg, 0, 1 );
return;
}
MSG_WriteBits( msg, 1, 1 );
MSG_WriteBits( msg, newV, bits );
}

int MSG_ReadDelta( msg_t *msg, int oldV, int bits ) {
if ( MSG_ReadBits( msg, 1 ) ) {
return MSG_ReadBits( msg, bits );
}
return oldV;
}

void MSG_WriteDeltaFloat( msg_t *msg, float oldV, float newV ) {
floatint_t fi;
if ( oldV == newV ) {
MSG_WriteBits( msg, 0, 1 );
return;
}
fi.f = newV;
MSG_WriteBits( msg, 1, 1 );
MSG_WriteBits( msg, fi.i, 32 );
}

float MSG_ReadDeltaFloat( msg_t *msg, float oldV ) {
if ( MSG_ReadBits( msg, 1 ) ) {
floatint_t fi;

fi.i = MSG_ReadBits( msg, 32 );
return fi.f;
}
return oldV;
}

/*
=============================================================================



+ 1
- 1
code/qcommon/net_chan.c View File

@@ -52,7 +52,7 @@ to the new value before sending out any replies.
#define FRAGMENT_SIZE (MAX_PACKETLEN - 100)
#define PACKET_HEADER 10 // two ints and a short

#define FRAGMENT_BIT (1<<31)
#define FRAGMENT_BIT (1U<<31)

cvar_t *showpackets;
cvar_t *showdrop;


+ 4
- 3
code/qcommon/q_shared.c View File

@@ -746,13 +746,14 @@ qboolean Q_isintegral( float f )
return (int)f == f;
}

#ifdef _MSC_VER
#ifdef _WIN32
/*
=============
Q_vsnprintf
Special wrapper function for Microsoft's broken _vsnprintf() function.
MinGW comes with its own snprintf() which is not broken.
MinGW comes with its own vsnprintf() which is not broken. mingw-w64
however, uses Microsoft's broken _vsnprintf() function.
=============
*/



+ 7
- 4
code/qcommon/q_shared.h View File

@@ -142,6 +142,7 @@ typedef int intptr_t;
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
@@ -158,13 +159,15 @@ typedef int intptr_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
#else
#include <stdint.h>
#endif

#ifdef _WIN32
// vsnprintf is ISO/IEC 9899:1999
// abstracting this to make it portable
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
#else
#include <stdint.h>

#define Q_vsnprintf vsnprintf
#endif

@@ -249,7 +252,7 @@ typedef int clipHandle_t;

#define MAX_SAY_TEXT 150

// paramters for command buffer stuffing
// parameters for command buffer stuffing
typedef enum {
EXEC_NOW, // don't return until completed, a VM should NEVER use this,
// because some commands might cause the VM to be unloaded...
@@ -1215,7 +1218,7 @@ typedef struct playerState_s {
#define BUTTON_TALK 2 // displays talk balloon and disables actions
#define BUTTON_USE_HOLDABLE 4
#define BUTTON_GESTURE 8
#define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN
#define BUTTON_WALKING 16 // walking can't just be inferred from MOVE_RUN
// because a key pressed late in the frame will
// only generate a small move value for that frame
// walking will use different animations and


+ 2
- 1
code/qcommon/qcommon.h View File

@@ -676,7 +676,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void *
long FS_ReadFile(const char *qpath, void **buffer);
// returns the length of the file
// a null buffer will just return the file length without loading
// as a quick check for existance. -1 length == not present
// as a quick check for existence. -1 length == not present
// A 0 byte will always be appended at the end, so string ops are safe.
// the buffer should be considered read-only, because it may be cached
// for other uses.
@@ -737,6 +737,7 @@ void FS_PureServerSetLoadedPaks( const char *pakSums, const char *pakNames );
// sole exception of .cfg files.

qboolean FS_CheckDirTraversal(const char *checkdir);
qboolean FS_InvalidGameDir(const char *gamedir);
qboolean FS_GamePak(char *pak);
qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring );



+ 1
- 1
code/qcommon/surfaceflags.h View File

@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// This file must be identical in the quake and utils directories

// contents flags are seperate bits
// contents flags are separate bits
// a given brush can contribute multiple content bits

// these definitions also need to be in q_shared.h!


+ 3
- 3
code/qcommon/unzip.c View File

@@ -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.
*/


@@ -290,8 +290,8 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)

/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
If iCaseSenisivity = 1, comparison is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparison is not case sensitivity (like strcmpi
or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
(like 1 on Unix, 2 on Windows)


+ 2
- 2
code/qcommon/unzip.h View File

@@ -125,8 +125,8 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
int iCaseSensitivity));
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
If iCaseSenisivity = 1, comparison is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparison is not case sensitivity (like strcmpi
or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
(like 1 on Unix, 2 on Windows)


+ 2
- 2
code/qcommon/vm_powerpc.c View File

@@ -401,7 +401,7 @@ struct symbolic_jump {
// extensions / modifiers (branch-link)
unsigned long ext;

// dest_instruction refering to this jump
// dest_instruction referring to this jump
dest_instruction_t *parent;

// next jump
@@ -656,7 +656,7 @@ PPC_MakeFastMask( int mask )
* function local registers,
*
* normally only volatile registers are used, but if there aren't enough
* or function has to preserve some value while calling annother one
* or function has to preserve some value while calling another one
* then caller safe registers are used as well
*/
static const long int gpr_list[] = {


+ 1
- 1
code/qcommon/vm_x86.c View File

@@ -103,7 +103,7 @@ static int isu8(uint32_t v)

static int NextConstant4(void)
{
return (code[pc] | (code[pc+1]<<8) | (code[pc+2]<<16) | (code[pc+3]<<24));
return ((unsigned int)code[pc] | ((unsigned int)code[pc+1]<<8) | ((unsigned int)code[pc+2]<<16) | ((unsigned int)code[pc+3]<<24));
}

static int Constant4( void ) {


+ 2
- 2
code/renderercommon/tr_image_png.c View File

@@ -571,7 +571,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer)
{
/*
* Rewind to the start of this adventure
* and return unsuccessfull
* and return unsuccessful
*/

BufferedFileRewind(BF, BytesToRewind);
@@ -754,7 +754,7 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer)
ri.Free(CompressedData);

/*
* Check if the last puff() was successfull.
* Check if the last puff() was successful.
*/

if(!((puffResult == 0) && (puffDestLen > 0)))


+ 1
- 1
code/renderercommon/tr_public.h View File

@@ -151,7 +151,7 @@ typedef struct {
void (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) );

// a -1 return means the file does not exist
// NULL can be passed for buf to just determine existance
// NULL can be passed for buf to just determine existence
int (*FS_FileIsInPAK)( const char *name, int *pCheckSum );
long (*FS_ReadFile)( const char *name, void **buf );
void (*FS_FreeFile)( void *buf );


+ 1
- 1
code/renderercommon/tr_types.h View File

@@ -173,7 +173,7 @@ typedef enum {
} glDriverType_t;

typedef enum {
GLHW_GENERIC, // where everthing works the way it should
GLHW_GENERIC, // where everything works the way it should
GLHW_3DFX_2D3D, // Voodoo Banshee or Voodoo3, relevant since if this is
// the hardware type then there can NOT exist a secondary
// display adapter


+ 2
- 2
code/renderergl1/tr_backend.c View File

@@ -541,7 +541,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {

//
// change the tess parameters if needed
// a "entityMergable" shader is a shader that can have surfaces from seperate
// a "entityMergable" shader is a shader that can have surfaces from separate
// entities merged into a single batch, like smoke and blood puff sprites
if ( shader != NULL && ( shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted
|| ( entityNum != oldEntityNum && !shader->entityMergable ) ) ) {
@@ -742,7 +742,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
RB_EndSurface();
}

// we definately want to sync every frame for the cinematics
// we definitely want to sync every frame for the cinematics
qglFinish();

start = 0;


+ 2
- 2
code/renderergl1/tr_bsp.c View File

@@ -330,7 +330,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int
numIndexes = LittleLong( ds->numIndexes );

// create the srfSurfaceFace_t
sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints];
sfaceSize = offsetof( srfSurfaceFace_t, points ) + sizeof( *cv->points ) * numPoints;
ofsIndexes = sfaceSize;
sfaceSize += sizeof( int ) * numIndexes;

@@ -1428,7 +1428,7 @@ static void R_LoadNodesAndLeafs (lump_t *nodeLump, lump_t *leafLump) {
out->nummarksurfaces = LittleLong(inLeaf->numLeafSurfaces);
}

// chain decendants
// chain descendants
R_SetParent (s_worldData.nodes, NULL);
}



+ 2
- 2
code/renderergl1/tr_image.c View File

@@ -941,7 +941,7 @@ static int numImageLoaders = ARRAY_LEN( imageLoaders );
=================
R_LoadImage

Loads any of the supported image types into a cannonical
Loads any of the supported image types into a canonical
32 bit format.
=================
*/
@@ -1400,7 +1400,7 @@ SKINS
CommaParse

This is unfortunate, but the skin files aren't
compatable with our normal parsing rules.
compatible with our normal parsing rules.
==================
*/
static char *CommaParse( char **data_p ) {


+ 2
- 2
code/renderergl1/tr_light.c View File

@@ -134,7 +134,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
float totalFactor;

if ( ent->e.renderfx & RF_LIGHTING_ORIGIN ) {
// seperate lightOrigins are needed so an object that is
// separate lightOrigins are needed so an object that is
// sinking into the ground can still be lit, and so
// multi-part models can be lit identically
VectorCopy( ent->e.lightingOrigin, lightOrigin );
@@ -304,7 +304,7 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
// trace a sample point down to find ambient light
//
if ( ent->e.renderfx & RF_LIGHTING_ORIGIN ) {
// seperate lightOrigins are needed so an object that is
// separate lightOrigins are needed so an object that is
// sinking into the ground can still be lit, and so
// multi-part models can be lit identically
VectorCopy( ent->e.lightingOrigin, lightOrigin );


+ 2
- 2
code/renderergl1/tr_local.h View File

@@ -840,7 +840,7 @@ typedef struct {
int msec; // total msec for backend run
} backEndCounters_t;

// all state modified by the back end is seperated
// all state modified by the back end is separated
// from the front end state
typedef struct {
trRefdef_t refdef;
@@ -981,7 +981,7 @@ extern cvar_t *r_measureOverdraw; // enables stencil buffer overdraw measuremen
extern cvar_t *r_lodbias; // push/pull LOD transitions
extern cvar_t *r_lodscale;

extern cvar_t *r_primitives; // "0" = based on compiled vertex array existance
extern cvar_t *r_primitives; // "0" = based on compiled vertex array existence
// "1" = glDrawElemet tristrips
// "2" = glDrawElements triangles
// "-1" = no drawing


+ 3
- 3
code/renderergl1/tr_shade.c View File

@@ -448,7 +448,7 @@ static void ProjectDlightTexture_altivec( void ) {
dlight_t *dl;

if ( !( tess.dlightBits & ( 1 << l ) ) ) {
continue; // this surface definately doesn't have any of this light
continue; // this surface definitely doesn't have any of this light
}
texCoords = texCoordsArray[0];
colors = colorArray[0];
@@ -613,7 +613,7 @@ static void ProjectDlightTexture_scalar( void ) {
dlight_t *dl;

if ( !( tess.dlightBits & ( 1 << l ) ) ) {
continue; // this surface definately doesn't have any of this light
continue; // this surface definitely doesn't have any of this light
}
texCoords = texCoordsArray[0];
colors = colorArray[0];
@@ -745,7 +745,7 @@ static void ProjectDlightTexture_scalar( void ) {
static void ProjectDlightTexture( void ) {
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
// must be in a separate function or G3 systems will crash.
ProjectDlightTexture_altivec();
return;
}


+ 2
- 2
code/renderergl1/tr_shade_calc.c View File

@@ -345,7 +345,7 @@ static void GlobalVectorToLocal( const vec3_t in, vec3_t out ) {
=====================
AutospriteDeform

Assuming all the triangles for this shader are independant
Assuming all the triangles for this shader are independent
quads, rebuild them as forward facing sprites
=====================
*/
@@ -1206,7 +1206,7 @@ void RB_CalcDiffuseColor( unsigned char *colors )
{
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
// must be in a separate function or G3 systems will crash.
RB_CalcDiffuseColor_altivec( colors );
return;
}


+ 6
- 6
code/renderergl1/tr_shader.c View File

@@ -2088,7 +2088,7 @@ static shader_t *GeneratePermanentShader( void ) {
VertexLightingCollapse

If vertex lighting is enabled, only render a single
pass, trying to guess which is the correct one to best aproximate
pass, trying to guess which is the correct one to best approximate
what it is supposed to look like.
=================
*/
@@ -2493,18 +2493,18 @@ be defined for every single image used in the game, three default
shader behaviors can be auto-created for any image:

If lightmapIndex == LIGHTMAP_NONE, then the image will have
dynamic diffuse lighting applied to it, as apropriate for most
dynamic diffuse lighting applied to it, as appropriate for most
entity skin surfaces.

If lightmapIndex == LIGHTMAP_2D, then the image will be used
for 2D rendering unless an explicit shader is found

If lightmapIndex == LIGHTMAP_BY_VERTEX, then the image will use
the vertex rgba modulate values, as apropriate for misc_model
the vertex rgba modulate values, as appropriate for misc_model
pre-lit surfaces.

Other lightmapIndex values will have a lightmap stage created
and src*dest blending applied with the texture, as apropriate for
and src*dest blending applied with the texture, as appropriate for
most world construction surfaces.

===============
@@ -2551,7 +2551,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag

InitShader( strippedName, lightmapIndex );

// FIXME: set these "need" values apropriately
// FIXME: set these "need" values appropriately
shader.needsNormal = qtrue;
shader.needsST1 = qtrue;
shader.needsST2 = qtrue;
@@ -2689,7 +2689,7 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_

InitShader( name, lightmapIndex );

// FIXME: set these "need" values apropriately
// FIXME: set these "need" values appropriately
shader.needsNormal = qtrue;
shader.needsST1 = qtrue;
shader.needsST2 = qtrue;


+ 2
- 2
code/renderergl1/tr_surface.c View File

@@ -569,7 +569,7 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count)
// Vanilla PPC code, but since PPC has a reciprocal square root estimate instruction,
// runs *much* faster than calling sqrt(). We'll use a single Newton-Raphson
// refinement step to get a little more precision. This seems to yeild results
// refinement step to get a little more precision. This seems to yield results
// that are correct to 3 decimal places and usually correct to at least 4 (sometimes 5).
// (That is, for the given input range of about 0.6 to 2.0).
do {
@@ -844,7 +844,7 @@ static void LerpMeshVertexes(md3Surface_t *surf, float backlerp)
{
#if idppc_altivec
if (com_altivec->integer) {
// must be in a seperate function or G3 systems will crash.
// must be in a separate function or G3 systems will crash.
LerpMeshVertexes_altivec( surf, backlerp );
return;
}


+ 2
- 2
code/renderergl2/tr_backend.c View File

@@ -471,7 +471,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {

//
// change the tess parameters if needed
// a "entityMergable" shader is a shader that can have surfaces from seperate
// a "entityMergable" shader is a shader that can have surfaces from separate
// entities merged into a single batch, like smoke and blood puff sprites
if ( shader != NULL && ( shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted || pshadowed != oldPshadowed || cubemapIndex != oldCubemapIndex
|| ( entityNum != oldEntityNum && !shader->entityMergable ) ) ) {
@@ -689,7 +689,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
RB_EndSurface();
}

// we definately want to sync every frame for the cinematics
// we definitely want to sync every frame for the cinematics
qglFinish();

start = 0;


+ 1
- 1
code/renderergl2/tr_bsp.c View File

@@ -1947,7 +1947,7 @@ static void R_LoadNodesAndLeafs (lump_t *nodeLump, lump_t *leafLump) {
out->nummarksurfaces = LittleLong(inLeaf->numLeafSurfaces);
}

// chain decendants
// chain descendants
R_SetParent (s_worldData.nodes, NULL);
}



+ 1
- 1
code/renderergl2/tr_fbo.c View File

@@ -37,7 +37,7 @@ qboolean R_CheckFBO(const FBO_t * fbo)
if(code == GL_FRAMEBUFFER_COMPLETE)
return qtrue;

// an error occured
// an error occurred
switch (code)
{