mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-02 05:01:30 +00:00
Merge branch 'master' of git://github.com/UberGames/RPG-X2.git
This commit is contained in:
commit
61947264f6
5 changed files with 257 additions and 142 deletions
|
@ -2663,8 +2663,8 @@ void CG_NewClientInfo( int clientNum ) {
|
|||
clientInfo_t newInfo;
|
||||
const char *configstring;
|
||||
const char *v;
|
||||
char *model;
|
||||
char *skin;
|
||||
char *model = NULL;
|
||||
char *skin = NULL;
|
||||
size_t len;
|
||||
//int i;
|
||||
|
||||
|
|
|
@ -482,6 +482,8 @@ static void CG_EncodeIDFile( void )
|
|||
char strSubnet[3];
|
||||
int intSubnet[4];
|
||||
int i, j;
|
||||
|
||||
memset(strSubnet, 0, sizeof(strSubnet));
|
||||
|
||||
IP = (char *)CG_Argv( 1 );
|
||||
//IP = "143.163.12.2";
|
||||
|
@ -632,6 +634,8 @@ void CG_ShaderStateChanged(void) {
|
|||
|
||||
o = CG_ConfigString( CS_SHADERSTATE );
|
||||
|
||||
if(!o) return;
|
||||
|
||||
while (o && *o) {
|
||||
n = strstr(o, "=");
|
||||
if (n && *n) {
|
||||
|
|
186
game/q_math.c
186
game/q_math.c
|
@ -1,6 +1,8 @@
|
|||
// Copyright (C) 1999-2000 Id Software, Inc.
|
||||
//
|
||||
// q_math.c -- stateless support routines that are included in each code module
|
||||
/*
|
||||
* Copyright (C) 1999-2000 Id Software, Inc.
|
||||
*
|
||||
* q_math.c -- stateless support routines that are included in each code module
|
||||
*/
|
||||
#include "q_shared.h"
|
||||
|
||||
int nonansicast = 0;
|
||||
|
@ -11,66 +13,66 @@ vec3_t axisDefault[3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
|
|||
|
||||
vec4_t colorTable[CT_MAX] =
|
||||
{
|
||||
{0, 0, 0, 0}, // CT_NONE
|
||||
{0, 0, 0, 1}, // CT_BLACK
|
||||
{1, 0, 0, 1}, // CT_RED
|
||||
{0, 1, 0, 1}, // CT_GREEN
|
||||
{0, 0, 1, 1}, // CT_BLUE
|
||||
{1, 1, 0, 1}, // CT_YELLOW
|
||||
{1, 0, 1, 1}, // CT_MAGENTA
|
||||
{0, 1, 1, 1}, // CT_CYAN
|
||||
{0.071, 0.271, 0.29, 1},// CT_TEAL
|
||||
{0.529, 0.373, 0.017, 1},//CT_GOLD
|
||||
{1, 1, 1, 1}, // CT_WHITE
|
||||
{0.75, 0.75, 0.75, 1}, // CT_LTGREY
|
||||
{0.50, 0.50, 0.50, 1}, // CT_MDGREY
|
||||
{0.25, 0.25, 0.25, 1}, // CT_DKGREY
|
||||
{0.15, 0.15, 0.15, 1}, // CT_DKGREY2
|
||||
{0, 0, 0, 0}, /* CT_NONE */
|
||||
{0, 0, 0, 1}, /* CT_BLACK */
|
||||
{1, 0, 0, 1}, /* CT_RED */
|
||||
{0, 1, 0, 1}, /* CT_GREEN */
|
||||
{0, 0, 1, 1}, /* CT_BLUE */
|
||||
{1, 1, 0, 1}, /* CT_YELLOW */
|
||||
{1, 0, 1, 1}, /* CT_MAGENTA */
|
||||
{0, 1, 1, 1}, /* CT_CYAN */
|
||||
{0.071, 0.271, 0.29, 1}, /* CT_TEAL */
|
||||
{0.529, 0.373, 0.017, 1},/* CT_GOLD */
|
||||
{1, 1, 1, 1}, /* CT_WHITE */
|
||||
{0.75, 0.75, 0.75, 1}, /* CT_LTGREY */
|
||||
{0.50, 0.50, 0.50, 1}, /* CT_MDGREY */
|
||||
{0.25, 0.25, 0.25, 1}, /* CT_DKGREY */
|
||||
{0.15, 0.15, 0.15, 1}, /* CT_DKGREY2 */
|
||||
|
||||
{0.688, 0.797, 1, 1}, /* CT_VLTORANGE -- needs values */
|
||||
{0.688, 0.797, 1, 1}, /* CT_LTORANGE */
|
||||
{0.620, 0.710, 0.894, 1},/* CT_DKORANGE */
|
||||
{0.463, 0.525, 0.671, 1},/* CT_VDKORANGE */
|
||||
|
||||
{0.616, 0.718, 0.898, 1},/* CT_VLTBLUE1 */
|
||||
{0.286, 0.506, 0.898, 1},/* CT_LTBLUE1 */
|
||||
{0.082, 0.388, 0.898, 1},/* CT_DKBLUE1 */
|
||||
{0.063, 0.278, 0.514, 1},/* CT_VDKBLUE1 */
|
||||
|
||||
{0.688, 0.797, 1, 1}, // CT_VLTORANGE -- needs values
|
||||
{0.688, 0.797, 1, 1}, // CT_LTORANGE
|
||||
{0.620, 0.710, 0.894, 1}, // CT_DKORANGE
|
||||
{0.463, 0.525, 0.671, 1}, // CT_VDKORANGE
|
||||
{0.302, 0.380, 0.612, 1},/* CT_VLTBLUE2 -- needs values */
|
||||
{0.196, 0.314, 0.612, 1},/* CT_LTBLUE2 */
|
||||
{0.060, 0.227, 0.611, 1},/* CT_DKBLUE2 */
|
||||
{0.043, 0.161, 0.459, 1},/* CT_VDKBLUE2 */
|
||||
|
||||
{0.616, 0.718, 0.898, 1}, // CT_VLTBLUE1
|
||||
{0.286, 0.506, 0.898, 1}, // CT_LTBLUE1
|
||||
{0.082, 0.388, 0.898, 1}, // CT_DKBLUE1
|
||||
{0.063, 0.278, 0.514, 1}, // CT_VDKBLUE1
|
||||
{0.082, 0.388, 0.898, 1},/* CT_VLTBROWN1 -- needs values */
|
||||
{0.082, 0.388, 0.898, 1},/* CT_LTBROWN1 */
|
||||
{0.078, 0.320, 0.813, 1},/* CT_DKBROWN1 */
|
||||
{0.060, 0.227, 0.611, 1},/* CT_VDKBROWN1 */
|
||||
|
||||
{0.302, 0.380, 0.612, 1}, // CT_VLTBLUE2 -- needs values
|
||||
{0.196, 0.314, 0.612, 1}, // CT_LTBLUE2
|
||||
{0.060, 0.227, 0.611, 1}, // CT_DKBLUE2
|
||||
{0.043, 0.161, 0.459, 1}, // CT_VDKBLUE2
|
||||
{1, 0.784, 0.365, 1}, /* CT_VLTGOLD1 -- needs values */
|
||||
{1, 0.706, 0.153, 1}, /* CT_LTGOLD1 */
|
||||
{0.733, 0.514, 0.086, 1},/* CT_DKGOLD1 */
|
||||
{0.549, 0.384, 0.063, 1},/* CT_VDKGOLD1 */
|
||||
|
||||
{0.082, 0.388, 0.898, 1}, // CT_VLTBROWN1 -- needs values
|
||||
{0.082, 0.388, 0.898, 1}, // CT_LTBROWN1
|
||||
{0.078, 0.320, 0.813, 1}, // CT_DKBROWN1
|
||||
{0.060, 0.227, 0.611, 1}, // CT_VDKBROWN1
|
||||
{0.688, 0.797, 1, 1}, /* CT_VLTPURPLE1 -- needs values */
|
||||
{0.688, 0.797, 1, 1}, /* CT_LTPURPLE1 */
|
||||
{0.313, 0.578, 1, 1}, /* CT_DKPURPLE1 */
|
||||
{0.031, 0.110, 0.341, 1},/* CT_VDKPURPLE1 */
|
||||
|
||||
{1, 0.784, 0.365, 1}, // CT_VLTGOLD1 -- needs values
|
||||
{1, 0.706, 0.153, 1}, // CT_LTGOLD1
|
||||
{0.733, 0.514, 0.086, 1}, // CT_DKGOLD1
|
||||
{0.549, 0.384, 0.063, 1}, // CT_VDKGOLD1
|
||||
{0.688, 0.797, 1, 1}, /* CT_VLTPURPLE2 -- needs values */
|
||||
{0.688, 0.797, 1, 1}, /* CT_LTPURPLE2 */
|
||||
{0.688, 0.797, 1, 1}, /* CT_DKPURPLE2 */
|
||||
{0.031, 0.110, 0.341, 1},/* CT_VDKPURPLE2 */
|
||||
|
||||
{0.688, 0.797, 1, 1}, // CT_VLTPURPLE1 -- needs values
|
||||
{0.688, 0.797, 1, 1}, // CT_LTPURPLE1
|
||||
{0.313, 0.578, 1, 1}, // CT_DKPURPLE1
|
||||
{0.031, 0.110, 0.341, 1}, // CT_VDKPURPLE1
|
||||
{0.686, 0.808, 0.1, 1}, /* CT_VLTPURPLE3 */
|
||||
{0.188, 0.494, 1, 1}, /* CT_LTPURPLE3 */
|
||||
{0.094, 0.471, 1, 1}, /* CT_DKPURPLE3 */
|
||||
{0.067, 0.325, 0.749, 1},/* CT_VDKPURPLE3 */
|
||||
|
||||
{0.688, 0.797, 1, 1}, // CT_VLTPURPLE2 -- needs values
|
||||
{0.688, 0.797, 1, 1}, // CT_LTPURPLE2
|
||||
{0.688, 0.797, 1, 1}, // CT_DKPURPLE2
|
||||
{0.031, 0.110, 0.341, 1}, // CT_VDKPURPLE2
|
||||
|
||||
{0.686, 0.808, 0.1, 1}, // CT_VLTPURPLE3
|
||||
{0.188, 0.494, 1, 1}, // CT_LTPURPLE3
|
||||
{0.094, 0.471, 1, 1}, // CT_DKPURPLE3
|
||||
{0.067, 0.325, 0.749, 1}, // CT_VDKPURPLE3
|
||||
|
||||
{1, 0.612, 0.325, 1}, // CT_VLTRED1
|
||||
{1, 0.478, 0.098, 1}, // CT_LTRED1
|
||||
{1, 0.438, 0, 1}, // CT_DKRED1
|
||||
{0.784, 0.329, 0, 1}, // CT_VDKRED1
|
||||
{1, 0.612, 0.325, 1}, /* CT_VLTRED1 */
|
||||
{1, 0.478, 0.098, 1}, /* CT_LTRED1 */
|
||||
{1, 0.438, 0, 1}, /* CT_DKRED1 */
|
||||
{0.784, 0.329, 0, 1}, /* CT_VDKRED1 */
|
||||
|
||||
};
|
||||
|
||||
|
@ -184,7 +186,7 @@ vec3_t bytedirs[NUMVERTEXNORMALS] =
|
|||
{-0.587785, -0.425325, -0.688191}, {-0.688191, -0.587785, -0.425325}
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
/*==============================================================*/
|
||||
|
||||
int Q_rand( int *seed ) {
|
||||
*seed = (69069 * *seed + 1);
|
||||
|
@ -200,7 +202,7 @@ float Q_crandom( int *seed ) {
|
|||
}
|
||||
|
||||
|
||||
//=======================================================
|
||||
/*=======================================================*/
|
||||
|
||||
signed char ClampChar( int i ) {
|
||||
if ( i < -128 ) {
|
||||
|
@ -223,7 +225,7 @@ signed short ClampShort( int i ) {
|
|||
}
|
||||
|
||||
|
||||
// this isn't a real cheap function to call!
|
||||
/* this isn't a real cheap function to call! */
|
||||
/**
|
||||
* Converts a direction vector into a byte
|
||||
*/
|
||||
|
@ -305,7 +307,7 @@ float NormalizeColor( const vec3_t in, vec3_t out ) {
|
|||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
/*============================================================================*/
|
||||
|
||||
/*
|
||||
* \brief Returns false if the triangle is degenrate.
|
||||
|
@ -396,10 +398,10 @@ RotateAroundDirection
|
|||
*/
|
||||
void RotateAroundDirection( vec3_t axis[3], float yaw ) {
|
||||
|
||||
// create an arbitrary axis[1]
|
||||
/* create an arbitrary axis[1] */
|
||||
PerpendicularVector( axis[1], axis[0] );
|
||||
|
||||
// rotate it around axis[0] by yaw
|
||||
/* rotate it around axis[0] by yaw */
|
||||
if ( yaw ) {
|
||||
vec3_t temp;
|
||||
|
||||
|
@ -407,7 +409,7 @@ void RotateAroundDirection( vec3_t axis[3], float yaw ) {
|
|||
RotatePointAroundVector( axis[1], axis[0], temp, yaw );
|
||||
}
|
||||
|
||||
// cross to get axis[2]
|
||||
/* cross to get axis[2] */
|
||||
CrossProduct( axis[0], axis[1], axis[2] );
|
||||
}
|
||||
|
||||
|
@ -459,7 +461,7 @@ AnglesToAxis
|
|||
void AnglesToAxis( const vec3_t angles, vec3_t axis[3] ) {
|
||||
vec3_t right;
|
||||
|
||||
// angle vectors returns "right" instead of "y axis"
|
||||
/* angle vectors returns "right" instead of "y axis" */
|
||||
AngleVectors( angles, axis[0], right, axis[2] );
|
||||
VectorSubtract( vec3_origin, right, axis[1] );
|
||||
}
|
||||
|
@ -510,8 +512,10 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
|
|||
void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up) {
|
||||
float d;
|
||||
|
||||
// this rotate and negate guarantees a vector
|
||||
// not colinear with the original
|
||||
/*
|
||||
* this rotate and negate guarantees a vector
|
||||
* not colinear with the original
|
||||
*/
|
||||
right[1] = -forward[0];
|
||||
right[2] = forward[1];
|
||||
right[0] = forward[2];
|
||||
|
@ -530,7 +534,7 @@ void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out )
|
|||
out[2] = DotProduct( in, matrix[2] );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
/*============================================================================ */
|
||||
|
||||
/*
|
||||
* float q_rsqrt( float number )
|
||||
|
@ -549,11 +553,11 @@ float Q_rsqrt( float number )
|
|||
|
||||
x2 = number * 0.5F;
|
||||
y = number;
|
||||
i = * ( long * ) &y; // evil floating point bit level hacking
|
||||
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
|
||||
i = * ( long * ) &y; /* evil floating point bit level hacking */
|
||||
i = 0x5f3759df - ( i >> 1 ); /* what the fuck? */
|
||||
y = * ( float * ) &i;
|
||||
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
|
||||
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
|
||||
y = y * ( threehalfs - ( x2 * y * y ) ); /* 1st iteration */
|
||||
// y = y * ( threehalfs - ( x2 * y * y ) ); /* 2nd iteration, this can be removed */
|
||||
|
||||
return y;
|
||||
}
|
||||
|
@ -664,7 +668,7 @@ float AngleDelta ( float angle1, float angle2 ) {
|
|||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
/*============================================================*/
|
||||
|
||||
|
||||
/*
|
||||
|
@ -675,7 +679,7 @@ SetPlaneSignbits
|
|||
void SetPlaneSignbits (cplane_t *out) {
|
||||
int bits, j;
|
||||
|
||||
// for fast box on planeside test
|
||||
/* for fast box on planeside test */
|
||||
bits = 0;
|
||||
for (j=0 ; j<3 ; j++) {
|
||||
if (out->normal[j] < 0) {
|
||||
|
@ -734,7 +738,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
|||
float dist1, dist2;
|
||||
int sides;
|
||||
|
||||
// fast axial cases
|
||||
/* fast axial cases */
|
||||
if (p->type < 3)
|
||||
{
|
||||
if (p->dist <= emins[p->type])
|
||||
|
@ -744,7 +748,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
|||
return 3;
|
||||
}
|
||||
|
||||
// general case
|
||||
/* general case */
|
||||
switch (p->signbits)
|
||||
{
|
||||
case 0:
|
||||
|
@ -780,7 +784,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
|||
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||
break;
|
||||
default:
|
||||
dist1 = dist2 = 0; // shut up compiler
|
||||
dist1 = dist2 = 0; /* shut up compiler */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1103,10 +1107,10 @@ vec_t VectorNormalize( vec3_t v ) {
|
|||
return length;
|
||||
}
|
||||
|
||||
//
|
||||
// fast vector normalize routine that does not check to make sure
|
||||
// that length != 0, nor does it return length
|
||||
//
|
||||
/*
|
||||
* fast vector normalize routine that does not check to make sure
|
||||
* that length != 0, nor does it return length
|
||||
*/
|
||||
void VectorNormalizeFast( vec3_t v )
|
||||
{
|
||||
float ilength;
|
||||
|
@ -1276,7 +1280,7 @@ void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]) {
|
|||
void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) {
|
||||
float angle;
|
||||
static float sr, sp, sy, cr, cp, cy;
|
||||
// static to help MS compiler fp bugs
|
||||
/* static to help MS compiler fp bugs */
|
||||
|
||||
angle = angles[YAW] * (M_PI*2 / 360);
|
||||
sy = sin(angle);
|
||||
|
@ -1322,7 +1326,7 @@ void PerpendicularVector( vec3_t dst, const vec3_t src )
|
|||
** find the smallest magnitude axially aligned vector
|
||||
** bias towards using z instead of x or y
|
||||
*/
|
||||
// for ( pos = 0, i = 0; i < 3; i++ )
|
||||
/* for ( pos = 0, i = 0; i < 3; i++ ) */
|
||||
for ( pos = 0, i = 2; i >= 0; i-- )
|
||||
{
|
||||
if ( fabs( src[i] ) < minelem )
|
||||
|
@ -1360,13 +1364,13 @@ float flrandom(float min, float max)
|
|||
*/
|
||||
int irandom(int min, int max)
|
||||
{
|
||||
max++; //so it can round down
|
||||
max++; /* so it can round down */
|
||||
return (((rand() & 0x7FFF) * (max - min)) >> 15) + min;
|
||||
}
|
||||
|
||||
|
||||
// use for networking - normalizes a vector, then multiplies it by 65535.0, then calls snap vector on it
|
||||
// guarantee's a short per vector instead of 4 bytes.
|
||||
/* use for networking - normalizes a vector, then multiplies it by 65535.0, then calls snap vector on it
|
||||
guarantee's a short per vector instead of 4 bytes. */
|
||||
|
||||
void VectorShort(vec3_t vect)
|
||||
{
|
||||
|
@ -1393,7 +1397,7 @@ float Q_powf( float x, int y )
|
|||
return r;
|
||||
}
|
||||
|
||||
//TiM: Vector-Average. Good for calculating origins from bounding boxes
|
||||
/* TiM: Vector-Average. Good for calculating origins from bounding boxes */
|
||||
void VectorAverage( vec3_t mins, vec3_t maxs, vec3_t result ) {
|
||||
vec3_t temp;
|
||||
/*int i;
|
||||
|
@ -1401,12 +1405,12 @@ void VectorAverage( vec3_t mins, vec3_t maxs, vec3_t result ) {
|
|||
result[i] = ( mins[i] + maxs[i] ) * 0.5;
|
||||
}*/
|
||||
|
||||
//TiM: I 'unno... this way looks l33ter lol
|
||||
/* TiM: I 'unno... this way looks l33ter lol */
|
||||
VectorAdd( mins, maxs, temp );
|
||||
VectorScale( temp, 0.5, result );
|
||||
}
|
||||
|
||||
// Rounds the argument to the next integer. Used by SnapVector.
|
||||
/* Rounds the argument to the next integer. Used by SnapVector. */
|
||||
void init_tonextint(qboolean verbose)
|
||||
{
|
||||
float decimal = 0.9;
|
||||
|
@ -1459,7 +1463,7 @@ unsigned long atoul( const char *string )
|
|||
unsigned long value;
|
||||
int c;
|
||||
|
||||
// skip whitespace
|
||||
/* skip whitespace */
|
||||
while ( *string <= ' ' ) {
|
||||
if ( !*string ) {
|
||||
return 0;
|
||||
|
@ -1467,7 +1471,7 @@ unsigned long atoul( const char *string )
|
|||
string++;
|
||||
}
|
||||
|
||||
// read digits
|
||||
/* read digits */
|
||||
value = 0;
|
||||
do {
|
||||
c = *string++;
|
||||
|
@ -1478,7 +1482,7 @@ unsigned long atoul( const char *string )
|
|||
value = value * 10 + c;
|
||||
} while ( 1 );
|
||||
|
||||
// not handling 10e10 notation...
|
||||
/* not handling 10e10 notation... */
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
205
game/q_shared.c
205
game/q_shared.c
|
@ -1,13 +1,14 @@
|
|||
// Copyright (C) 1999-2000 Id Software, Inc.
|
||||
//
|
||||
// q_shared.c -- stateless support routines that are included in each code dll
|
||||
/* Copyright (C) 1999-2000 Id Software, Inc.
|
||||
*
|
||||
* q_shared.c -- stateless support routines that are included in each code dll
|
||||
*/
|
||||
#include "q_shared.h"
|
||||
|
||||
//vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work
|
||||
//vmCvar_t rpg_noclipspectating; //RPG-X J2J: Defined here to prevent link errors when compiling cgame
|
||||
//qboolean ClientNCSpec = qtrue; //RPG-X J2J: Private flag for weather the client chooses to spectate noclip style
|
||||
/*vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work
|
||||
vmCvar_t rpg_noclipspectating; //RPG-X J2J: Defined here to prevent link errors when compiling cgame
|
||||
qboolean ClientNCSpec = qtrue; //RPG-X J2J: Private flag for weather the client chooses to spectate noclip style*/
|
||||
|
||||
//float Q_powf ( float x, int y );
|
||||
/* float Q_powf ( float x, int y ); */
|
||||
|
||||
float Com_Clamp( float min, float max, float value ) {
|
||||
if ( value < min ) {
|
||||
|
@ -61,15 +62,15 @@ void COM_DefaultExtension (char *path, int maxSize, const char *extension ) {
|
|||
char oldPath[MAX_QPATH];
|
||||
char *src;
|
||||
|
||||
//
|
||||
// if path doesn't have a .EXT, append extension
|
||||
// (extension should include the .)
|
||||
//
|
||||
/*
|
||||
* if path doesn't have a .EXT, append extension
|
||||
* (extension should include the .)
|
||||
*/
|
||||
src = path + strlen(path) - 1;
|
||||
|
||||
while (*src != '/' && src != path) {
|
||||
if ( *src == '.' ) {
|
||||
return; // it has an extension
|
||||
return; /* it has an extension */
|
||||
}
|
||||
src--;
|
||||
}
|
||||
|
@ -86,8 +87,10 @@ void COM_DefaultExtension (char *path, int maxSize, const char *extension ) {
|
|||
============================================================================
|
||||
*/
|
||||
|
||||
// can't just use function pointers, or dll linkage can
|
||||
// mess up when qcommon is included in multiple places
|
||||
/*
|
||||
*can't just use function pointers, or dll linkage can
|
||||
* mess up when qcommon is included in multiple places
|
||||
*/
|
||||
static short (*_BigShort) (short l);
|
||||
static short (*_LittleShort) (short l);
|
||||
static int (*_BigLong) (int l);
|
||||
|
@ -97,20 +100,19 @@ static float (*_LittleFloat) (float l);
|
|||
|
||||
|
||||
#ifdef _M_IX86
|
||||
//
|
||||
// optimised version for intel stuff...
|
||||
//
|
||||
/*
|
||||
* optimised version for intel stuff...
|
||||
*/
|
||||
short BigShort(short l){return _BigShort(l);}
|
||||
int BigLong (int l) {return _BigLong(l);}
|
||||
float BigFloat (float l) {return _BigFloat(l);}
|
||||
#define LittleShort(l) l
|
||||
#define LittleLong(l) l
|
||||
#define LittleFloat(l) l
|
||||
//
|
||||
#else
|
||||
//
|
||||
// standard smart byte-swap stuff....
|
||||
//
|
||||
/*
|
||||
* standard smart byte-swap stuff....
|
||||
*/
|
||||
short BigShort(short l){return _BigShort(l);}
|
||||
short LittleShort(short l) {return _LittleShort(l);}
|
||||
int BigLong (int l) {return _BigLong(l);}
|
||||
|
@ -184,7 +186,7 @@ void Swap_Init (void)
|
|||
{
|
||||
byte swaptest[2] = {1,0};
|
||||
|
||||
// set the byte swapping variables in a portable manner
|
||||
/* set the byte swapping variables in a portable manner */
|
||||
if ( *(short *)swaptest == 1)
|
||||
{
|
||||
_BigShort = ShortSwap;
|
||||
|
@ -273,7 +275,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
len = 0;
|
||||
com_token[0] = 0;
|
||||
|
||||
// make sure incoming data is valid
|
||||
/* make sure incoming data is valid */
|
||||
if ( !data )
|
||||
{
|
||||
*data_p = NULL;
|
||||
|
@ -282,7 +284,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
|
||||
while ( 1 )
|
||||
{
|
||||
// skip whitespace
|
||||
/* skip whitespace */
|
||||
data = SkipWhitespace( data, &hasNewLines );
|
||||
if ( !data )
|
||||
{
|
||||
|
@ -297,13 +299,13 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
|
||||
c = *data;
|
||||
|
||||
// skip double slash comments
|
||||
/* skip double slash comments */
|
||||
if ( c == '/' && data[1] == '/' )
|
||||
{
|
||||
while (*data && *data != '\n')
|
||||
data++;
|
||||
}
|
||||
// skip /* */ comments
|
||||
/* skip comments */
|
||||
else if ( c=='/' && data[1] == '*' )
|
||||
{
|
||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||
|
@ -321,7 +323,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
}
|
||||
}
|
||||
|
||||
// handle quoted strings
|
||||
/* handle quoted strings */
|
||||
if (c == '\"')
|
||||
{
|
||||
data++;
|
||||
|
@ -342,7 +344,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
}
|
||||
}
|
||||
|
||||
// parse a regular word
|
||||
/* parse a regular word */
|
||||
do
|
||||
{
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
|
@ -358,7 +360,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
|
||||
if (len == MAX_TOKEN_CHARS)
|
||||
{
|
||||
// Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
|
||||
/* Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS); */
|
||||
len = 0;
|
||||
}
|
||||
com_token[len] = 0;
|
||||
|
@ -457,7 +459,7 @@ qboolean COM_ParseVec3( char **data, vec3_t vector )
|
|||
vector[i] = atof( token );
|
||||
}
|
||||
|
||||
//TiM: Not reeeeally necessary
|
||||
/* TiM: Not reeeeally necessary */
|
||||
token = COM_ParseExt( data, qfalse );
|
||||
if ( token[0] == 0 )
|
||||
{
|
||||
|
@ -505,7 +507,7 @@ qboolean COM_ParseVec4( char **data, vec4_t vector )
|
|||
vector[i] = atof( token );
|
||||
}
|
||||
|
||||
//TiM: Not reeeeally necessary
|
||||
/* TiM: Not reeeeally necessary */
|
||||
token = COM_ParseExt( data, qfalse );
|
||||
if ( token[0] == 0 )
|
||||
{
|
||||
|
@ -522,7 +524,7 @@ qboolean COM_ParseVec4( char **data, vec4_t vector )
|
|||
}
|
||||
|
||||
#if 0
|
||||
// no longer used
|
||||
/* no longer used */
|
||||
/*
|
||||
===============
|
||||
COM_ParseInfos
|
||||
|
@ -604,7 +606,7 @@ void SkipBracedSection (char **program) {
|
|||
char *token;
|
||||
int depth=0;
|
||||
|
||||
if (com_token[0]=='{') { //for tr_shader which just ate the brace
|
||||
if (com_token[0]=='{') { /* for tr_shader which just ate the brace */
|
||||
depth = 1;
|
||||
}
|
||||
do {
|
||||
|
@ -765,7 +767,7 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) {
|
|||
int Q_stricmpn (const char *s1, const char *s2, int n) {
|
||||
int c1, c2;
|
||||
|
||||
// bk001129 - moved in 1.17 fix not in id codebase
|
||||
/* bk001129 - moved in 1.17 fix not in id codebase */
|
||||
if ( s1 == NULL ) {
|
||||
if ( s2 == NULL )
|
||||
return 0;
|
||||
|
@ -782,7 +784,7 @@ int Q_stricmpn (const char *s1, const char *s2, int n) {
|
|||
c2 = *s2++;
|
||||
|
||||
if (!n--) {
|
||||
return 0; // strings are equal until end point
|
||||
return 0; /* strings are equal until end point */
|
||||
}
|
||||
|
||||
if (c1 != c2) {
|
||||
|
@ -798,7 +800,7 @@ int Q_stricmpn (const char *s1, const char *s2, int n) {
|
|||
}
|
||||
} while (c1);
|
||||
|
||||
return 0; // strings are equal
|
||||
return 0; /* strings are equal */
|
||||
}
|
||||
|
||||
int Q_strncmp (const char *s1, const char *s2, int n) {
|
||||
|
@ -809,7 +811,7 @@ int Q_strncmp (const char *s1, const char *s2, int n) {
|
|||
c2 = *s2++;
|
||||
|
||||
if (!n--) {
|
||||
return 0; // strings are equal until end point
|
||||
return 0; /* strings are equal until end point */
|
||||
}
|
||||
|
||||
if (c1 != c2) {
|
||||
|
@ -817,7 +819,7 @@ int Q_strncmp (const char *s1, const char *s2, int n) {
|
|||
}
|
||||
} while (c1);
|
||||
|
||||
return 0; // strings are equal
|
||||
return 0; /* strings are equal */
|
||||
}
|
||||
|
||||
int Q_stricmp (const char *s1, const char *s2) {
|
||||
|
@ -847,7 +849,7 @@ char *Q_strupr( char *s1 ) {
|
|||
return s1;
|
||||
}
|
||||
|
||||
// never goes past bounds or leaves without a terminating 0
|
||||
/* never goes past bounds or leaves without a terminating 0 */
|
||||
void Q_strcat( char *dest, int size, const char *src ) {
|
||||
int l1;
|
||||
|
||||
|
@ -903,11 +905,11 @@ char *Q_CleanStr( char *string ) {
|
|||
return string;
|
||||
}
|
||||
|
||||
|
||||
#ifdef QVM
|
||||
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
|
||||
int len;
|
||||
va_list argptr;
|
||||
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
|
||||
char bigbuffer[32000]; /* big, but small enough to fit in PPC stack */
|
||||
|
||||
va_start (argptr,fmt);
|
||||
len = vsprintf (bigbuffer,fmt,argptr);
|
||||
|
@ -922,7 +924,34 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
|
|||
}
|
||||
Q_strncpyz (dest, bigbuffer, size );
|
||||
}
|
||||
#else
|
||||
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
|
||||
int len;
|
||||
va_list argptr;
|
||||
char *bigbuffer = NULL;
|
||||
|
||||
bigbuffer = (char *)malloc(sizeof(char)*32000);
|
||||
if(!bigbuffer) {
|
||||
Com_Printf("Com_sprintf: could not allocate %u bytes for BigBuffer\n", sizeof(char)*32000);
|
||||
return;
|
||||
}
|
||||
memset(bigbuffer, 0, sizeof(bigbuffer));
|
||||
|
||||
va_start (argptr,fmt);
|
||||
len = vsprintf (bigbuffer,fmt,argptr);
|
||||
va_end (argptr);
|
||||
if ( len >= sizeof( bigbuffer ) ) {
|
||||
free(bigbuffer);
|
||||
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
|
||||
}
|
||||
if (len >= size) {
|
||||
Com_Printf ("Com_sprintf: overflow of %i in %i\n", len, size);
|
||||
Com_Printf("Fmt: %s\n", fmt);
|
||||
Com_Printf("BigBuffer: %s\n", bigbuffer);
|
||||
}
|
||||
Q_strncpyz (dest, bigbuffer, size );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -935,7 +964,7 @@ FIXME: make this buffer size safe someday
|
|||
*/
|
||||
char * QDECL va( char *format, ... ) {
|
||||
va_list argptr;
|
||||
static char string[2][32000]; // in case va is called by nested functions
|
||||
static char string[2][32000]; /* in case va is called by nested functions */
|
||||
static int index = 0;
|
||||
char *buf;
|
||||
|
||||
|
@ -969,8 +998,8 @@ FIXME: overflow check?
|
|||
*/
|
||||
char *Info_ValueForKey( const char *s, const char *key ) {
|
||||
char pkey[BIG_INFO_KEY];
|
||||
static char value[2][BIG_INFO_VALUE]; // use two buffers so compares
|
||||
// work without stomping on each other
|
||||
static char value[2][BIG_INFO_VALUE]; /* use two buffers so compares
|
||||
work without stomping on each other */
|
||||
static int valueindex = 0;
|
||||
char *o;
|
||||
|
||||
|
@ -1073,6 +1102,9 @@ void Info_RemoveKey( char *s, const char *key ) {
|
|||
Com_Error( ERR_DROP, "Info_RemoveKey: oversize infostring" );
|
||||
}
|
||||
|
||||
memset(pkey, 0, sizeof(pkey));
|
||||
memset(value, 0, sizeof(value));
|
||||
|
||||
if (strchr (key, '\\')) {
|
||||
return;
|
||||
}
|
||||
|
@ -1103,7 +1135,7 @@ void Info_RemoveKey( char *s, const char *key ) {
|
|||
|
||||
if (!strcmp (key, pkey) )
|
||||
{
|
||||
strcpy (start, s); // remove this part
|
||||
strcpy (start, s); /* remove this part */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1118,7 +1150,7 @@ void Info_RemoveKey( char *s, const char *key ) {
|
|||
Info_RemoveKey_Big
|
||||
===================
|
||||
*/
|
||||
void Info_RemoveKey_Big( char *s, const char *key ) {
|
||||
#ifdef QVM
|
||||
char *start;
|
||||
char pkey[BIG_INFO_KEY];
|
||||
char value[BIG_INFO_VALUE];
|
||||
|
@ -1158,7 +1190,7 @@ void Info_RemoveKey_Big( char *s, const char *key ) {
|
|||
|
||||
if (!strcmp (key, pkey) )
|
||||
{
|
||||
strcpy (start, s); // remove this part
|
||||
strcpy (start, s); /* remove this part */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1199,82 @@ void Info_RemoveKey_Big( char *s, const char *key ) {
|
|||
}
|
||||
|
||||
}
|
||||
#else
|
||||
void Info_RemoveKey_Big( char *s, const char *key ) {
|
||||
char *start;
|
||||
char *pkey;
|
||||
char *value;
|
||||
char *o;
|
||||
|
||||
if ( strlen( s ) >= BIG_INFO_STRING ) {
|
||||
Com_Error( ERR_DROP, "Info_RemoveKey_Big: oversize infostring" );
|
||||
}
|
||||
|
||||
pkey = (char *)malloc(sizeof(char)*BIG_INFO_KEY);
|
||||
if(!pkey) {
|
||||
Com_Printf("Info_RemoveKey_Big: could not allocate %u byte\n", sizeof(char)*BIG_INFO_KEY);
|
||||
return;
|
||||
}
|
||||
value = (char *)malloc(sizeof(char)*BIG_INFO_VALUE);
|
||||
if(!value) {
|
||||
Com_Printf("Info_RemoveKey_Big: could not allocate %u byte\n", sizeof(char)*BIG_INFO_VALUE);
|
||||
free(value);
|
||||
return;
|
||||
}
|
||||
if (strchr (key, '\\')) {
|
||||
free(pkey);
|
||||
free(value);
|
||||
return;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
start = s;
|
||||
if (*s == '\\')
|
||||
s++;
|
||||
o = pkey;
|
||||
while (*s != '\\')
|
||||
{
|
||||
if (!*s) {
|
||||
free(value);
|
||||
free(pkey);
|
||||
return;
|
||||
}
|
||||
*o++ = *s++;
|
||||
}
|
||||
*o = 0;
|
||||
s++;
|
||||
|
||||
o = value;
|
||||
while (*s != '\\' && *s)
|
||||
{
|
||||
if (!*s) {
|
||||
free(pkey);
|
||||
free(value);
|
||||
return;
|
||||
}
|
||||
*o++ = *s++;
|
||||
}
|
||||
*o = 0;
|
||||
|
||||
if (!strcmp (key, pkey) )
|
||||
{
|
||||
strcpy (start, s); /* remove this part */
|
||||
free(value);
|
||||
free(pkey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!*s) {
|
||||
free(pkey);
|
||||
free(value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
free(value);
|
||||
free(pkey);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -1327,7 +1434,7 @@ const char *GetStringForID( stringID_table_t *table, int id )
|
|||
int index = 0;
|
||||
|
||||
while ( ( table[index].name != NULL ) &&
|
||||
( table[index].name[0] != 0 )/*VALIDSTRING( table[index].name )*/ )//RPG-X: RedTechie - Compile errors Fixed
|
||||
( table[index].name[0] != 0 )/*VALIDSTRING( table[index].name )*/ )/* RPG-X: RedTechie - Compile errors Fixed */
|
||||
{
|
||||
if ( table[index].id == id )
|
||||
return table[index].name;
|
||||
|
@ -1339,6 +1446,6 @@ const char *GetStringForID( stringID_table_t *table, int id )
|
|||
}
|
||||
|
||||
|
||||
//====================================================================
|
||||
/*====================================================================*/
|
||||
|
||||
|
||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue