summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_lib.c144
-rw-r--r--src/game/bg_lib.h6
-rw-r--r--src/game/bg_local.h2
-rw-r--r--src/game/bg_misc.c361
-rw-r--r--src/game/bg_pmove.c260
-rw-r--r--src/game/bg_public.h120
-rw-r--r--src/game/bg_slidemove.c34
-rw-r--r--src/game/g_active.c256
-rw-r--r--src/game/g_buildable.c411
-rw-r--r--src/game/g_client.c155
-rw-r--r--src/game/g_cmds.c280
-rw-r--r--src/game/g_combat.c290
-rw-r--r--src/game/g_local.h47
-rw-r--r--src/game/g_main.c182
-rw-r--r--src/game/g_maprotation.c98
-rw-r--r--src/game/g_mem.c320
-rw-r--r--src/game/g_misc.c20
-rw-r--r--src/game/g_missile.c32
-rw-r--r--src/game/g_mover.c234
-rw-r--r--src/game/g_physics.c8
-rw-r--r--src/game/g_ptr.c14
-rw-r--r--src/game/g_public.h14
-rw-r--r--src/game/g_session.c78
-rw-r--r--src/game/g_spawn.c30
-rw-r--r--src/game/g_svcmds.c128
-rw-r--r--src/game/g_syscalls.c2
-rw-r--r--src/game/g_target.c82
-rw-r--r--src/game/g_team.c20
-rw-r--r--src/game/g_trigger.c98
-rw-r--r--src/game/g_utils.c80
-rw-r--r--src/game/g_weapon.c195
-rw-r--r--src/game/q_math.c254
-rw-r--r--src/game/q_shared.c32
-rw-r--r--src/game/q_shared.h34
-rw-r--r--src/game/tremulous.h20
35 files changed, 2153 insertions, 2188 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c
index b0f543bf..b4ba5696 100644
--- a/src/game/bg_lib.c
+++ b/src/game/bg_lib.c
@@ -15,7 +15,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "q_shared.h"
/*-
@@ -228,7 +228,7 @@ char *strcat( char *strDestination, const char *strSource )
s = strDestination;
while( *s )
s++;
-
+
while( *strSource )
*s++ = *strSource++;
@@ -241,7 +241,7 @@ char *strcpy( char *strDestination, const char *strSource )
char *s;
s = strDestination;
-
+
while( *strSource )
*s++ = *strSource++;
@@ -266,15 +266,15 @@ char *strrchr( const char *string, int c )
{
int i, length = strlen( string );
char *p;
-
+
for( i = length - 1; i >= 0; i-- )
{
p = (char *)&string[ i ];
-
+
if( *p == c )
return (char *)p;
}
-
+
return (char *)0;
}
@@ -301,10 +301,10 @@ char *strstr( const char *string, const char *strCharSet )
if( string[ i ] != strCharSet[ i ] )
break;
}
-
+
if( !strCharSet[ i ] )
return (char *)string;
-
+
string++;
}
return (char *)0;
@@ -351,7 +351,7 @@ void *memmove( void *dest, const void *src, size_t count )
for( i = 0; i < count; i++ )
( (char *)dest )[ i ] = ( (char *)src )[ i ];
}
-
+
return dest;
}
@@ -803,14 +803,14 @@ double atan2( double y, double x ) {
}
}
- return base + dir * i * ( M_PI/2048);
+ return base + dir * i * ( M_PI/2048);
}
#endif
#ifdef Q3_VM
-// bk001127 - guarded this tan replacement
+// bk001127 - guarded this tan replacement
// ld: undefined versioned symbol name tan@@GLIBC_2.0
double tan( double x )
{
@@ -880,10 +880,10 @@ double acos( double x )
{
float z, subp, p, q, r, w, s, c, df;
int hx, ix;
-
+
GET_FLOAT_WORD( hx, x );
ix = hx & 0x7fffffff;
-
+
if( ix == 0x3f800000 )
{ // |x|==1
if( hx > 0 )
@@ -895,12 +895,12 @@ double acos( double x )
{ // |x| >= 1
return (x-x)/(x-x); // acos(|x|>1) is NaN
}
-
+
if( ix < 0x3f000000 )
{ // |x| < 0.5
if( ix <= 0x23000000 )
return pio2_hi + pio2_lo;//if|x|<2**-57
-
+
z = x * x;
subp = pS3 + z * ( pS4 + z * pS5 );
// chop up expression to keep mac register based stack happy
@@ -945,7 +945,7 @@ static const float
bp[ ] = { 1.0, 1.5, },
dp_h[ ] = { 0.0, 5.84960938e-01, }, /* 0x3f15c000 */
dp_l[ ] = { 0.0, 1.56322085e-06, }, /* 0x35d1cfdc */
-huge = 1.0e+30,
+huge = 1.0e+30,
tiny = 1.0e-30,
zero = 0.0,
one = 1.0,
@@ -984,13 +984,13 @@ copysignf
static float copysignf( float x, float y )
{
unsigned int ix, iy;
-
+
GET_FLOAT_WORD( ix, x );
GET_FLOAT_WORD( iy, y );
SET_FLOAT_WORD( x, ( ix & 0x7fffffff ) | ( iy & 0x80000000 ) );
return x;
}
-
+
/*
==================
__scalbnf
@@ -999,25 +999,25 @@ __scalbnf
static float __scalbnf( float x, int n )
{
int k, ix;
-
+
GET_FLOAT_WORD( ix, x );
-
+
k = ( ix & 0x7f800000 ) >> 23; /* extract exponent */
-
+
if( k == 0 )
{ /* 0 or subnormal x */
if( ( ix & 0x7fffffff ) == 0 )
return x; /* +-0 */
-
+
x *= two25;
GET_FLOAT_WORD( ix, x );
k = ( ( ix & 0x7f800000 ) >> 23 ) - 25;
}
if( k == 0xff )
return x+x; /* NaN or Inf */
-
+
k = k + n;
-
+
if( n > 50000 || k > 0xfe )
return huge * copysignf( huge, x ); /* overflow */
if ( n < -50000 )
@@ -1029,7 +1029,7 @@ static float __scalbnf( float x, int n )
}
if( k <= -25 )
return tiny * copysignf( tiny, x ); /*underflow*/
-
+
k += 25; /* subnormal result */
SET_FLOAT_WORD( x, ( ix & 0x807fffff ) | ( k << 23 ) );
return x * twom25;
@@ -1046,13 +1046,13 @@ float pow( float x, float y )
float y1, subt1, t1, t2, subr, r, s, t, u, v, w;
int i, j, k, yisint, n;
int hx, hy, ix, iy, is;
-
+
/*TA: for some reason the Q3 VM goes apeshit when x = 1.0
and y > 1.0. Curiously this doesn't happen with gcc
- hence this hack*/
+ hence this hack*/
if( x == 1.0 )
return x;
-
+
GET_FLOAT_WORD( hx, x );
GET_FLOAT_WORD( hy, y );
ix = hx & 0x7fffffff;
@@ -1095,7 +1095,7 @@ float pow( float x, float y )
else /* (|x|<1)**-,+inf = inf,0 */
return ( hy < 0 ) ? -y : zero;
}
-
+
if( iy == 0x3f800000 )
{ /* y is +-1 */
if( hy < 0 )
@@ -1103,10 +1103,10 @@ float pow( float x, float y )
else
return x;
}
-
+
if( hy == 0x40000000 )
return x * x; /* y is 2 */
-
+
if( hy == 0x3f000000 )
{ /* y is 0.5 */
if( hx >= 0 ) /* x >= +0 */
@@ -1114,7 +1114,7 @@ float pow( float x, float y )
}
ax = fabs( x );
-
+
/* special value of x */
if( ix == 0x7f800000 || ix == 0 || ix == 0x3f800000 )
{
@@ -1128,7 +1128,7 @@ float pow( float x, float y )
else if( yisint == 1 )
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
-
+
return z;
}
@@ -1142,7 +1142,7 @@ float pow( float x, float y )
/* over/underflow if x is not close to one */
if( ix < 0x3f7ffff8 )
return ( hy < 0 ) ? huge * huge : tiny * tiny;
-
+
if( ix > 0x3f800007 )
return ( hy > 0 ) ? huge * huge : tiny * tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
@@ -1167,10 +1167,10 @@ float pow( float x, float y )
n -= 24;
GET_FLOAT_WORD( ix, ax );
}
-
+
n += ( ( ix ) >> 23 ) - 0x7f;
j = ix & 0x007fffff;
-
+
/* determine interval */
ix = j | 0x3f800000; /* normalize ix */
if( j <= 0x1cc471 )
@@ -1236,7 +1236,7 @@ float pow( float x, float y )
p_h = y1 * t1;
z = p_l + p_h;
GET_FLOAT_WORD( j, z );
-
+
if( j > 0x43000000 ) /* if z > 128 */
return s * huge * huge; /* overflow */
else if( j == 0x43000000 )
@@ -1251,27 +1251,27 @@ float pow( float x, float y )
if( p_l <= z - p_h )
return s * tiny * tiny; /* underflow */
}
-
+
/*
* compute 2**(p_h+p_l)
*/
i = j & 0x7fffffff;
k = ( i >> 23 ) - 0x7f;
n = 0;
-
+
if( i > 0x3f000000 )
{ /* if |z| > 0.5, set n = [z+0.5] */
n = j + ( 0x00800000 >> ( k + 1 ) );
k = ( ( n & 0x7fffffff ) >> 23 ) - 0x7f; /* new k for n */
SET_FLOAT_WORD( t, n & ~( 0x007fffff >> k ) );
n = ( ( n & 0x007fffff ) | 0x00800000 ) >> ( 23 - k );
-
+
if( j < 0 )
n = -n;
-
+
p_h -= t;
}
-
+
t = p_l + p_h;
GET_FLOAT_WORD( is, t );
SET_FLOAT_WORD( t, is & 0xfffff000 );
@@ -1287,12 +1287,12 @@ float pow( float x, float y )
z = one - ( r - z );
GET_FLOAT_WORD( j, z );
j += (n << 23 );
-
+
if( ( j >> 23 ) <= 0 )
z = __scalbnf( z, n ); /* subnormal output */
else
SET_FLOAT_WORD( z, j );
-
+
return s * z;
}
@@ -1324,7 +1324,7 @@ double atof( const char *string )
{
if( !*string )
return 0;
-
+
string++;
}
@@ -1335,12 +1335,12 @@ double atof( const char *string )
string++;
sign = 1;
break;
-
+
case '-':
string++;
sign = -1;
break;
-
+
default:
sign = 1;
break;
@@ -1349,7 +1349,7 @@ double atof( const char *string )
// read digits
value = 0;
c = string[ 0 ];
-
+
if( c != '.' )
{
do
@@ -1406,7 +1406,7 @@ double _atof( const char **stringPtr )
*stringPtr = string;
return 0;
}
-
+
string++;
}
@@ -1417,12 +1417,12 @@ double _atof( const char **stringPtr )
string++;
sign = 1;
break;
-
+
case '-':
string++;
sign = -1;
break;
-
+
default:
sign = 1;
break;
@@ -1497,12 +1497,12 @@ int atoi( const char *string )
string++;
sign = 1;
break;
-
+
case '-':
string++;
sign = -1;
break;
-
+
default:
sign = 1;
break;
@@ -1551,12 +1551,12 @@ int _atoi( const char **stringPtr )
string++;
sign = 1;
break;
-
+
case '-':
string++;
sign = -1;
break;
-
+
default:
sign = 1;
break;
@@ -1569,7 +1569,7 @@ int _atoi( const char **stringPtr )
c = *string++;
if( c < '0' || c > '9' )
break;
-
+
c -= '0';
value = value * 10 + c;
} while( 1 );
@@ -1673,7 +1673,7 @@ void AddFloat( char **buf_p, float fval, int width, int prec )
// write the float number
digits = 0;
val = (int)fval;
-
+
do
{
text[ digits++ ] = '0' + val % 10;
@@ -1696,10 +1696,10 @@ void AddFloat( char **buf_p, float fval, int width, int prec )
if( prec < 0 )
prec = 6;
-
+
// write the fraction
digits = 0;
-
+
while( digits < prec )
{
fval -= (int)fval;
@@ -1714,7 +1714,7 @@ void AddFloat( char **buf_p, float fval, int width, int prec )
*buf++ = '.';
for( prec = 0; prec < digits; prec++ )
*buf++ = text[ prec ];
-
+
*buf_p = buf;
}
}
@@ -1825,19 +1825,19 @@ reswitch:
case '-':
flags |= LADJUST;
goto rflag;
-
+
case '.':
n = 0;
while( is_digit( ( ch = *fmt++ ) ) )
n = 10 * n + ( ch - '0' );
-
+
prec = n < 0 ? -1 : n;
goto reswitch;
-
+
case '0':
flags |= ZEROPAD;
goto rflag;
-
+
case '1':
case '2':
case '3':
@@ -1853,21 +1853,21 @@ reswitch:
n = 10 * n + ( ch - '0' );
ch = *fmt++;
} while( is_digit( ch ) );
-
+
width = n;
goto reswitch;
-
+
case 'c':
*buf_p++ = (char)*arg;
arg++;
break;
-
+
case 'd':
case 'i':
AddInt( &buf_p, *arg, width, flags );
arg++;
break;
-
+
case 'f':
AddFloat( &buf_p, *(double *)arg, width, prec );
#ifdef __LCC__
@@ -1876,21 +1876,21 @@ reswitch:
arg += 2;
#endif
break;
-
+
case 's':
AddString( &buf_p, (char *)*arg, width, prec );
arg++;
break;
-
+
case 'v':
AddVec3_t( &buf_p, (vec_t *)*arg, width, prec );
arg++;
break;
-
+
case '%':
*buf_p++ = ch;
break;
-
+
default:
*buf_p++ = (char)*arg;
arg++;
diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h
index 221e19e4..d31f4cf8 100644
--- a/src/game/bg_lib.h
+++ b/src/game/bg_lib.h
@@ -15,7 +15,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
typedef int size_t;
typedef char * va_list;
@@ -42,8 +42,8 @@ typedef char * va_list;
// Misc functions
typedef int cmp_t( const void *, const void * );
void qsort( void *a, size_t n, size_t es, cmp_t *cmp );
-void srand( unsigned seed );
-int rand( void );
+void srand( unsigned seed );
+int rand( void );
// String functions
size_t strlen( const char *string );
diff --git a/src/game/bg_local.h b/src/game/bg_local.h
index 88dfe5be..7e5ea46f 100644
--- a/src/game/bg_local.h
+++ b/src/game/bg_local.h
@@ -26,7 +26,7 @@
#define OVERCLIP 1.001f
#define FALLING_THRESHOLD -900.0f //what vertical speed to start falling sound at
-
+
// all of the locals will be zeroed before each
// pmove, just to make damn sure we don't have
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index dcd33bf1..d2aefabc 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -14,7 +14,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "q_shared.h"
#include "bg_public.h"
@@ -27,7 +27,7 @@ void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin
buildableAttributes_t bg_buildableList[ ] =
{
{
- BA_A_SPAWN, //int buildNum;
+ BA_A_SPAWN, //int buildNum;
"eggpod", //char *buildName;
"Egg", //char *humanName;
"team_alien_spawn", //char *entityName;
@@ -729,7 +729,7 @@ float BG_FindModelScaleForBuildable( int bclass )
if( bg_buildableList[ i ].buildNum == bclass )
return bg_buildableList[ i ].modelScale;
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindModelScaleForBuildable( %d )\n", bclass );
return 1.0f;
}
@@ -754,7 +754,7 @@ void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs )
if( VectorLength( bg_buildableOverrideList[ bclass ].mins ) )
VectorCopy( bg_buildableOverrideList[ bclass ].mins, mins );
}
-
+
if( maxs != NULL )
{
VectorCopy( bg_buildableList[ i ].maxs, maxs );
@@ -762,14 +762,14 @@ void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs )
if( VectorLength( bg_buildableOverrideList[ bclass ].maxs ) )
VectorCopy( bg_buildableOverrideList[ bclass ].maxs, maxs );
}
-
+
return;
}
}
-
+
if( mins != NULL )
VectorCopy( bg_buildableList[ 0 ].mins, mins );
-
+
if( maxs != NULL )
VectorCopy( bg_buildableList[ 0 ].maxs, maxs );
}
@@ -793,7 +793,7 @@ float BG_FindZOffsetForBuildable( int bclass )
return bg_buildableList[ i ].zOffset;
}
}
-
+
return 0.0f;
}
@@ -813,7 +813,7 @@ trType_t BG_FindTrajectoryForBuildable( int bclass )
return bg_buildableList[ i ].traj;
}
}
-
+
return TR_GRAVITY;
}
@@ -833,7 +833,7 @@ float BG_FindBounceForBuildable( int bclass )
return bg_buildableList[ i ].bounce;
}
}
-
+
return 0.0;
}
@@ -853,7 +853,7 @@ int BG_FindBuildPointsForBuildable( int bclass )
return bg_buildableList[ i ].buildPoints;
}
}
-
+
return 1000;
}
@@ -876,7 +876,7 @@ qboolean BG_FindStagesForBuildable( int bclass, stage_t stage )
return qfalse;
}
}
-
+
return qfalse;
}
@@ -896,7 +896,7 @@ int BG_FindHealthForBuildable( int bclass )
return bg_buildableList[ i ].health;
}
}
-
+
return 1000;
}
@@ -916,7 +916,7 @@ int BG_FindRegenRateForBuildable( int bclass )
return bg_buildableList[ i ].regenRate;
}
}
-
+
return 0;
}
@@ -936,7 +936,7 @@ int BG_FindSplashDamageForBuildable( int bclass )
return bg_buildableList[ i ].splashDamage;
}
}
-
+
return 50;
}
@@ -956,7 +956,7 @@ int BG_FindSplashRadiusForBuildable( int bclass )
return bg_buildableList[ i ].splashRadius;
}
}
-
+
return 200;
}
@@ -976,7 +976,7 @@ int BG_FindMODForBuildable( int bclass )
return bg_buildableList[ i ].meansOfDeath;
}
}
-
+
return MOD_UNKNOWN;
}
@@ -996,7 +996,7 @@ int BG_FindTeamForBuildable( int bclass )
return bg_buildableList[ i ].team;
}
}
-
+
return BIT_NONE;
}
@@ -1016,7 +1016,7 @@ weapon_t BG_FindBuildWeaponForBuildable( int bclass )
return bg_buildableList[ i ].buildWeapon;
}
}
-
+
return BA_NONE;
}
@@ -1036,7 +1036,7 @@ int BG_FindAnimForBuildable( int bclass )
return bg_buildableList[ i ].idleAnim;
}
}
-
+
return BANIM_IDLE1;
}
@@ -1056,7 +1056,7 @@ int BG_FindNextThinkForBuildable( int bclass )
return bg_buildableList[ i ].nextthink;
}
}
-
+
return 100;
}
@@ -1076,7 +1076,7 @@ int BG_FindBuildTimeForBuildable( int bclass )
return bg_buildableList[ i ].buildTime;
}
}
-
+
return 10000;
}
@@ -1096,7 +1096,7 @@ qboolean BG_FindUsableForBuildable( int bclass )
return bg_buildableList[ i ].usable;
}
}
-
+
return qfalse;
}
@@ -1116,7 +1116,7 @@ int BG_FindFireSpeedForBuildable( int bclass )
return bg_buildableList[ i ].turretFireSpeed;
}
}
-
+
return 1000;
}
@@ -1136,7 +1136,7 @@ int BG_FindRangeForBuildable( int bclass )
return bg_buildableList[ i ].turretRange;
}
}
-
+
return 1000;
}
@@ -1156,7 +1156,7 @@ weapon_t BG_FindProjTypeForBuildable( int bclass )
return bg_buildableList[ i ].turretProjType;
}
}
-
+
return WP_NONE;
}
@@ -1176,7 +1176,7 @@ float BG_FindMinNormalForBuildable( int bclass )
return bg_buildableList[ i ].minNormal;
}
}
-
+
return 0.707f;
}
@@ -1196,7 +1196,7 @@ qboolean BG_FindInvertNormalForBuildable( int bclass )
return bg_buildableList[ i ].invertNormal;
}
}
-
+
return qfalse;
}
@@ -1216,7 +1216,7 @@ int BG_FindCreepTestForBuildable( int bclass )
return bg_buildableList[ i ].creepTest;
}
}
-
+
return qfalse;
}
@@ -1236,7 +1236,7 @@ int BG_FindCreepSizeForBuildable( int bclass )
return bg_buildableList[ i ].creepSize;
}
}
-
+
return CREEP_BASESIZE;
}
@@ -1256,7 +1256,7 @@ int BG_FindDCCTestForBuildable( int bclass )
return bg_buildableList[ i ].dccTest;
}
}
-
+
return qfalse;
}
@@ -1276,7 +1276,7 @@ int BG_FindUniqueTestForBuildable( int bclass )
return bg_buildableList[ i ].reactorTest;
}
}
-
+
return qfalse;
}
@@ -1306,7 +1306,7 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
char text[ 20000 ];
fileHandle_t f;
float scale;
-
+
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
@@ -1318,7 +1318,7 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
Com_Printf( S_COLOR_RED "ERROR: Buildable file %s too long\n", filename );
return qfalse;
}
-
+
trap_FS_Read( text, len, f );
text[ len ] = 0;
trap_FS_FCloseFile( f );
@@ -1330,7 +1330,7 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
while( 1 )
{
token = COM_Parse( &text_p );
-
+
if( !token )
break;
@@ -1340,24 +1340,24 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
if( !Q_stricmp( token, "model" ) )
{
int index = 0;
-
+
token = COM_Parse( &text_p );
if( !token )
break;
index = atoi( token );
-
+
if( index < 0 )
index = 0;
else if( index > 3 )
index = 3;
-
+
token = COM_Parse( &text_p );
if( !token )
break;
Q_strncpyz( bao->models[ index ], token, sizeof( bao->models[ 0 ] ) );
-
+
continue;
}
else if( !Q_stricmp( token, "modelScale" ) )
@@ -1367,7 +1367,7 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
break;
scale = atof( token );
-
+
if( scale < 0.0f )
scale = 0.0f;
@@ -1382,10 +1382,10 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
token = COM_Parse( &text_p );
if( !token )
break;
-
+
bao->mins[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "maxs" ) )
@@ -1395,16 +1395,16 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
token = COM_Parse( &text_p );
if( !token )
break;
-
+
bao->maxs[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "zOffset" ) )
{
float offset;
-
+
token = COM_Parse( &text_p );
if( !token )
break;
@@ -1439,7 +1439,7 @@ void BG_InitBuildableOverrides( void )
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
bao = BG_FindOverrideForBuildable( i );
-
+
BG_ParseBuildableFile( va( "overrides/buildables/%s.cfg", BG_FindNameForBuildable( i ) ), bao );
}
}
@@ -1448,7 +1448,7 @@ void BG_InitBuildableOverrides( void )
classAttributes_t bg_classList[ ] =
{
- {
+ {
PCL_NONE, //int classnum;
"spectator", //char *className;
"Spectator", //char *humanName;
@@ -1486,7 +1486,7 @@ classAttributes_t bg_classList[ ] =
0, //int cost;
0 //int value;
},
- {
+ {
PCL_ALIEN_BUILDER0, //int classnum;
"builder", //char *className;
"Builder", //char *humanName;
@@ -1524,7 +1524,7 @@ classAttributes_t bg_classList[ ] =
ABUILDER_COST, //int cost;
ABUILDER_VALUE //int value;
},
- {
+ {
PCL_ALIEN_BUILDER0_UPG, //int classnum;
"builderupg", //char *classname;
"Advanced Builder", //char *humanname;
@@ -1917,14 +1917,14 @@ classAttributes_t bg_classList[ ] =
//this isn't a real class, but a dummy to force the client to precache the model
//FIXME: one day do this in a less hacky fashion
PCL_HUMAN_BSUIT, "human_bsuit", "bsuit",
-
+
"keel",
- 1.0f,
+ 1.0f,
"default",
1.0f,
-
- "bsuit", ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), { 0, 0, 0 }, { 0, 0, 0, },
- { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, 0.0f, 0, 0, 0, 0.0f, 0, 0, WP_NONE, 0.0f, 0,
+
+ "bsuit", ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), { 0, 0, 0 }, { 0, 0, 0, },
+ { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, 0.0f, 0, 0, 0, 0.0f, 0, 0, WP_NONE, 0.0f, 0,
0.0f, 1.0f, 0, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 270.0f, 1.0f, { PCL_NONE, PCL_NONE, PCL_NONE }, 0, 0
}
};
@@ -2038,7 +2038,7 @@ float BG_FindModelScaleForClass( int pclass )
return bg_classList[ i ].modelScale;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindModelScaleForClass( %d )\n", pclass );
return 1.0f;
}
@@ -2085,7 +2085,7 @@ float BG_FindShadowScaleForClass( int pclass )
return bg_classList[ i ].shadowScale;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindShadowScaleForClass( %d )\n", pclass );
return 1.0f;
}
@@ -2132,7 +2132,7 @@ qboolean BG_FindStagesForClass( int pclass, stage_t stage )
return qfalse;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStagesForClass\n" );
return qfalse;
}
@@ -2157,7 +2157,7 @@ void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, ve
if( VectorLength( bg_classOverrideList[ pclass ].mins ) )
VectorCopy( bg_classOverrideList[ pclass ].mins, mins );
}
-
+
if( maxs != NULL )
{
VectorCopy( bg_classList[ i ].maxs, maxs );
@@ -2165,7 +2165,7 @@ void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, ve
if( VectorLength( bg_classOverrideList[ pclass ].maxs ) )
VectorCopy( bg_classOverrideList[ pclass ].maxs, maxs );
}
-
+
if( cmaxs != NULL )
{
VectorCopy( bg_classList[ i ].crouchMaxs, cmaxs );
@@ -2173,7 +2173,7 @@ void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, ve
if( VectorLength( bg_classOverrideList[ pclass ].crouchMaxs ) )
VectorCopy( bg_classOverrideList[ pclass ].crouchMaxs, cmaxs );
}
-
+
if( dmins != NULL )
{
VectorCopy( bg_classList[ i ].deadMins, dmins );
@@ -2181,7 +2181,7 @@ void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, ve
if( VectorLength( bg_classOverrideList[ pclass ].deadMins ) )
VectorCopy( bg_classOverrideList[ pclass ].deadMins, dmins );
}
-
+
if( dmaxs != NULL )
{
VectorCopy( bg_classList[ i ].deadMaxs, dmaxs );
@@ -2193,19 +2193,19 @@ void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, ve
return;
}
}
-
+
if( mins != NULL )
VectorCopy( bg_classList[ 0 ].mins, mins );
-
+
if( maxs != NULL )
VectorCopy( bg_classList[ 0 ].maxs, maxs );
-
+
if( cmaxs != NULL )
VectorCopy( bg_classList[ 0 ].crouchMaxs, cmaxs );
-
+
if( dmins != NULL )
VectorCopy( bg_classList[ 0 ].deadMins, dmins );
-
+
if( dmaxs != NULL )
VectorCopy( bg_classList[ 0 ].deadMaxs, dmaxs );
}
@@ -2229,7 +2229,7 @@ float BG_FindZOffsetForClass( int pclass )
return bg_classList[ i ].zOffset;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindZOffsetForClass\n" );
return 0.0f;
}
@@ -2249,17 +2249,17 @@ void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight )
{
if( viewheight != NULL )
*viewheight = bg_classList[ i ].viewheight;
-
+
if( cViewheight != NULL )
*cViewheight = bg_classList[ i ].crouchViewheight;
return;
}
}
-
+
if( viewheight != NULL )
*viewheight = bg_classList[ 0 ].viewheight;
-
+
if( cViewheight != NULL )
*cViewheight = bg_classList[ 0 ].crouchViewheight;
}
@@ -2280,7 +2280,7 @@ int BG_FindHealthForClass( int pclass )
return bg_classList[ i ].health;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindHealthForClass\n" );
return 100;
}
@@ -2301,7 +2301,7 @@ float BG_FindFallDamageForClass( int pclass )
return bg_classList[ i ].fallDamage;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFallDamageForClass\n" );
return 100;
}
@@ -2322,7 +2322,7 @@ int BG_FindRegenRateForClass( int pclass )
return bg_classList[ i ].regenRate;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindRegenRateForClass\n" );
return 0;
}
@@ -2343,7 +2343,7 @@ int BG_FindFovForClass( int pclass )
return bg_classList[ i ].fov;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFovForClass\n" );
return 90;
}
@@ -2364,7 +2364,7 @@ float BG_FindBobForClass( int pclass )
return bg_classList[ i ].bob;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBobForClass\n" );
return 0.002;
}
@@ -2385,7 +2385,7 @@ float BG_FindBobCycleForClass( int pclass )
return bg_classList[ i ].bobCycle;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBobCycleForClass\n" );
return 1.0f;
}
@@ -2406,7 +2406,7 @@ float BG_FindSpeedForClass( int pclass )
return bg_classList[ i ].speed;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindSpeedForClass\n" );
return 1.0f;
}
@@ -2427,7 +2427,7 @@ float BG_FindAccelerationForClass( int pclass )
return bg_classList[ i ].acceleration;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindAccelerationForClass\n" );
return 10.0f;
}
@@ -2448,7 +2448,7 @@ float BG_FindAirAccelerationForClass( int pclass )
return bg_classList[ i ].airAcceleration;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindAirAccelerationForClass\n" );
return 1.0f;
}
@@ -2469,7 +2469,7 @@ float BG_FindFrictionForClass( int pclass )
return bg_classList[ i ].friction;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindFrictionForClass\n" );
return 6.0f;
}
@@ -2490,7 +2490,7 @@ float BG_FindStopSpeedForClass( int pclass )
return bg_classList[ i ].stopSpeed;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStopSpeedForClass\n" );
return 100.0f;
}
@@ -2511,7 +2511,7 @@ float BG_FindJumpMagnitudeForClass( int pclass )
return bg_classList[ i ].jumpMagnitude;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindJumpMagnitudeForClass\n" );
return 270.0f;
}
@@ -2532,7 +2532,7 @@ float BG_FindKnockbackScaleForClass( int pclass )
return bg_classList[ i ].knockbackScale;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindKnockbackScaleForClass\n" );
return 1.0f;
}
@@ -2553,7 +2553,7 @@ int BG_FindSteptimeForClass( int pclass )
return bg_classList[ i ].steptime;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindSteptimeForClass\n" );
return 200;
}
@@ -2594,7 +2594,7 @@ weapon_t BG_FindStartWeaponForClass( int pclass )
return bg_classList[ i ].startWeapon;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindStartWeaponForClass\n" );
return WP_NONE;
}
@@ -2615,7 +2615,7 @@ float BG_FindBuildDistForClass( int pclass )
return bg_classList[ i ].buildDist;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBuildDistForClass\n" );
return 0.0f;
}
@@ -2630,7 +2630,7 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num )
int i, j, cost;
cost = BG_FindCostOfClass( tclass );
-
+
//base case
if( credits < cost )
return -1;
@@ -2649,14 +2649,14 @@ int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num )
for( j = 0; j < 3; j++ )
{
int sub;
-
+
cost = BG_FindCostOfClass( bg_classList[ i ].children[ j ] );
sub = BG_ClassCanEvolveFromTo( bg_classList[ i ].children[ j ],
tclass, credits - cost, num + cost );
if( sub >= 0 )
return sub;
}
-
+
return -1; //may as well return by this point
}
}
@@ -2680,7 +2680,7 @@ int BG_FindValueOfClass( int pclass )
return bg_classList[ i ].value;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindValueOfClass\n" );
return 0;
}
@@ -2701,7 +2701,7 @@ int BG_FindCostOfClass( int pclass )
return bg_classList[ i ].cost;
}
}
-
+
Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindCostOfClass\n" );
return 0;
}
@@ -2732,7 +2732,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
char text[ 20000 ];
fileHandle_t f;
float scale = 0.0f;
-
+
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
@@ -2744,7 +2744,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
Com_Printf( S_COLOR_RED "ERROR: Class file %s too long\n", filename );
return qfalse;
}
-
+
trap_FS_Read( text, len, f );
text[ len ] = 0;
trap_FS_FCloseFile( f );
@@ -2756,7 +2756,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
while( 1 )
{
token = COM_Parse( &text_p );
-
+
if( !token )
break;
@@ -2770,7 +2770,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
Q_strncpyz( cao->modelName, token, sizeof( cao->modelName ) );
-
+
continue;
}
else if( !Q_stricmp( token, "skin" ) )
@@ -2780,7 +2780,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
Q_strncpyz( cao->skinName, token, sizeof( cao->skinName ) );
-
+
continue;
}
else if( !Q_stricmp( token, "hud" ) )
@@ -2790,7 +2790,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
Q_strncpyz( cao->hudName, token, sizeof( cao->hudName ) );
-
+
continue;
}
else if( !Q_stricmp( token, "modelScale" ) )
@@ -2800,7 +2800,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
scale = atof( token );
-
+
if( scale < 0.0f )
scale = 0.0f;
@@ -2815,7 +2815,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
scale = atof( token );
-
+
if( scale < 0.0f )
scale = 0.0f;
@@ -2830,10 +2830,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
token = COM_Parse( &text_p );
if( !token )
break;
-
+
cao->mins[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "maxs" ) )
@@ -2843,10 +2843,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
token = COM_Parse( &text_p );
if( !token )
break;
-
+
cao->maxs[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "deadMins" ) )
@@ -2856,10 +2856,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
token = COM_Parse( &text_p );
if( !token )
break;
-
+
cao->deadMins[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "deadMaxs" ) )
@@ -2869,10 +2869,10 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
token = COM_Parse( &text_p );
if( !token )
break;
-
+
cao->deadMaxs[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "crouchMaxs" ) )
@@ -2882,16 +2882,16 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
token = COM_Parse( &text_p );
if( !token )
break;
-
+
cao->crouchMaxs[ i ] = atof( token );
}
-
+
continue;
}
else if( !Q_stricmp( token, "zOffset" ) )
{
float offset;
-
+
token = COM_Parse( &text_p );
if( !token )
break;
@@ -2909,7 +2909,7 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
break;
Q_strncpyz( cao->humanName, token, sizeof( cao->humanName ) );
-
+
continue;
}
@@ -2936,7 +2936,7 @@ void BG_InitClassOverrides( void )
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
cao = BG_FindOverrideForClass( i );
-
+
BG_ParseClassFile( va( "overrides/classes/%s.cfg", BG_FindNameForClassNum( i ) ), cao );
}
}
@@ -3586,7 +3586,7 @@ int BG_FindPriceForWeapon( int weapon )
return bg_weapons[ i ].price;
}
}
-
+
return 100;
}
@@ -3609,7 +3609,7 @@ qboolean BG_FindStagesForWeapon( int weapon, stage_t stage )
return qfalse;
}
}
-
+
return qfalse;
}
@@ -3629,7 +3629,7 @@ int BG_FindSlotsForWeapon( int weapon )
return bg_weapons[ i ].slots;
}
}
-
+
return SLOT_WEAPON;
}
@@ -3768,7 +3768,7 @@ int BG_FindRepeatRate1ForWeapon( int weapon )
if( bg_weapons[ i ].weaponNum == weapon )
return bg_weapons[ i ].repeatRate1;
}
-
+
return 1000;
}
@@ -3786,7 +3786,7 @@ int BG_FindRepeatRate2ForWeapon( int weapon )
if( bg_weapons[ i ].weaponNum == weapon )
return bg_weapons[ i ].repeatRate2;
}
-
+
return 1000;
}
@@ -3804,7 +3804,7 @@ int BG_FindRepeatRate3ForWeapon( int weapon )
if( bg_weapons[ i ].weaponNum == weapon )
return bg_weapons[ i ].repeatRate3;
}
-
+
return 1000;
}
@@ -3824,7 +3824,7 @@ int BG_FindReloadTimeForWeapon( int weapon )
return bg_weapons[ i ].reloadTime;
}
}
-
+
return 1000;
}
@@ -3944,7 +3944,7 @@ int BG_FindBuildDelayForWeapon( int weapon )
return bg_weapons[ i ].buildDelay;
}
}
-
+
return 0;
}
@@ -4080,7 +4080,7 @@ int BG_FindPriceForUpgrade( int upgrade )
return bg_upgrades[ i ].price;
}
}
-
+
return 100;
}
@@ -4103,7 +4103,7 @@ qboolean BG_FindStagesForUpgrade( int upgrade, stage_t stage )
return qfalse;
}
}
-
+
return qfalse;
}
@@ -4123,7 +4123,7 @@ int BG_FindSlotsForUpgrade( int upgrade )
return bg_upgrades[ i ].slots;
}
}
-
+
return SLOT_NONE;
}
@@ -4260,18 +4260,18 @@ void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result )
case TR_INTERPOLATE:
VectorCopy( tr->trBase, result );
break;
-
+
case TR_LINEAR:
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
break;
-
+
case TR_SINE:
deltaTime = ( atTime - tr->trTime ) / (float)tr->trDuration;
phase = sin( deltaTime * M_PI * 2 );
VectorMA( tr->trBase, phase, tr->trDelta, result );
break;
-
+
case TR_LINEAR_STOP:
if( atTime > tr->trTime + tr->trDuration )
atTime = tr->trTime + tr->trDuration;
@@ -4279,22 +4279,22 @@ void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result )
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
if( deltaTime < 0 )
deltaTime = 0;
-
+
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
break;
-
+
case TR_GRAVITY:
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
result[ 2 ] -= 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
break;
-
+
case TR_BUOYANCY:
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
result[ 2 ] += 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
break;
-
+
default:
Com_Error( ERR_DROP, "BG_EvaluateTrajectory: unknown trType: %i", tr->trTime );
break;
@@ -4319,18 +4319,18 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t resu
case TR_INTERPOLATE:
VectorClear( result );
break;
-
+
case TR_LINEAR:
VectorCopy( tr->trDelta, result );
break;
-
+
case TR_SINE:
deltaTime = ( atTime - tr->trTime ) / (float)tr->trDuration;
phase = cos( deltaTime * M_PI * 2 ); // derivative of sin = cos
phase *= 0.5;
VectorScale( tr->trDelta, phase, result );
break;
-
+
case TR_LINEAR_STOP:
if( atTime > tr->trTime + tr->trDuration )
{
@@ -4339,19 +4339,19 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t resu
}
VectorCopy( tr->trDelta, result );
break;
-
+
case TR_GRAVITY:
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
VectorCopy( tr->trDelta, result );
result[ 2 ] -= DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
break;
-
+
case TR_BUOYANCY:
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
VectorCopy( tr->trDelta, result );
result[ 2 ] += DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
break;
-
+
default:
Com_Error( ERR_DROP, "BG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trTime );
break;
@@ -4384,8 +4384,6 @@ char *eventnames[ ] =
"EV_FALL_FAR",
"EV_FALLING",
- "EV_JUMP_PAD", // boing sound at origin", jump sound on player
-
"EV_JUMP",
"EV_WATER_TOUCH", // foot touches
"EV_WATER_LEAVE", // foot leaves
@@ -4421,7 +4419,7 @@ char *eventnames[ ] =
"EV_LEV1_GRAB",
"EV_LEV4_CHARGE_PREPARE",
"EV_LEV4_CHARGE_START",
-
+
"EV_PAIN",
"EV_DEATH1",
"EV_DEATH2",
@@ -4440,7 +4438,7 @@ char *eventnames[ ] =
"EV_ALIEN_ACIDTUBE",
"EV_MEDKIT_USED",
-
+
"EV_ALIEN_EVOLVE",
"EV_ALIEN_EVOLVE_FAILED",
@@ -4451,9 +4449,9 @@ char *eventnames[ ] =
"EV_OVERMIND_ATTACK", //TA: overmind under attack
"EV_OVERMIND_DYING", //TA: overmind close to death
"EV_OVERMIND_SPAWNS", //TA: overmind needs spawns
-
+
"EV_DCC_ATTACK", //TA: dcc under attack
-
+
"EV_RPTUSE_SOUND" //TA: trigger a sound
};
@@ -4473,7 +4471,7 @@ void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerSta
{
char buf[ 256 ];
trap_Cvar_VariableStringBuffer( "showevents", buf, sizeof( buf ) );
-
+
if( atof( buf ) != 0 )
{
#ifdef QAGAME
@@ -4494,45 +4492,6 @@ void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerSta
/*
========================
-BG_TouchJumpPad
-========================
-*/
-void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad )
-{
- vec3_t angles;
- float p;
- int effectNum;
-
- // spectators don't use jump pads
- if( ps->pm_type != PM_NORMAL )
- return;
-
- // if we didn't hit this same jumppad the previous frame
- // then don't play the event sound again if we are in a fat trigger
- if( ps->jumppad_ent != jumppad->number )
- {
- vectoangles( jumppad->origin2, angles);
-
- p = fabs( AngleNormalize180( angles[ PITCH ] ) );
-
- if( p < 45 )
- effectNum = 0;
- else
- effectNum = 1;
-
- BG_AddPredictableEventToPlayerstate( EV_JUMP_PAD, effectNum, ps );
- }
-
- // remember hitting this jumppad this frame
- ps->jumppad_ent = jumppad->number;
- ps->jumppad_frame = ps->pmove_framecount;
- // give the player the velocity from the jumppad
- VectorCopy( jumppad->origin2, ps->velocity );
-}
-
-
-/*
-========================
BG_PlayerStateToEntityState
This is done after each set of usercmd_t on the server,
@@ -4554,16 +4513,16 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
s->pos.trType = TR_INTERPOLATE;
VectorCopy( ps->origin, s->pos.trBase );
-
+
if( snap )
SnapVector( s->pos.trBase );
-
+
//set the trDelta for flag direction
VectorCopy( ps->velocity, s->pos.trDelta );
s->apos.trType = TR_INTERPOLATE;
VectorCopy( ps->viewangles, s->apos.trBase );
-
+
if( snap )
SnapVector( s->apos.trBase );
@@ -4584,7 +4543,7 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
s->eFlags |= EF_BLOBLOCKED;
else
s->eFlags &= ~EF_BLOBLOCKED;
-
+
if( ps->externalEvent )
{
s->event = ps->externalEvent;
@@ -4680,7 +4639,7 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
// so corpses can also reference the proper config
s->eFlags = ps->eFlags;
-
+
if( ps->stats[STAT_HEALTH] <= 0 )
s->eFlags |= EF_DEAD;
else
@@ -4690,7 +4649,7 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
s->eFlags |= EF_BLOBLOCKED;
else
s->eFlags &= ~EF_BLOBLOCKED;
-
+
if( ps->externalEvent )
{
s->event = ps->externalEvent;
@@ -4715,7 +4674,7 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
//store items held and active items in otherEntityNum
s->modelindex = 0;
s->modelindex2 = 0;
-
+
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
if( BG_InventoryContainsUpgrade( i, ps->stats ) )
@@ -4750,7 +4709,7 @@ void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, i
{
int ammoarray[ 32 ];
int i;
-
+
for( i = 0; i <= 15; i++ )
ammoarray[ i ] = psAmmo[ i ];
@@ -4800,7 +4759,7 @@ qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAm
if( BG_InventoryContainsUpgrade( UP_BATTPACK, stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
-
+
return ( maxAmmo == ammo ) && ( maxClips == clips );
}
@@ -4818,7 +4777,7 @@ void BG_AddWeaponToInventory( int weapon, int stats[ ] )
weaponList = ( stats[ STAT_WEAPONS ] & 0x0000FFFF ) | ( ( stats[ STAT_WEAPONS2 ] << 16 ) & 0xFFFF0000 );
weaponList |= ( 1 << weapon );
-
+
stats[ STAT_WEAPONS ] = weaponList & 0x0000FFFF;
stats[ STAT_WEAPONS2 ] = ( weaponList & 0xFFFF0000 ) >> 16;
@@ -4842,10 +4801,10 @@ void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] )
weaponList = ( stats[ STAT_WEAPONS ] & 0x0000FFFF ) | ( ( stats[ STAT_WEAPONS2 ] << 16 ) & 0xFFFF0000 );
weaponList &= ~( 1 << weapon );
-
+
stats[ STAT_WEAPONS ] = weaponList & 0x0000FFFF;
stats[ STAT_WEAPONS2 ] = ( weaponList & 0xFFFF0000 ) >> 16;
-
+
stats[ STAT_SLOTS ] &= ~BG_FindSlotsForWeapon( weapon );
}
@@ -4878,7 +4837,7 @@ void BG_AddUpgradeToInventory( int item, int stats[ ] )
if( stats[ STAT_SLOTS ] & BG_FindSlotsForUpgrade( item ) )
Com_Printf( S_COLOR_YELLOW "WARNING: Held items conflict with upgrade %d\n", item );
-
+
stats[ STAT_SLOTS ] |= BG_FindSlotsForUpgrade( item );
}
@@ -4958,7 +4917,7 @@ qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ],
vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f };
vec3_t localNormal, xNormal;
float rotAngle;
-
+
//the grapplePoint being a surfNormal rotation Normal hack... see above :)
if( ceiling )
{
@@ -5004,13 +4963,13 @@ Find a place to build a buildable
void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps,
const vec3_t mins, const vec3_t maxs,
void (*trace)( trace_t *, const vec3_t, const vec3_t,
- const vec3_t, const vec3_t, int, int ),
+ const vec3_t, const vec3_t, int, int ),
vec3_t outOrigin, vec3_t outAngles, trace_t *tr )
{
vec3_t forward, entityOrigin, targetOrigin;
vec3_t angles, playerOrigin, playerNormal;
float buildDist;
-
+
if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
{
if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
@@ -5020,7 +4979,7 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps,
}
else
VectorSet( playerNormal, 0.0f, 0.0f, 1.0f );
-
+
VectorCopy( ps->viewangles, angles );
VectorCopy( ps->origin, playerOrigin );
buildDist = BG_FindBuildDistForClass( ps->stats[ STAT_PCLASS ] );
@@ -5030,7 +4989,7 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps,
VectorNormalize( forward );
VectorMA( playerOrigin, buildDist, forward, entityOrigin );
-
+
VectorCopy( entityOrigin, targetOrigin );
//so buildings can be placed facing slopes
@@ -5062,7 +5021,7 @@ int BG_GetValueOfHuman( playerState_t *ps )
if( BG_InventoryContainsUpgrade( i, ps->stats ) )
worth += BG_FindPriceForUpgrade( i );
}
-
+
for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
{
if( BG_InventoryContainsWeapon( i, ps->stats ) )
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index ed9f6c7b..88432f81 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -15,7 +15,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
@@ -63,7 +63,7 @@ void PM_AddTouchEnt( int entityNum )
if( entityNum == ENTITYNUM_WORLD )
return;
-
+
if( pm->numtouch == MAXTOUCH )
return;
@@ -88,7 +88,7 @@ static void PM_StartTorsoAnim( int anim )
{
if( pm->ps->pm_type >= PM_DEAD )
return;
-
+
pm->ps->torsoAnim = ( ( pm->ps->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT )
| anim;
}
@@ -102,7 +102,7 @@ static void PM_StartLegsAnim( int anim )
{
if( pm->ps->pm_type >= PM_DEAD )
return;
-
+
//legsTimer is clamped too tightly for nonsegmented models
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
{
@@ -172,7 +172,7 @@ static void PM_ForceLegsAnim( int anim )
pm->ps->legsTimer = 0;
else
pm->ps->torsoTimer = 0;
-
+
PM_StartLegsAnim( anim );
}
@@ -232,7 +232,7 @@ static void PM_Friction( void )
vec[ 2 ] = 0; // ignore slope movement
speed = VectorLength( vec );
-
+
if( speed < 1 )
{
vel[ 0 ] = 0;
@@ -252,7 +252,7 @@ static void PM_Friction( void )
if( !( pm->ps->pm_flags & PMF_TIME_KNOCKBACK ) )
{
float stopSpeed = BG_FindStopSpeedForClass( pm->ps->stats[ STAT_PCLASS ] );
-
+
control = speed < stopSpeed ? stopSpeed : speed;
drop += control * BG_FindFrictionForClass( pm->ps->stats[ STAT_PCLASS ] ) * pml.frametime;
}
@@ -384,16 +384,16 @@ static float PM_CmdScale( usercmd_t *cmd )
if( pm->ps->weapon == WP_ALEVEL4 && pm->ps->pm_flags & PMF_CHARGE )
modifier *= ( 1.0f + ( pm->ps->stats[ STAT_MISC ] / (float)LEVEL4_CHARGE_TIME ) *
( LEVEL4_CHARGE_SPEED - 1.0f ) );
-
+
//slow player if charging up for a pounce
if( ( pm->ps->weapon == WP_ALEVEL3 || pm->ps->weapon == WP_ALEVEL3_UPG ) &&
cmd->buttons & BUTTON_ATTACK2 )
modifier *= LEVEL3_POUNCE_SPEED_MOD;
-
+
//slow the player if slow locked
if( pm->ps->stats[ STAT_STATE ] & SS_SLOWLOCKED )
modifier *= ABUILDER_BLOB_SPEED_MOD;
-
+
if( pm->ps->pm_type == PM_GRABBED )
modifier = 0.0f;
@@ -413,7 +413,7 @@ static float PM_CmdScale( usercmd_t *cmd )
if( abs( cmd->upmove ) > max )
max = abs( cmd->upmove );
-
+
if( !max )
return 0;
@@ -440,19 +440,19 @@ static void PM_SetMovementDir( void )
{
if( pm->cmd.rightmove == 0 && pm->cmd.forwardmove > 0 )
pm->ps->movementDir = 0;
- else if( pm->cmd.rightmove < 0 && pm->cmd.forwardmove > 0 )
+ else if( pm->cmd.rightmove < 0 && pm->cmd.forwardmove > 0 )
pm->ps->movementDir = 1;
else if( pm->cmd.rightmove < 0 && pm->cmd.forwardmove == 0 )
pm->ps->movementDir = 2;
- else if( pm->cmd.rightmove < 0 && pm->cmd.forwardmove < 0 )
+ else if( pm->cmd.rightmove < 0 && pm->cmd.forwardmove < 0 )
pm->ps->movementDir = 3;
else if( pm->cmd.rightmove == 0 && pm->cmd.forwardmove < 0 )
pm->ps->movementDir = 4;
- else if( pm->cmd.rightmove > 0 && pm->cmd.forwardmove < 0 )
+ else if( pm->cmd.rightmove > 0 && pm->cmd.forwardmove < 0 )
pm->ps->movementDir = 5;
else if( pm->cmd.rightmove > 0 && pm->cmd.forwardmove == 0 )
pm->ps->movementDir = 6;
- else if( pm->cmd.rightmove > 0 && pm->cmd.forwardmove > 0 )
+ else if( pm->cmd.rightmove > 0 && pm->cmd.forwardmove > 0 )
pm->ps->movementDir = 7;
}
else
@@ -484,7 +484,7 @@ static void PM_CheckCharge( void )
pm->ps->pm_flags &= ~PMF_CHARGE;
return;
}
-
+
if( pm->ps->stats[ STAT_MISC ] > 0 )
pm->ps->pm_flags |= PMF_CHARGE;
else
@@ -516,22 +516,22 @@ static qboolean PM_CheckPounce( void )
pml.groundPlane = qfalse; // jumping away
pml.walking = qfalse;
-
+
pm->ps->pm_flags |= PMF_CHARGE;
-
+
pm->ps->groundEntityNum = ENTITYNUM_NONE;
-
+
VectorMA( pm->ps->velocity, pm->ps->stats[ STAT_MISC ], pml.forward, pm->ps->velocity );
-
+
PM_AddEvent( EV_JUMP );
-
+
if( pm->cmd.forwardmove >= 0 )
{
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
PM_ForceLegsAnim( LEGS_JUMP );
else
PM_ForceLegsAnim( NSPA_JUMP );
-
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
@@ -540,7 +540,7 @@ static qboolean PM_CheckPounce( void )
PM_ForceLegsAnim( LEGS_JUMPB );
else
PM_ForceLegsAnim( NSPA_JUMPBACK );
-
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -559,7 +559,7 @@ static qboolean PM_CheckWallJump( void )
float normalFraction = 1.5f;
float cmdFraction = 1.0f;
float upFraction = 1.5f;
-
+
if( pm->ps->pm_flags & PMF_RESPAWNED )
return qfalse; // don't allow jump until all buttons are up
@@ -587,35 +587,35 @@ static qboolean PM_CheckWallJump( void )
pm->ps->pm_flags |= PMF_JUMP_HELD;
pm->ps->groundEntityNum = ENTITYNUM_NONE;
-
+
ProjectPointOnPlane( forward, pml.forward, pm->ps->grapplePoint );
ProjectPointOnPlane( right, pml.right, pm->ps->grapplePoint );
-
+
VectorScale( pm->ps->grapplePoint, normalFraction, dir );
if( pm->cmd.forwardmove > 0 )
VectorMA( dir, cmdFraction, forward, dir );
else if( pm->cmd.forwardmove < 0 )
VectorMA( dir, -cmdFraction, forward, dir );
-
+
if( pm->cmd.rightmove > 0 )
VectorMA( dir, cmdFraction, right, dir );
else if( pm->cmd.rightmove < 0 )
VectorMA( dir, -cmdFraction, right, dir );
-
+
VectorMA( dir, upFraction, refNormal, dir );
VectorNormalize( dir );
-
+
VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ),
dir, pm->ps->velocity );
-
+
//for a long run of wall jumps the velocity can get pretty large, this caps it
if( VectorLength( pm->ps->velocity ) > LEVEL2_WALLJUMP_MAXSPEED )
{
VectorNormalize( pm->ps->velocity );
VectorScale( pm->ps->velocity, LEVEL2_WALLJUMP_MAXSPEED, pm->ps->velocity );
}
-
+
PM_AddEvent( EV_JUMP );
if( pm->cmd.forwardmove >= 0 )
@@ -624,7 +624,7 @@ static qboolean PM_CheckWallJump( void )
PM_ForceLegsAnim( LEGS_JUMP );
else
PM_ForceLegsAnim( NSPA_JUMP );
-
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
@@ -633,7 +633,7 @@ static qboolean PM_CheckWallJump( void )
PM_ForceLegsAnim( LEGS_JUMPB );
else
PM_ForceLegsAnim( NSPA_JUMPBACK );
-
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -699,21 +699,21 @@ static qboolean PM_CheckJump( void )
pm->ps->stats[ STAT_STAMINA ] -= 500;
pm->ps->groundEntityNum = ENTITYNUM_NONE;
-
+
//TA: jump away from wall
if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
{
vec3_t normal = { 0, 0, -1 };
-
+
if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
VectorCopy( pm->ps->grapplePoint, normal );
-
+
VectorMA( pm->ps->velocity, BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] ),
normal, pm->ps->velocity );
}
else
pm->ps->velocity[ 2 ] = BG_FindJumpMagnitudeForClass( pm->ps->stats[ STAT_PCLASS ] );
-
+
PM_AddEvent( EV_JUMP );
if( pm->cmd.forwardmove >= 0 )
@@ -722,7 +722,7 @@ static qboolean PM_CheckJump( void )
PM_ForceLegsAnim( LEGS_JUMP );
else
PM_ForceLegsAnim( NSPA_JUMP );
-
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
@@ -731,7 +731,7 @@ static qboolean PM_CheckJump( void )
PM_ForceLegsAnim( LEGS_JUMPB );
else
PM_ForceLegsAnim( NSPA_JUMPBACK );
-
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -764,13 +764,13 @@ static qboolean PM_CheckWaterJump( void )
VectorMA( pm->ps->origin, 30, flatforward, spot );
spot[ 2 ] += 4;
cont = pm->pointcontents( spot, pm->ps->clientNum );
-
+
if( !( cont & CONTENTS_SOLID ) )
return qfalse;
spot[ 2 ] += 16;
cont = pm->pointcontents( spot, pm->ps->clientNum );
-
+
if( cont )
return qfalse;
@@ -905,7 +905,7 @@ static void PM_JetPackMove( void )
PM_Friction( );
scale = PM_CmdScale( &pm->cmd );
-
+
// user intentions
for( i = 0; i < 2; i++ )
wishvel[ i ] = scale * pml.forward[ i ] * pm->cmd.forwardmove + scale * pml.right[ i ] * pm->cmd.rightmove;
@@ -1065,7 +1065,7 @@ static void PM_ClimbMove( void )
PM_WaterMove( );
else
PM_AirMove( );
-
+
return;
}
@@ -1132,7 +1132,7 @@ static void PM_ClimbMove( void )
// slide along the ground plane
PM_ClipVelocity( pm->ps->velocity, pml.groundTrace.plane.normal,
pm->ps->velocity, OVERCLIP );
-
+
// don't decrease velocity when going up or down a slope
VectorNormalize( pm->ps->velocity );
VectorScale( pm->ps->velocity, vel, pm->ps->velocity );
@@ -1295,7 +1295,7 @@ static void PM_LadderMove( void )
PM_Friction( );
scale = PM_CmdScale( &pm->cmd );
-
+
for( i = 0; i < 3; i++ )
wishvel[ i ] = scale * pml.forward[ i ] * pm->cmd.forwardmove + scale * pml.right[ i ] * pm->cmd.rightmove;
@@ -1337,28 +1337,28 @@ static void PM_CheckLadder( void )
{
vec3_t forward, end;
trace_t trace;
-
+
//test if class can use ladders
if( !BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_CANUSELADDERS ) )
{
pml.ladder = qfalse;
return;
}
-
+
VectorCopy( pml.forward, forward );
forward[ 2 ] = 0.0f;
-
+
VectorMA( pm->ps->origin, 1.0f, forward, end );
-
+
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, end, pm->ps->clientNum, MASK_PLAYERSOLID );
-
+
if( ( trace.fraction < 1.0f ) && ( trace.surfaceFlags & SURF_LADDER ) )
pml.ladder = qtrue;
else
pml.ladder = qfalse;
}
-
-
+
+
/*
==============
PM_DeadMove
@@ -1375,7 +1375,7 @@ static void PM_DeadMove( void )
forward = VectorLength( pm->ps->velocity );
forward -= 20;
-
+
if( forward <= 0 )
VectorClear( pm->ps->velocity );
else
@@ -1406,7 +1406,7 @@ static void PM_NoclipMove( void )
// friction
speed = VectorLength( pm->ps->velocity );
-
+
if( speed < 1 )
{
VectorCopy( vec3_origin, pm->ps->velocity );
@@ -1421,10 +1421,10 @@ static void PM_NoclipMove( void )
// scale the velocity
newspeed = speed - drop;
-
+
if( newspeed < 0 )
newspeed = 0;
-
+
newspeed /= speed;
VectorScale( pm->ps->velocity, newspeed, pm->ps->velocity );
@@ -1438,7 +1438,7 @@ static void PM_NoclipMove( void )
for( i = 0; i < 3; i++ )
wishvel[ i ] = pml.forward[ i ] * fmove + pml.right[ i ] * smove;
-
+
wishvel[ 2 ] += pm->cmd.upmove;
VectorCopy( wishvel, wishdir );
@@ -1465,13 +1465,13 @@ static int PM_FootstepForSurface( void )
//TA:
if( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED )
return EV_FOOTSTEP_SQUELCH;
-
- if( pml.groundTrace.surfaceFlags & SURF_NOSTEPS )
+
+ if( pml.groundTrace.surfaceFlags & SURF_NOSTEPS )
return 0;
-
+
if( pml.groundTrace.surfaceFlags & SURF_METALSTEPS )
return EV_FOOTSTEP_METAL;
-
+
return EV_FOOTSTEP;
}
@@ -1605,7 +1605,7 @@ static int PM_CorrectAllSolid( trace_t *trace )
point[ 1 ] += (float)j;
point[ 2 ] += (float)k;
pm->trace( trace, point, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
-
+
if( !trace->allsolid )
{
point[ 0 ] = pm->ps->origin[ 0 ];
@@ -1660,7 +1660,7 @@ static void PM_GroundTraceMissed( void )
PM_ForceLegsAnim( LEGS_JUMP );
else
PM_ForceLegsAnim( NSPA_JUMP );
-
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
@@ -1731,11 +1731,11 @@ static void PM_GroundClimbTrace( void )
if( pm->cmd.rightmove )
{
VectorCopy( pml.right, movedir );
-
+
if( pm->cmd.rightmove < 0 )
VectorNegate( movedir, movedir );
}
-
+
for( i = 0; i <= 4; i++ )
{
switch ( i )
@@ -1795,7 +1795,7 @@ static void PM_GroundClimbTrace( void )
{
if( i == 2 )
PM_StepEvent( pm->ps->origin, trace.endpos, surfNormal );
-
+
VectorCopy( trace.endpos, pm->ps->origin );
}
@@ -1840,10 +1840,10 @@ static void PM_GroundClimbTrace( void )
{
//behold the evil mindfuck from hell
//it has fucked mind like nothing has fucked mind before
-
+
//calculate reference rotated through to trace plane
RotatePointAroundVector( refTOtrace, traceCROSSref, horizontal, -traceANGref );
-
+
//calculate reference rotated through to surf plane then to trace plane
RotatePointAroundVector( tempVec, surfCROSSref, horizontal, -surfANGref );
RotatePointAroundVector( refTOsurfTOtrace, traceCROSSsurf, tempVec, -traceANGsurf );
@@ -1871,18 +1871,18 @@ static void PM_GroundClimbTrace( void )
//construct a point representing where the player is looking
VectorAdd( pm->ps->origin, lookdir, point );
-
+
//check whether point is on one side of the plane, if so invert the correction angle
if( ( abc[ 0 ] * point[ 0 ] + abc[ 1 ] * point[ 1 ] + abc[ 2 ] * point[ 2 ] - d ) > 0 )
traceANGsurf = -traceANGsurf;
-
+
//find the . product of the lookdir and traceCROSSsurf
if( ( ldDOTtCs = DotProduct( lookdir, traceCROSSsurf ) ) < 0.0f )
{
VectorInverse( traceCROSSsurf );
ldDOTtCs = DotProduct( lookdir, traceCROSSsurf );
}
-
+
//set the correction angle
traceANGsurf *= 1.0f - ldDOTtCs;
@@ -1950,7 +1950,7 @@ static void PM_GroundClimbTrace( void )
vec3_t forward, rotated, angles;
AngleVectors( pm->ps->viewangles, forward, NULL, NULL );
-
+
RotatePointAroundVector( rotated, pm->ps->grapplePoint, forward, 180.0f );
vectoangles( rotated, angles );
@@ -2035,14 +2035,14 @@ static void PM_GroundTrace( void )
vec3_t forward, rotated, angles;
AngleVectors( pm->ps->viewangles, forward, NULL, NULL );
-
+
RotatePointAroundVector( rotated, pm->ps->grapplePoint, forward, 180.0f );
vectoangles( rotated, angles );
pm->ps->delta_angles[ YAW ] -= ANGLE2SHORT( angles[ YAW ] - pm->ps->viewangles[ YAW ] );
}
}
-
+
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING;
pm->ps->eFlags &= ~EF_WALLCLIMB;
@@ -2052,14 +2052,14 @@ static void PM_GroundTrace( void )
point[ 2 ] = pm->ps->origin[ 2 ] - 0.25f;
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
-
+
pml.groundTrace = trace;
// do something corrective if the trace starts in a solid...
if( trace.allsolid )
if( !PM_CorrectAllSolid( &trace ) )
return;
-
+
//make sure that the surfNormal is reset to the ground
VectorCopy( refNormal, pm->ps->grapplePoint );
@@ -2067,7 +2067,7 @@ static void PM_GroundTrace( void )
if( trace.fraction == 1.0f )
{
qboolean steppedDown = qfalse;
-
+
// try to step down
if( pml.groundPlane != qfalse && PM_PredictStepMove( ) )
{
@@ -2085,7 +2085,7 @@ static void PM_GroundTrace( void )
steppedDown = qtrue;
}
}
-
+
if( !steppedDown )
{
PM_GroundTraceMissed( );
@@ -2104,15 +2104,15 @@ static void PM_GroundTrace( void )
if( pm->cmd.rightmove )
{
VectorCopy( pml.right, movedir );
-
+
if( pm->cmd.rightmove < 0 )
VectorNegate( movedir, movedir );
}
-
+
//trace into direction we are moving
VectorMA( pm->ps->origin, 0.25f, movedir, point );
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
-
+
if( trace.fraction < 1.0f && !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) &&
( trace.entityNum == ENTITYNUM_WORLD ) )
{
@@ -2123,7 +2123,7 @@ static void PM_GroundTrace( void )
}
}
}
-
+
return;
}
}
@@ -2150,7 +2150,7 @@ static void PM_GroundTrace( void )
PM_ForceLegsAnim( LEGS_JUMPB );
else
PM_ForceLegsAnim( NSPA_JUMPBACK );
-
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -2243,13 +2243,13 @@ static void PM_SetWaterLevel( void )
pm->waterlevel = 1;
point[ 2 ] = pm->ps->origin[ 2 ] + MINS_Z + sample1;
cont = pm->pointcontents( point, pm->ps->clientNum );
-
+
if( cont & MASK_WATER )
{
pm->waterlevel = 2;
point[ 2 ] = pm->ps->origin[ 2 ] + MINS_Z + sample2;
cont = pm->pointcontents( point, pm->ps->clientNum );
-
+
if( cont & MASK_WATER )
pm->waterlevel = 3;
}
@@ -2401,7 +2401,7 @@ static void PM_Footsteps( void )
if( pm->ps->pm_flags & PMF_DUCKED )
{
bobmove = 0.5; // ducked characters bob much faster
-
+
if( pm->ps->pm_flags & PMF_BACKWARDS_RUN )
{
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
@@ -2430,7 +2430,7 @@ static void PM_Footsteps( void )
PM_ContinueLegsAnim( NSPA_WALK );
}
}
-
+
// ducked characters never play footsteps
}
else
@@ -2507,7 +2507,7 @@ static void PM_Footsteps( void )
}
bobmove *= BG_FindBobCycleForClass( pm->ps->stats[ STAT_PCLASS ] );
-
+
if( pm->ps->stats[ STAT_STATE ] & SS_SPEEDBOOST )
bobmove *= HUMAN_SPRINT_MODIFIER;
@@ -2600,7 +2600,7 @@ static void PM_BeginWeaponChange( int weapon )
//reset build weapon
pm->ps->stats[ STAT_BUILDABLE ] = BA_NONE;
-
+
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
PM_StartTorsoAnim( TORSO_DROP );
}
@@ -2625,7 +2625,7 @@ static void PM_FinishWeaponChange( void )
pm->ps->weapon = weapon;
pm->ps->weaponstate = WEAPON_RAISING;
pm->ps->weaponTime += 250;
-
+
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
PM_StartTorsoAnim( TORSO_RAISE );
}
@@ -2666,7 +2666,7 @@ static void PM_Weapon( void )
qboolean attack1 = qfalse;
qboolean attack2 = qfalse;
qboolean attack3 = qfalse;
-
+
// don't allow attack until all buttons are up
if( pm->ps->pm_flags & PMF_RESPAWNED )
return;
@@ -2674,7 +2674,7 @@ static void PM_Weapon( void )
// ignore if spectator
if( pm->ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
return;
-
+
if( pm->ps->stats[ STAT_STATE ] & SS_INFESTING )
return;
@@ -2719,12 +2719,12 @@ static void PM_Weapon( void )
BG_ActivateUpgrade( pm->cmd.weapon - 32, pm->ps->stats );
}
}
- pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
+ pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
}
}
else
pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD;
-
+
//something external thinks a weapon change is necessary
if( pm->ps->pm_flags & PMF_WEAPON_SWITCH )
{
@@ -2732,7 +2732,7 @@ static void PM_Weapon( void )
PM_BeginWeaponChange( pm->ps->persistant[ PERS_NEWWEAPON ] );
}
}
-
+
if( pm->ps->weaponTime > 0 )
return;
@@ -2754,7 +2754,7 @@ static void PM_Weapon( void )
else
PM_ContinueTorsoAnim( TORSO_STAND );
}
-
+
return;
}
@@ -2783,7 +2783,7 @@ static void PM_Weapon( void )
if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) &&
BG_InventoryContainsUpgrade( UP_BATTPACK, pm->ps->stats ) )
ammo = (int)( (float)ammo * BATTPACK_MODIFIER );
-
+
BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips );
//allow some time for the weapon to be raised
@@ -2792,8 +2792,8 @@ static void PM_Weapon( void )
pm->ps->weaponTime += 250;
return;
}
-
- // check for end of clip
+
+ // check for end of clip
if( ( !ammo || pm->ps->pm_flags & PMF_WEAPON_RELOAD ) && clips )
{
pm->ps->pm_flags &= ~PMF_WEAPON_RELOAD;
@@ -2802,13 +2802,13 @@ static void PM_Weapon( void )
//drop the weapon
PM_StartTorsoAnim( TORSO_DROP );
-
+
addTime = BG_FindReloadTimeForWeapon( pm->ps->weapon );
pm->ps->weaponTime += addTime;
return;
}
-
+
//check if non-auto primary/secondary attacks are permited
switch( pm->ps->weapon )
{
@@ -2823,14 +2823,14 @@ static void PM_Weapon( void )
return;
}
break;
-
+
case WP_ALEVEL3:
case WP_ALEVEL3_UPG:
//pouncing has primary secondary AND autohit procedures
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
-
+
if( !pm->autoWeaponHit[ pm->ps->weapon ] && !attack1 && !attack2 && !attack3 )
{
pm->ps->weaponTime = 0;
@@ -2843,7 +2843,7 @@ static void PM_Weapon( void )
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
-
+
if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 && !attack3 )
{
if( pm->ps->stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE )
@@ -2860,13 +2860,13 @@ static void PM_Weapon( void )
if( pm->ps->stats[ STAT_MISC ] > 0 )
attack1 = !attack1;
break;
-
+
default:
//by default primary and secondary attacks are allowed
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
attack3 = pm->cmd.buttons & BUTTON_USE_HOLDABLE;
-
+
if( !attack1 && !attack2 && !attack3 )
{
pm->ps->weaponTime = 0;
@@ -2932,7 +2932,7 @@ static void PM_Weapon( void )
PM_AddEvent( EV_FIRE_WEAPON );
addTime = BG_FindRepeatRate1ForWeapon( pm->ps->weapon );
break;
-
+
case WP_ALEVEL3:
case WP_ALEVEL3_UPG:
pm->ps->generic1 = WPM_SECONDARY;
@@ -2944,12 +2944,12 @@ static void PM_Weapon( void )
break;
}
}
-
+
if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
{
//FIXME: this should be an option in the client weapon.cfg
switch( pm->ps->weapon )
- {
+ {
case WP_FLAMER:
if( pm->ps->weaponstate == WEAPON_READY )
{
@@ -2960,7 +2960,7 @@ static void PM_Weapon( void )
case WP_BLASTER:
PM_StartTorsoAnim( TORSO_ATTACK2 );
break;
-
+
default:
PM_StartTorsoAnim( TORSO_ATTACK );
break;
@@ -2990,12 +2990,12 @@ static void PM_Weapon( void )
else if( attack3 )
PM_ForceLegsAnim( NSPA_ATTACK3 );
}
-
+
pm->ps->torsoTimer = TIMER_ATTACK;
}
pm->ps->weaponstate = WEAPON_FIRING;
-
+
// take an ammo away if not infinite
if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) )
{
@@ -3010,7 +3010,7 @@ static void PM_Weapon( void )
}
else
ammo--;
-
+
BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips );
}
else if( pm->ps->weapon == WP_ALEVEL3_UPG && attack3 )
@@ -3019,7 +3019,7 @@ static void PM_Weapon( void )
ammo--;
BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips );
}
-
+
//FIXME: predicted angles miss a problem??
if( pm->ps->weapon == WP_CHAINGUN )
{
@@ -3035,7 +3035,7 @@ static void PM_Weapon( void )
pm->ps->delta_angles[ YAW ] -= ANGLE2SHORT( ( ( random() * 8 ) - 4 ) * ( 30.0 / (float)addTime ) );
}
}
-
+
pm->ps->weaponTime += addTime;
}
@@ -3064,7 +3064,7 @@ static void PM_Animate( void )
{
PM_ForceLegsAnim( NSPA_GESTURE );
pm->ps->torsoTimer = TIMER_GESTURE;
-
+
PM_AddEvent( EV_TAUNT );
}
}
@@ -3095,7 +3095,7 @@ static void PM_DropTimers( void )
if( pm->ps->legsTimer > 0 )
{
pm->ps->legsTimer -= pml.msec;
-
+
if( pm->ps->legsTimer < 0 )
pm->ps->legsTimer = 0;
}
@@ -3103,7 +3103,7 @@ static void PM_DropTimers( void )
if( pm->ps->torsoTimer > 0 )
{
pm->ps->torsoTimer -= pml.msec;
-
+
if( pm->ps->torsoTimer < 0 )
pm->ps->torsoTimer = 0;
}
@@ -3158,7 +3158,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ||
!BG_RotateAxis( ps->grapplePoint, axis, rotaxis, qfalse,
- ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
+ ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
AxisCopy( axis, rotaxis );
//convert the new axis back to angles
@@ -3169,7 +3169,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
{
while( tempang[ i ] > 180 )
tempang[ i ] -= 360;
-
+
while( tempang[ i ] < 180 )
tempang[ i ] += 360;
}
@@ -3182,10 +3182,10 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
if( ps->pm_type == PM_GRABBED && !BG_InventoryContainsUpgrade( UP_BATTLESUIT, ps->stats ) )
{
vec3_t dir, angles;
-
+
ByteToDir( ps->stats[ STAT_VIEWLOCK ], dir );
vectoangles( dir, angles );
-
+
for( i = 0; i < 3; i++ )
{
float diff = AngleSubtract( ps->viewangles[ i ], angles[ i ] );
@@ -3199,7 +3199,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd )
ps->delta_angles[ i ] += ANGLE2SHORT( fabs( diff ) - 90.0f );
else if( diff > 90.0f )
ps->delta_angles[ i ] -= ANGLE2SHORT( fabs( diff ) - 90.0f );
-
+
if( diff < 0.0f )
ps->delta_angles[ i ] += ANGLE2SHORT( fabs( diff ) * 0.05f );
else if( diff > 0.0f )
@@ -3220,7 +3220,7 @@ void trap_SnapVector( float *v );
void PmoveSingle( pmove_t *pmove )
{
int ammo, clips;
-
+
pm = pmove;
BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips );
@@ -3255,7 +3255,7 @@ void PmoveSingle( pmove_t *pmove )
pm->ps->eFlags |= EF_FIRING;
else
pm->ps->eFlags &= ~EF_FIRING;
-
+
// set the firing flag for continuous beam weapons
if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION &&
( pm->cmd.buttons & BUTTON_ATTACK2 ) &&
@@ -3263,7 +3263,7 @@ void PmoveSingle( pmove_t *pmove )
pm->ps->eFlags |= EF_FIRING2;
else
pm->ps->eFlags &= ~EF_FIRING2;
-
+
// set the firing flag for continuous beam weapons
if( !(pm->ps->pm_flags & PMF_RESPAWNED) && pm->ps->pm_type != PM_INTERMISSION &&
( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) &&
@@ -3271,7 +3271,7 @@ void PmoveSingle( pmove_t *pmove )
pm->ps->eFlags |= EF_FIRING3;
else
pm->ps->eFlags &= ~EF_FIRING3;
-
+
// clear the respawned flag if attack and use are cleared
if( pm->ps->stats[STAT_HEALTH] > 0 &&
@@ -3294,7 +3294,7 @@ void PmoveSingle( pmove_t *pmove )
// determine the time
pml.msec = pmove->cmd.serverTime - pm->ps->commandTime;
-
+
if( pml.msec < 1 )
pml.msec = 1;
else if( pml.msec > 200 )
@@ -3363,10 +3363,10 @@ void PmoveSingle( pmove_t *pmove )
PM_CheckDuck( );
PM_CheckLadder( );
-
+
// set groundentity
PM_GroundTrace( );
-
+
// update the viewangles
PM_UpdateViewAngles( pm->ps, &pm->cmd );
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index b67eaac2..ea3b7eef 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -158,7 +158,7 @@ typedef struct
qboolean autoWeaponHit[ 32 ]; //FIXME: TA: remind myself later this might be a problem
int framecount;
-
+
// results (out)
int numtouch;
int touchents[ MAXTOUCH ];
@@ -169,18 +169,18 @@ typedef struct
int waterlevel;
float xyspeed;
-
+
// for fixed msec Pmove
int pmove_fixed;
int pmove_msec;
-
+
// callbacks to test the world
// these will be different functions during game and cgame
/*void (*trace)( trace_t *results, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );*/
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs,
const vec3_t end, int passEntityNum, int contentMask );
-
-
+
+
int (*pointcontents)( const vec3_t point, int passEntityNum );
} pmove_t;
@@ -319,7 +319,7 @@ typedef enum
typedef enum
{
WPM_NONE,
-
+
WPM_PRIMARY,
WPM_SECONDARY,
WPM_TERTIARY,
@@ -339,7 +339,7 @@ typedef enum
WP_ALEVEL3,
WP_ALEVEL3_UPG,
WP_ALEVEL4,
-
+
WP_BLASTER,
WP_MACHINEGUN,
WP_PAIN_SAW,
@@ -356,7 +356,7 @@ typedef enum
WP_HIVE,
WP_TESLAGEN,
WP_MGTURRET,
-
+
//build weapons must remain in a block
WP_ABUILD,
WP_ABUILD2,
@@ -378,7 +378,7 @@ typedef enum
UP_JETPACK,
UP_BATTLESUIT,
UP_GRENADE,
-
+
UP_AMMO,
UP_NUM_UPGRADES
@@ -387,7 +387,7 @@ typedef enum
typedef enum
{
WUT_NONE,
-
+
WUT_ALIENS,
WUT_HUMANS,
@@ -410,24 +410,24 @@ typedef enum
BA_A_SPAWN,
BA_A_OVERMIND,
-
+
BA_A_BARRICADE,
BA_A_ACIDTUBE,
BA_A_TRAPPER,
BA_A_BOOSTER,
BA_A_HIVE,
-
+
BA_A_HOVEL,
-
+
BA_H_SPAWN,
-
+
BA_H_MGTURRET,
BA_H_TESLAGEN,
-
+
BA_H_ARMOURY,
BA_H_DCC,
BA_H_MEDISTAT,
-
+
BA_H_REACTOR,
BA_H_REPEATER,
@@ -437,7 +437,7 @@ typedef enum
typedef enum
{
BIT_NONE,
-
+
BIT_ALIENS,
BIT_HUMANS,
@@ -498,8 +498,6 @@ typedef enum
EV_FALL_FAR,
EV_FALLING,
- EV_JUMP_PAD, // boing sound at origin, jump sound on player
-
EV_JUMP,
EV_WATER_TOUCH, // foot touches
EV_WATER_LEAVE, // foot leaves
@@ -535,7 +533,7 @@ typedef enum
EV_LEV1_GRAB,
EV_LEV4_CHARGE_PREPARE,
EV_LEV4_CHARGE_START,
-
+
EV_PAIN,
EV_DEATH1,
EV_DEATH2,
@@ -565,9 +563,9 @@ typedef enum
EV_OVERMIND_ATTACK, //TA: overmind under attack
EV_OVERMIND_DYING, //TA: overmind close to death
EV_OVERMIND_SPAWNS, //TA: overmind needs spawns
-
+
EV_DCC_ATTACK, //TA: dcc under attack
-
+
EV_RPTUSE_SOUND //TA: trigger a sound
} entity_event_t;
@@ -576,7 +574,7 @@ typedef enum
MN_TEAM,
MN_A_TEAMFULL,
MN_H_TEAMFULL,
-
+
//alien stuff
MN_A_CLASS,
MN_A_BUILD,
@@ -586,7 +584,7 @@ typedef enum
MN_A_NOEROOM,
MN_A_TOOCLOSE,
MN_A_NOOVMND_EVOLVE,
-
+
//alien build
MN_A_SPWNWARN,
MN_A_OVERMIND,
@@ -596,7 +594,7 @@ typedef enum
MN_A_NOROOM,
MN_A_NORMAL,
MN_A_HOVEL_EXIT,
-
+
//human stuff
MN_H_SPAWN,
MN_H_BUILD,
@@ -604,7 +602,7 @@ typedef enum
MN_H_NOSLOTS,
MN_H_NOFUNDS,
MN_H_ITEMHELD,
-
+
//human build
MN_H_REPEATER,
MN_H_NOPOWER,
@@ -706,7 +704,7 @@ typedef enum
NSPA_PAIN1,
NSPA_PAIN2,
-
+
NSPA_DEATH1,
NSPA_DEAD1,
NSPA_DEATH2,
@@ -715,9 +713,9 @@ typedef enum
NSPA_DEAD3,
MAX_NONSEG_PLAYER_ANIMATIONS,
-
+
NSPA_WALKBACK,
-
+
MAX_NONSEG_PLAYER_TOTALANIMATIONS
} nonSegPlayerAnimNumber_t;
@@ -741,11 +739,11 @@ typedef enum
BANIM_PAIN1,
BANIM_PAIN2,
-
+
BANIM_DESTROY1,
BANIM_DESTROY2,
BANIM_DESTROYED,
-
+
MAX_BUILDABLE_ANIMATIONS
} buildableAnimNumber_t;
@@ -785,11 +783,11 @@ typedef enum
typedef enum
{
PCL_NONE,
-
+
//builder classes
PCL_ALIEN_BUILDER0,
PCL_ALIEN_BUILDER0_UPG,
-
+
//offensive classes
PCL_ALIEN_LEVEL0,
PCL_ALIEN_LEVEL1,
@@ -799,7 +797,7 @@ typedef enum
PCL_ALIEN_LEVEL3,
PCL_ALIEN_LEVEL3_UPG,
PCL_ALIEN_LEVEL4,
-
+
//human class
PCL_HUMAN,
PCL_HUMAN_BSUIT,
@@ -861,7 +859,7 @@ typedef enum
MOD_SLOWBLOB,
MOD_POISON,
MOD_SWARM,
-
+
MOD_HSPAWN,
MOD_TESLAGEN,
MOD_MGTURRET,
@@ -882,36 +880,36 @@ typedef struct
char *className;
char *humanName;
-
+
char *modelName;
float modelScale;
char *skinName;
float shadowScale;
-
+
char *hudName;
-
+
int stages;
-
+
vec3_t mins;
vec3_t maxs;
vec3_t crouchMaxs;
vec3_t deadMins;
vec3_t deadMaxs;
float zOffset;
-
+
int viewheight;
int crouchViewheight;
-
+
int health;
float fallDamage;
int regenRate;
-
+
int abilities;
-
+
weapon_t startWeapon;
-
+
float buildDist;
-
+
int fov;
float bob;
float bobCycle;
@@ -938,7 +936,7 @@ typedef struct
float shadowScale;
char hudName[ MAX_QPATH ];
char humanName[ MAX_STRING_CHARS ];
-
+
vec3_t mins;
vec3_t maxs;
vec3_t crouchMaxs;
@@ -965,7 +963,7 @@ typedef struct
char *buildName;
char *humanName;
char *entityName;
-
+
char *models[ MAX_BUILDABLE_MODELS ];
float modelScale;
@@ -975,13 +973,13 @@ typedef struct
trType_t traj;
float bounce;
-
+
int buildPoints;
int stages;
int health;
int regenRate;
-
+
int splashDamage;
int splashRadius;
@@ -1008,7 +1006,7 @@ typedef struct
qboolean dccTest;
qboolean reactorTest;
-} buildableAttributes_t;
+} buildableAttributes_t;
typedef struct
{
@@ -1018,7 +1016,7 @@ typedef struct
vec3_t mins;
vec3_t maxs;
float zOffset;
-} buildableAttributeOverrides_t;
+} buildableAttributeOverrides_t;
//TA: weapon record
typedef struct
@@ -1042,7 +1040,7 @@ typedef struct
int repeatRate2;
int repeatRate3;
int reloadTime;
-
+
qboolean hasAltMode;
qboolean hasThirdMode;
@@ -1050,7 +1048,7 @@ typedef struct
float zoomFov;
qboolean purchasable;
-
+
int buildDelay;
WUTeam_t team;
@@ -1070,9 +1068,9 @@ typedef struct
char *upgradeHumanName;
char *icon;
-
+
qboolean purchasable;
-
+
WUTeam_t team;
} upgradeAttributes_t;
@@ -1095,10 +1093,10 @@ qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ],
void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps,
const vec3_t mins, const vec3_t maxs,
void (*trace)( trace_t *, const vec3_t, const vec3_t,
- const vec3_t, const vec3_t, int, int ),
+ const vec3_t, const vec3_t, int, int ),
vec3_t outOrigin, vec3_t outAngles, trace_t *tr );
int BG_GetValueOfHuman( playerState_t *ps );
-
+
int BG_FindBuildNumForName( char *name );
int BG_FindBuildNumForEntityName( char *name );
char *BG_FindNameForBuildable( int bclass );
@@ -1210,7 +1208,7 @@ WUTeam_t BG_FindTeamForUpgrade( int upgrade );
#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP)
#define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA)
-#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE)
+#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_BODY)
//
@@ -1221,9 +1219,9 @@ typedef enum
ET_GENERAL,
ET_PLAYER,
ET_ITEM,
-
+
ET_BUILDABLE, //TA: buildable type
-
+
ET_MISSILE,
ET_MOVER,
ET_BEAM,
@@ -1251,8 +1249,6 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t res
void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps );
-void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad );
-
void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap );
void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap );
diff --git a/src/game/bg_slidemove.c b/src/game/bg_slidemove.c
index 2ddd952b..47f1ec04 100644
--- a/src/game/bg_slidemove.c
+++ b/src/game/bg_slidemove.c
@@ -14,7 +14,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
@@ -51,7 +51,7 @@ qboolean PM_SlideMove( qboolean gravity )
float into;
vec3_t endVelocity;
vec3_t endClipVelocity;
-
+
numbumps = 4;
VectorCopy( pm->ps->velocity, primal_velocity );
@@ -62,11 +62,11 @@ qboolean PM_SlideMove( qboolean gravity )
endVelocity[ 2 ] -= pm->ps->gravity * pml.frametime;
pm->ps->velocity[ 2 ] = ( pm->ps->velocity[ 2 ] + endVelocity[ 2 ] ) * 0.5;
primal_velocity[ 2 ] = endVelocity[ 2 ];
-
+
if( pml.groundPlane )
{
// slide along the ground plane
- PM_ClipVelocity( pm->ps->velocity, pml.groundTrace.plane.normal,
+ PM_ClipVelocity( pm->ps->velocity, pml.groundTrace.plane.normal,
pm->ps->velocity, OVERCLIP );
}
}
@@ -135,10 +135,10 @@ qboolean PM_SlideMove( qboolean gravity )
break;
}
}
-
+
if( i < numplanes )
continue;
-
+
VectorCopy( trace.plane.normal, planes[ numplanes ] );
numplanes++;
@@ -236,7 +236,7 @@ void PM_StepEvent( vec3_t from, vec3_t to, vec3_t normal )
VectorSubtract( from, to, delta );
VectorCopy( delta, dNormal );
VectorNormalize( dNormal );
-
+
size = DotProduct( normal, dNormal ) * VectorLength( delta );
if( size > 0.0f )
@@ -256,7 +256,7 @@ void PM_StepEvent( vec3_t from, vec3_t to, vec3_t normal )
else
{
size = fabs( size );
-
+
if( size > 2.0f )
{
if( size < 7.0f )
@@ -269,7 +269,7 @@ void PM_StepEvent( vec3_t from, vec3_t to, vec3_t normal )
PM_AddEvent( EV_STEP_16 );
}
}
-
+
if( pm->debugLevel )
Com_Printf( "%i:stepped\n", c_pmove );
}
@@ -299,7 +299,7 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
}
else
VectorSet( normal, 0.0f, 0.0f, 1.0f );
-
+
VectorCopy( pm->ps->origin, start_o );
VectorCopy( pm->ps->velocity, start_v );
@@ -315,7 +315,7 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
{
if( pm->debugLevel )
Com_Printf( "%d: step down\n", c_pmove );
-
+
stepped = qtrue;
}
}
@@ -339,7 +339,7 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
// test the player position if they were a stepheight higher
pm->trace( &trace, start_o, pm->mins, pm->maxs, up, pm->ps->clientNum, pm->tracemask );
- if( trace.allsolid )
+ if( trace.allsolid )
{
if( pm->debugLevel )
Com_Printf( "%i:bend can't step\n", c_pmove );
@@ -350,7 +350,7 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
VectorSubtract( trace.endpos, start_o, step_v );
VectorCopy( step_v, step_vNormal );
VectorNormalize( step_vNormal );
-
+
stepSize = DotProduct( normal, step_vNormal ) * VectorLength( step_v );
// try slidemove from this position
VectorCopy( trace.endpos, pm->ps->origin );
@@ -360,7 +360,7 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
{
if( pm->debugLevel )
Com_Printf( "%d: step up\n", c_pmove );
-
+
stepped = qtrue;
}
@@ -368,10 +368,10 @@ qboolean PM_StepSlideMove( qboolean gravity, qboolean predictive )
VectorCopy( pm->ps->origin, down );
VectorMA( down, -stepSize, normal, down );
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask );
-
+
if( !trace.allsolid )
VectorCopy( trace.endpos, pm->ps->origin );
-
+
if( trace.fraction < 1.0f )
PM_ClipVelocity( pm->ps->velocity, trace.plane.normal, pm->ps->velocity, OVERCLIP );
}
@@ -399,7 +399,7 @@ qboolean PM_PredictStepMove( void )
if( PM_StepSlideMove( qfalse, qtrue ) )
stepped = qtrue;
-
+
VectorCopy( velocity, pm->ps->velocity );
VectorCopy( origin, pm->ps->origin );
pml.impactSpeed = impactSpeed;
diff --git a/src/game/g_active.c b/src/game/g_active.c
index e90f28d0..ca9c7db4 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -54,9 +54,9 @@ void P_DamageFeedback( gentity_t *player )
client->ps.damageYaw = 255;
client->damage_fromWorld = qfalse;
- }
- else
- {
+ }
+ else
+ {
vectoangles( client->damage_from, angles );
client->ps.damagePitch = angles[ PITCH ] / 360.0 * 256;
client->ps.damageYaw = angles[ YAW ] / 360.0 * 256;
@@ -196,7 +196,7 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm )
gentity_t *other;
memset( &trace, 0, sizeof( trace ) );
-
+
for( i = 0; i < pm->numtouch; i++ )
{
for( j = 0; j < i; j++ )
@@ -204,10 +204,10 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm )
if( pm->touchents[ j ] == pm->touchents[ i ] )
break;
}
-
+
if( j != i )
continue; // duplicated
-
+
other = &g_entities[ pm->touchents[ i ] ];
if( ( ent->r.svFlags & SVF_BOT ) && ( ent->touch ) )
@@ -215,10 +215,10 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm )
//charge attack
if( ent->client->ps.weapon == WP_ALEVEL4 &&
- ent->client->ps.stats[ STAT_MISC ] > 0 &&
+ ent->client->ps.stats[ STAT_MISC ] > 0 &&
ent->client->charging )
ChargeAttack( ent, other );
-
+
if( !other->touch )
continue;
@@ -253,10 +253,10 @@ void G_TouchTriggers( gentity_t *ent )
BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ],
pmins, pmaxs, NULL, NULL, NULL );
-
+
VectorAdd( ent->client->ps.origin, pmins, mins );
VectorAdd( ent->client->ps.origin, pmaxs, maxs );
-
+
VectorSubtract( mins, range, mins );
VectorAdd( maxs, range, maxs );
@@ -266,7 +266,7 @@ void G_TouchTriggers( gentity_t *ent )
VectorAdd( ent->client->ps.origin, ent->r.mins, mins );
VectorAdd( ent->client->ps.origin, ent->r.maxs, maxs );
- for( i = 0; i < num; i++ )
+ for( i = 0; i < num; i++ )
{
hit = &g_entities[ touch[ i ] ];
@@ -358,7 +358,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
G_TouchTriggers( ent );
trap_UnlinkEntity( ent );
-
+
if( ( client->buttons & BUTTON_ATTACK ) && !( client->oldbuttons & BUTTON_ATTACK ) )
{
//if waiting in a queue remove from the queue
@@ -368,7 +368,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
G_RemoveFromSpawnQueue( &level.alienSpawnQueue, client->ps.clientNum );
else if( client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
G_RemoveFromSpawnQueue( &level.humanSpawnQueue, client->ps.clientNum );
-
+
client->pers.classSelection = PCL_NONE;
client->ps.stats[ STAT_PCLASS ] = PCL_NONE;
}
@@ -382,7 +382,7 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd )
G_TriggerMenu( client->ps.clientNum, MN_H_SPAWN );
}
}
-
+
//set the queue position for the client side
if( client->ps.pm_flags & PMF_QUEUED )
{
@@ -436,14 +436,14 @@ qboolean ClientInactivityTimer( gclient_t *client )
trap_DropClient( client - level.clients, "Dropped due to inactivity" );
return qfalse;
}
-
+
if( level.time > client->inactivityTime - 10000 && !client->inactivityWarning )
{
client->inactivityWarning = qtrue;
G_SendCommandFromServer( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" );
}
}
-
+
return qtrue;
}
@@ -461,10 +461,10 @@ void ClientTimerActions( gentity_t *ent, int msec )
int aForward, aRight;
ucmd = &ent->client->pers.cmd;
-
+
aForward = abs( ucmd->forwardmove );
aRight = abs( ucmd->rightmove );
-
+
client = ent->client;
client->time100 += msec;
client->time1000 += msec;
@@ -480,7 +480,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) )
client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST;
-
+
if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 )
{
//subtract stamina
@@ -488,16 +488,16 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_STAMINA ] -= STAMINA_LARMOUR_TAKE;
else
client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE;
-
+
if( client->ps.stats[ STAT_STAMINA ] < -MAX_STAMINA )
client->ps.stats[ STAT_STAMINA ] = -MAX_STAMINA;
}
-
+
if( ( aForward <= 64 && aForward > 5 ) || ( aRight <= 64 && aRight > 5 ) )
{
//restore stamina
client->ps.stats[ STAT_STAMINA ] += STAMINA_WALK_RESTORE;
-
+
if( client->ps.stats[ STAT_STAMINA ] > MAX_STAMINA )
client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA;
}
@@ -505,7 +505,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
{
//restore stamina faster
client->ps.stats[ STAT_STAMINA ] += STAMINA_STOP_RESTORE;
-
+
if( client->ps.stats[ STAT_STAMINA ] > MAX_STAMINA )
client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA;
}
@@ -541,7 +541,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
//client is charging up for a... charge
if( client->ps.weapon == WP_ALEVEL4 )
{
- if( client->ps.stats[ STAT_MISC ] < LEVEL4_CHARGE_TIME && ucmd->buttons & BUTTON_ATTACK2 &&
+ if( client->ps.stats[ STAT_MISC ] < LEVEL4_CHARGE_TIME && ucmd->buttons & BUTTON_ATTACK2 &&
!client->charging )
{
client->charging = qfalse; //should already be off, just making sure
@@ -552,9 +552,9 @@ void ClientTimerActions( gentity_t *ent, int msec )
//trigger charge sound...is quite annoying
//if( client->ps.stats[ STAT_MISC ] <= 0 )
// G_AddEvent( ent, EV_LEV4_CHARGE_PREPARE, 0 );
-
+
client->ps.stats[ STAT_MISC ] += (int)( 100 * (float)LEVEL4_CHARGE_CHARGE_RATIO );
-
+
if( client->ps.stats[ STAT_MISC ] > LEVEL4_CHARGE_TIME )
client->ps.stats[ STAT_MISC ] = LEVEL4_CHARGE_TIME;
}
@@ -568,10 +568,10 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( client->ps.stats[ STAT_MISC ] > LEVEL4_MIN_CHARGE_TIME )
{
client->ps.stats[ STAT_MISC ] -= 100;
-
+
if( client->charging == qfalse )
G_AddEvent( ent, EV_LEV4_CHARGE_START, 0 );
-
+
client->charging = qtrue;
client->ps.stats[ STAT_STATE ] |= SS_CHARGING;
@@ -585,8 +585,8 @@ void ClientTimerActions( gentity_t *ent, int msec )
}
else
client->ps.stats[ STAT_MISC ] = 0;
-
-
+
+
if( client->ps.stats[ STAT_MISC ] <= 0 )
{
client->ps.stats[ STAT_MISC ] = 0;
@@ -600,19 +600,19 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( client->ps.weapon == WP_LUCIFER_CANNON )
{
int ammo;
-
+
BG_UnpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL );
-
+
if( client->ps.stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK )
client->ps.stats[ STAT_MISC ] += ( 100.0f / LCANNON_CHARGE_TIME ) * LCANNON_TOTAL_CHARGE;
-
+
if( client->ps.stats[ STAT_MISC ] > LCANNON_TOTAL_CHARGE )
client->ps.stats[ STAT_MISC ] = LCANNON_TOTAL_CHARGE;
if( client->ps.stats[ STAT_MISC ] > ( ammo * LCANNON_TOTAL_CHARGE ) / 10 )
client->ps.stats[ STAT_MISC ] = ammo * LCANNON_TOTAL_CHARGE / 10;
}
-
+
switch( client->ps.weapon )
{
case WP_ABUILD:
@@ -624,7 +624,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
{
int dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
vec3_t dummy;
-
+
if( G_itemFits( ent, client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT,
dist, dummy ) == IBE_NONE )
client->ps.stats[ STAT_BUILDABLE ] |= SB_VALID_TOGGLEBIT;
@@ -635,11 +635,11 @@ void ClientTimerActions( gentity_t *ent, int msec )
//update build timer
if( client->ps.stats[ STAT_MISC ] > 0 )
client->ps.stats[ STAT_MISC ] -= 100;
-
+
if( client->ps.stats[ STAT_MISC ] < 0 )
client->ps.stats[ STAT_MISC ] = 0;
break;
-
+
default:
break;
}
@@ -647,7 +647,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE )
{
int remainingStartupTime = MEDKIT_STARTUP_TIME - ( level.time - client->lastMedKitTime );
-
+
if( remainingStartupTime < 0 )
{
if( ent->health < ent->client->ps.stats[ STAT_MAX_HEALTH ] &&
@@ -690,19 +690,19 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED )
G_Damage( ent, client->lastPoisonCloudedClient, client->lastPoisonCloudedClient, NULL, NULL,
LEVEL1_PCLOUD_DMG, 0, MOD_LEVEL1_PCLOUD );
-
+
//client is poisoned
if( client->ps.stats[ STAT_STATE ] & SS_POISONED )
{
int i;
int seconds = ( ( level.time - client->lastPoisonTime ) / 1000 ) + 1;
int damage = ALIEN_POISON_DMG, damage2 = 0;
-
+
for( i = 0; i < seconds; i++ )
{
if( i == seconds - 1 )
damage2 = damage;
-
+
damage *= ALIEN_POISON_DIVIDER;
}
@@ -721,15 +721,15 @@ void ClientTimerActions( gentity_t *ent, int msec )
int i, num;
gentity_t *boostEntity;
float modifier = 1.0f;
-
+
VectorAdd( client->ps.origin, range, maxs );
VectorSubtract( client->ps.origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
boostEntity = &g_entities[ entityList[ i ] ];
-
+
if( boostEntity->client && boostEntity->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS &&
boostEntity->client->ps.stats[ STAT_PCLASS ] == PCL_ALIEN_LEVEL4 )
{
@@ -744,8 +744,8 @@ void ClientTimerActions( gentity_t *ent, int msec )
break;
}
}
-
- if( ent->health < client->ps.stats[ STAT_MAX_HEALTH ] &&
+
+ if( ent->health > 0 && ent->health < client->ps.stats[ STAT_MAX_HEALTH ] &&
( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time )
ent->health += BG_FindRegenRateForClass( client->ps.stats[ STAT_PCLASS ] ) * modifier;
@@ -753,18 +753,18 @@ void ClientTimerActions( gentity_t *ent, int msec )
ent->health = client->ps.stats[ STAT_MAX_HEALTH ];
}
}
-
+
while( client->time10000 >= 10000 )
{
client->time10000 -= 10000;
-
+
if( client->ps.weapon == WP_ALEVEL3_UPG )
{
int ammo, maxAmmo;
-
+
BG_FindAmmoForWeapon( WP_ALEVEL3_UPG, &maxAmmo, NULL );
BG_UnpackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL );
-
+
if( ammo < maxAmmo )
{
ammo++;
@@ -841,12 +841,12 @@ void ClientEvents( gentity_t *ent, int oldEventSequence )
damage = (int)( (float)BG_FindHealthForClass( class ) *
BG_FindFallDamageForClass( class ) * fallDistance );
-
+
VectorSet( dir, 0, 0, 1 );
BG_FindBBoxForClass( class, mins, NULL, NULL, NULL, NULL );
mins[ 0 ] = mins[ 1 ] = 0.0f;
VectorAdd( client->ps.origin, mins, point );
-
+
ent->pain_debounce_time = level.time + 200; // no normal pain sound
G_Damage( ent, NULL, NULL, dir, point, damage, DAMAGE_NO_LOCDAMAGE, MOD_FALLING );
break;
@@ -868,30 +868,30 @@ void ClientEvents( gentity_t *ent, int oldEventSequence )
if( ent->s.weapon == WP_GRENADE )
{
int j;
-
+
BG_RemoveWeaponFromInventory( ent->s.weapon, ent->client->ps.stats );
-
+
//switch to the first non blaster weapon
for( j = WP_NONE + 1; j < WP_NUM_WEAPONS; j++ )
{
if( j == WP_BLASTER )
continue;
-
+
if( BG_InventoryContainsWeapon( j, ent->client->ps.stats ) )
{
G_ForceWeaponChange( ent, j );
break;
}
}
-
+
//only got the blaster to switch to
if( j == WP_NUM_WEAPONS )
G_ForceWeaponChange( ent, WP_BLASTER );
-
+
//update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
}
-
+
break;
default:
@@ -908,34 +908,34 @@ SendPendingPredictableEvents
*/
void SendPendingPredictableEvents( playerState_t *ps )
{
- gentity_t *t;
- int event, seq;
- int extEvent, number;
+ gentity_t *t;
+ int event, seq;
+ int extEvent, number;
- // if there are still events pending
- if( ps->entityEventSequence < ps->eventSequence )
+ // if there are still events pending
+ if( ps->entityEventSequence < ps->eventSequence )
{
- // create a temporary entity for this event which is sent to everyone
- // except the client who generated the event
- seq = ps->entityEventSequence & ( MAX_PS_EVENTS - 1 );
- event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
- // set external event to zero before calling BG_PlayerStateToEntityState
- extEvent = ps->externalEvent;
- ps->externalEvent = 0;
- // create temporary entity for event
- t = G_TempEntity( ps->origin, event );
- number = t->s.number;
- BG_PlayerStateToEntityState( ps, &t->s, qtrue );
- t->s.number = number;
- t->s.eType = ET_EVENTS + event;
- t->s.eFlags |= EF_PLAYER_EVENT;
- t->s.otherEntityNum = ps->clientNum;
- // send to everyone except the client who generated the event
- t->r.svFlags |= SVF_NOTSINGLECLIENT;
- t->r.singleClient = ps->clientNum;
- // set back external event
- ps->externalEvent = extEvent;
- }
+ // create a temporary entity for this event which is sent to everyone
+ // except the client who generated the event
+ seq = ps->entityEventSequence & ( MAX_PS_EVENTS - 1 );
+ event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
+ // set external event to zero before calling BG_PlayerStateToEntityState
+ extEvent = ps->externalEvent;
+ ps->externalEvent = 0;
+ // create temporary entity for event
+ t = G_TempEntity( ps->origin, event );
+ number = t->s.number;
+ BG_PlayerStateToEntityState( ps, &t->s, qtrue );
+ t->s.number = number;
+ t->s.eType = ET_EVENTS + event;
+ t->s.eFlags |= EF_PLAYER_EVENT;
+ t->s.otherEntityNum = ps->clientNum;
+ // send to everyone except the client who generated the event
+ t->r.svFlags |= SVF_NOTSINGLECLIENT;
+ t->r.singleClient = ps->clientNum;
+ // set back external event
+ ps->externalEvent = extEvent;
+ }
}
/*
@@ -962,7 +962,7 @@ void ClientThink_real( gentity_t *ent )
// don't think if the client is not yet connected (and thus not yet spawned in)
if( client->pers.connected != CON_CONNECTED )
return;
-
+
// mark the time, so the connection sprite can be removed
ucmd = &ent->client->pers.cmd;
@@ -972,7 +972,7 @@ void ClientThink_real( gentity_t *ent )
ucmd->serverTime = level.time + 200;
// G_Printf("serverTime <<<<<\n" );
}
-
+
if( ucmd->serverTime < level.time - 1000 )
{
ucmd->serverTime = level.time - 1000;
@@ -984,10 +984,10 @@ void ClientThink_real( gentity_t *ent )
// to check for follow toggles
if( msec < 1 && client->sess.spectatorState != SPECTATOR_FOLLOW )
return;
-
+
if( msec > 200 )
msec = 200;
-
+
if( pmove_msec.integer < 8 )
trap_Cvar_Set( "pmove_msec", "8" );
else if( pmove_msec.integer > 33 )
@@ -999,7 +999,7 @@ void ClientThink_real( gentity_t *ent )
//if (ucmd->serverTime - client->ps.commandTime <= 0)
// return;
}
-
+
//
// check for exiting intermission
//
@@ -1014,7 +1014,7 @@ void ClientThink_real( gentity_t *ent )
{
if( client->sess.spectatorState == SPECTATOR_SCOREBOARD )
return;
-
+
SpectatorThink( ent, ucmd );
return;
}
@@ -1061,11 +1061,11 @@ void ClientThink_real( gentity_t *ent )
if( client->ps.stats[ STAT_STATE ] & SS_POISONCLOUDED &&
client->lastPoisonCloudedTime + LEVEL1_PCLOUD_TIME < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_POISONCLOUDED;
-
+
if( client->ps.stats[ STAT_STATE ] & SS_POISONED &&
client->lastPoisonTime + ALIEN_POISON_TIME < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
-
+
client->ps.gravity = g_gravity.value;
if( BG_InventoryContainsUpgrade( UP_MEDKIT, client->ps.stats ) &&
@@ -1083,42 +1083,42 @@ void ClientThink_real( gentity_t *ent )
//remove anti toxin
BG_DeactivateUpgrade( UP_MEDKIT, client->ps.stats );
BG_RemoveUpgradeFromInventory( UP_MEDKIT, client->ps.stats );
-
+
client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
client->poisonImmunityTime = level.time + MEDKIT_POISON_IMMUNITY_TIME;
-
+
client->ps.stats[ STAT_STATE ] |= SS_MEDKIT_ACTIVE;
client->lastMedKitTime = level.time;
client->medKitHealthToRestore =
client->ps.stats[ STAT_MAX_HEALTH ] - client->ps.stats[ STAT_HEALTH ];
client->medKitIncrementTime = level.time +
( MEDKIT_STARTUP_TIME / MEDKIT_STARTUP_SPEED );
-
+
G_AddEvent( ent, EV_MEDKIT_USED, 0 );
}
}
-
+
if( BG_InventoryContainsUpgrade( UP_GRENADE, client->ps.stats ) &&
BG_UpgradeIsActive( UP_GRENADE, client->ps.stats ) )
{
int lastWeapon = ent->s.weapon;
-
+
//remove anti toxin
BG_DeactivateUpgrade( UP_GRENADE, client->ps.stats );
BG_RemoveUpgradeFromInventory( UP_GRENADE, client->ps.stats );
-
+
//M-M-M-M-MONSTER HACK
ent->s.weapon = WP_GRENADE;
FireWeapon( ent );
ent->s.weapon = lastWeapon;
}
-
+
// set speed
client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] );
if( client->lastCreepSlowTime + CREEP_TIMEOUT < level.time )
client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED;
-
+
//randomly disable the jet pack if damaged
if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) &&
BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) )
@@ -1133,7 +1133,7 @@ void ClientThink_real( gentity_t *ent )
if( !level.reactorPresent )
BG_DeactivateUpgrade( UP_JETPACK, client->ps.stats );
}
-
+
// set up for pmove
oldEventSequence = client->ps.eventSequence;
@@ -1169,19 +1169,19 @@ void ClientThink_real( gentity_t *ent )
ent->flags &= ~FL_FORCE_GESTURE;
ent->client->pers.cmd.buttons |= BUTTON_GESTURE;
}
-
+
pm.ps = &client->ps;
pm.cmd = *ucmd;
-
+
if( pm.ps->pm_type == PM_DEAD )
pm.tracemask = MASK_PLAYERSOLID; // & ~CONTENTS_BODY;
-
+
if( pm.ps->stats[ STAT_STATE ] & SS_INFESTING ||
pm.ps->stats[ STAT_STATE ] & SS_HOVELING )
pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;
else
pm.tracemask = MASK_PLAYERSOLID;
-
+
pm.trace = trap_Trace;
pm.pointcontents = trap_PointContents;
pm.debugLevel = g_debugMove.integer;
@@ -1229,7 +1229,7 @@ void ClientThink_real( gentity_t *ent )
// link entity now, after any personal teleporters have been used
trap_LinkEntity( ent );
-
+
// NOTE: now copy the exact origin over otherwise clients can be snapped into solid
VectorCopy( ent->client->ps.origin, ent->r.currentOrigin );
VectorCopy( ent->client->ps.origin, ent->s.origin );
@@ -1240,7 +1240,7 @@ void ClientThink_real( gentity_t *ent )
// save results of triggers and client events
if( ent->client->ps.eventSequence != oldEventSequence )
ent->eventTime = level.time;
-
+
// swap and latch button actions
client->oldbuttons = client->buttons;
client->buttons = ucmd->buttons;
@@ -1256,7 +1256,7 @@ void ClientThink_real( gentity_t *ent )
if( client->ps.stats[ STAT_STATE ] & SS_HOVELING )
{
gentity_t *hovel = client->hovel;
-
+
//only let the player out if there is room
if( !AHovel_Blocked( hovel, ent, qtrue ) )
{
@@ -1266,7 +1266,7 @@ void ClientThink_real( gentity_t *ent )
//client leaves hovel
client->ps.stats[ STAT_STATE ] &= ~SS_HOVELING;
-
+
//hovel is empty
G_setBuildableAnim( hovel, BANIM_ATTACK2, qfalse );
hovel->active = qfalse;
@@ -1280,14 +1280,14 @@ void ClientThink_real( gentity_t *ent )
else
{
#define USE_OBJECT_RANGE 64
-
+
int entityList[ MAX_GENTITIES ];
vec3_t range = { USE_OBJECT_RANGE, USE_OBJECT_RANGE, USE_OBJECT_RANGE };
vec3_t mins, maxs;
int i, num;
int j;
qboolean upgrade = qfalse;
-
+
//TA: look for object infront of player
AngleVectors( client->ps.viewangles, view, NULL, NULL );
VectorMA( client->ps.origin, USE_OBJECT_RANGE, view, point );
@@ -1303,19 +1303,19 @@ void ClientThink_real( gentity_t *ent )
VectorAdd( client->ps.origin, range, maxs );
VectorSubtract( client->ps.origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
traceEnt = &g_entities[ entityList[ i ] ];
-
+
if( traceEnt && traceEnt->biteam == client->ps.stats[ STAT_PTEAM ] && traceEnt->use )
{
traceEnt->use( traceEnt, ent, ent ); //other and activator are the same in this context
break;
}
}
-
+
if( i == num && client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
for( j = PCL_NONE + 1; j < PCL_NUM_CLASSES; j++ )
@@ -1328,7 +1328,7 @@ void ClientThink_real( gentity_t *ent )
break;
}
}
-
+
if( upgrade )
{
//no nearby objects and alien - show class menu
@@ -1343,7 +1343,7 @@ void ClientThink_real( gentity_t *ent )
}
}
}
-
+
// check for respawning
if( client->ps.stats[ STAT_HEALTH ] <= 0 )
{
@@ -1374,15 +1374,6 @@ void ClientThink_real( gentity_t *ent )
client->retriggerArmouryMenu = 0;
}
- if( ent->suicideTime > 0 && ent->suicideTime < level.time )
- {
- ent->flags &= ~FL_GODMODE;
- ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0;
- player_die( ent, ent, ent, 100000, MOD_SUICIDE );
-
- ent->suicideTime = 0;
- }
-
// Give clients some credit periodically
if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time )
{
@@ -1401,6 +1392,15 @@ void ClientThink_real( gentity_t *ent )
// perform once-a-second actions
ClientTimerActions( ent, msec );
+
+ if( ent->suicideTime > 0 && ent->suicideTime < level.time )
+ {
+ ent->flags &= ~FL_GODMODE;
+ ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0;
+ player_die( ent, ent, ent, 100000, MOD_SUICIDE );
+
+ ent->suicideTime = 0;
+ }
}
/*
@@ -1430,7 +1430,7 @@ void G_RunClient( gentity_t *ent )
{
if( !( ent->r.svFlags & SVF_BOT ) && !g_synchronousClients.integer )
return;
-
+
ent->client->pers.cmd.serverTime = level.time;
ClientThink_real( ent );
}
@@ -1455,7 +1455,7 @@ void SpectatorClientEndFrame( gentity_t *ent )
if( clientNum >= 0 )
{
cl = &level.clients[ clientNum ];
-
+
if( cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR )
{
flags = ( cl->ps.eFlags & ~( EF_VOTED | EF_TEAMVOTED ) ) |
@@ -1517,7 +1517,7 @@ void ClientEndFrame( gentity_t *ent )
BG_PlayerStateToEntityStateExtraPolate( &ent->client->ps, &ent->s, ent->client->ps.commandTime, qtrue );
else
BG_PlayerStateToEntityState( &ent->client->ps, &ent->s, qtrue );
-
+
SendPendingPredictableEvents( &ent->client->ps );
}
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index fef7697c..923d210f 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -26,9 +26,9 @@ void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean fo
if( force )
localAnim |= ANIM_FORCEBIT;
-
+
localAnim |= ( ( ent->s.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT );
-
+
ent->s.legsAnim = localAnim;
}
@@ -51,7 +51,8 @@ G_CheckSpawnPoint
Check if a spawn at a specified point is valid
===============
*/
-gentity_t *G_CheckSpawnPoint( vec3_t origin, vec3_t normal, buildable_t spawn, vec3_t spawnOrigin )
+gentity_t *G_CheckSpawnPoint( int spawnNum, vec3_t origin, vec3_t normal,
+ buildable_t spawn, vec3_t spawnOrigin )
{
float displacement;
vec3_t mins, maxs;
@@ -65,17 +66,22 @@ gentity_t *G_CheckSpawnPoint( vec3_t origin, vec3_t normal, buildable_t spawn, v
{
VectorSet( cmins, -MAX_ALIEN_BBOX, -MAX_ALIEN_BBOX, -MAX_ALIEN_BBOX );
VectorSet( cmaxs, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX );
-
+
displacement = ( maxs[ 2 ] + MAX_ALIEN_BBOX ) * M_ROOT3;
VectorMA( origin, displacement, normal, localOrigin );
-
+
+ trap_Trace( &tr, origin, NULL, NULL, localOrigin, spawnNum, MASK_SHOT );
+
+ if( tr.entityNum != ENTITYNUM_NONE )
+ return &g_entities[ tr.entityNum ];
+
trap_Trace( &tr, localOrigin, cmins, cmaxs, localOrigin, -1, MASK_SHOT );
if( tr.entityNum == ENTITYNUM_NONE )
{
if( spawnOrigin != NULL )
VectorCopy( localOrigin, spawnOrigin );
-
+
return NULL;
}
else
@@ -87,14 +93,19 @@ gentity_t *G_CheckSpawnPoint( vec3_t origin, vec3_t normal, buildable_t spawn, v
VectorCopy( origin, localOrigin );
localOrigin[ 2 ] += maxs[ 2 ] + fabs( cmins[ 2 ] ) + 1.0f;
-
+
+ trap_Trace( &tr, origin, NULL, NULL, localOrigin, spawnNum, MASK_SHOT );
+
+ if( tr.entityNum != ENTITYNUM_NONE )
+ return &g_entities[ tr.entityNum ];
+
trap_Trace( &tr, localOrigin, cmins, cmaxs, localOrigin, -1, MASK_SHOT );
-
+
if( tr.entityNum == ENTITYNUM_NONE )
{
if( spawnOrigin != NULL )
VectorCopy( localOrigin, spawnOrigin );
-
+
return NULL;
}
else
@@ -115,7 +126,7 @@ static int G_NumberOfDependants( gentity_t *self )
{
int i, n = 0;
gentity_t *ent;
-
+
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
if( ent->s.eType != ET_BUILDABLE )
@@ -149,18 +160,18 @@ static qboolean findPower( gentity_t *self )
if( self->biteam != BIT_HUMANS )
return qfalse;
-
+
//reactor is always powered
if( self->s.modelindex == BA_H_REACTOR )
return qtrue;
-
+
//if this already has power then stop now
if( self->parentNode && self->parentNode->powered )
return qtrue;
-
+
//reset parent
self->parentNode = NULL;
-
+
//iterate through entities
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
@@ -185,9 +196,9 @@ static qboolean findPower( gentity_t *self )
//if there were no power items nearby give up
if( !foundPower )
return qfalse;
-
+
//bleh
- if( ( closestPower->s.modelindex == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) ||
+ if( ( closestPower->s.modelindex == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) ||
( closestPower->s.modelindex == BA_H_REPEATER && ( minDistance <= REPEATER_BASESIZE ) &&
closestPower->powered ) )
{
@@ -236,14 +247,14 @@ static qboolean findDCC( gentity_t *self )
if( self->biteam != BIT_HUMANS )
return qfalse;
-
+
//if this already has dcc then stop now
if( self->dccNode && self->dccNode->powered )
return qtrue;
-
+
//reset parent
self->dccNode = NULL;
-
+
//iterate through entities
for( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
@@ -267,7 +278,7 @@ static qboolean findDCC( gentity_t *self )
//if there were no power items nearby give up
if( !foundDCC )
return qfalse;
-
+
self->dccNode = closestDCC;
return qtrue;
@@ -304,14 +315,14 @@ static qboolean findOvermind( gentity_t *self )
if( self->biteam != BIT_ALIENS )
return qfalse;
-
+
//if this already has overmind then stop now
if( self->overmindNode && self->overmindNode->health > 0 )
return qtrue;
-
+
//reset parent
self->overmindNode = NULL;
-
+
//iterate through entities
for( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
@@ -365,7 +376,7 @@ static qboolean findCreep( gentity_t *self )
//don't check for creep if flying through the air
if( self->s.groundEntityNum == -1 )
return qtrue;
-
+
//if self does not have a parentNode or it's parentNode is invalid find a new one
if( ( self->parentNode == NULL ) || !self->parentNode->inuse )
{
@@ -386,7 +397,7 @@ static qboolean findCreep( gentity_t *self )
}
}
}
-
+
if( minDistance <= CREEP_BASESIZE )
{
self->parentNode = closestSpawn;
@@ -438,13 +449,13 @@ static void creepSlow( gentity_t *self )
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
//find humans
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS &&
enemy->client->ps.groundEntityNum != ENTITYNUM_NONE &&
G_Visible( self, enemy ) )
@@ -504,7 +515,7 @@ void A_CreepRecede( gentity_t *self )
( 1.0f - ( (float)( level.time - self->buildTime ) /
(float)BG_FindBuildTimeForBuildable( self->s.modelindex ) ) ) ) );
}
-
+
//creep is still receeding
if( ( self->timestamp + 10000 ) > level.time )
self->nextthink = level.time + 500;
@@ -537,7 +548,7 @@ void ASpawn_Melt( gentity_t *self )
{
self->s.eFlags |= EF_DEAD;
G_AddEvent( self, EV_BUILD_DESTROY, 0 );
-
+
if( self->spawned )
self->s.time = -level.time;
else
@@ -546,7 +557,7 @@ void ASpawn_Melt( gentity_t *self )
( 1.0f - ( (float)( level.time - self->buildTime ) /
(float)BG_FindBuildTimeForBuildable( self->s.modelindex ) ) ) ) );
}
-
+
//not dead yet
if( ( self->timestamp + 10000 ) > level.time )
self->nextthink = level.time + 500;
@@ -577,7 +588,7 @@ void ASpawn_Blast( gentity_t *self )
self->timestamp = level.time;
self->think = ASpawn_Melt;
self->nextthink = level.time + 500; //wait .5 seconds before damaging others
-
+
self->r.contents = 0; //stop collisions...
trap_LinkEntity( self ); //...requires a relink
}
@@ -596,14 +607,14 @@ void ASpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->die = nullDieFunction;
self->think = ASpawn_Blast;
-
+
if( self->spawned )
self->nextthink = level.time + 5000;
else
self->nextthink = level.time; //blast immediately
-
+
self->s.eFlags &= ~EF_FIRING; //prevent any firing effects
-
+
if( attacker && attacker->client && attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
if( self->s.modelindex == BA_A_OVERMIND )
@@ -624,12 +635,13 @@ void ASpawn_Think( gentity_t *self )
{
gentity_t *ent;
- if( self->spawned )
+ if( self->spawned )
{
//only suicide if at rest
if( self->s.groundEntityNum )
{
- if( ( ent = G_CheckSpawnPoint( self->s.origin, self->s.origin2, BA_A_SPAWN, NULL ) ) != NULL )
+ if( ( ent = G_CheckSpawnPoint( self->s.number, self->s.origin,
+ self->s.origin2, BA_A_SPAWN, NULL ) ) != NULL )
{
if( ent->s.eType == ET_BUILDABLE || ent->s.number == ENTITYNUM_WORLD ||
ent->s.eType == ET_MOVER )
@@ -692,7 +704,7 @@ void AOvermind_Think( gentity_t *self )
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
if( self->spawned && ( self->health > 0 ) )
{
//do some damage
@@ -700,7 +712,7 @@ void AOvermind_Think( gentity_t *self )
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
self->timestamp = level.time;
@@ -716,7 +728,7 @@ void AOvermind_Think( gentity_t *self )
self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD;
G_BroadcastEvent( EV_OVERMIND_SPAWNS, 0 );
}
-
+
//overmind dying
if( self->health < ( OVERMIND_HEALTH / 10.0f ) && level.time > self->overmindDyingTimer )
{
@@ -730,7 +742,7 @@ void AOvermind_Think( gentity_t *self )
self->overmindAttackTimer = level.time + OVERMIND_ATTACK_PERIOD;
G_BroadcastEvent( EV_OVERMIND_ATTACK, 0 );
}
-
+
self->lastHealth = self->health;
}
else
@@ -790,7 +802,7 @@ void ABarricade_Blast( gentity_t *self )
self->timestamp = level.time;
self->think = A_CreepRecede;
self->nextthink = level.time + 500; //wait .5 seconds before damaging others
-
+
self->r.contents = 0; //stop collisions...
trap_LinkEntity( self ); //...requires a relink
}
@@ -806,11 +818,11 @@ void ABarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker,
{
G_setBuildableAnim( self, BANIM_DESTROY1, qtrue );
G_setIdleBuildableAnim( self, BANIM_DESTROYED );
-
+
self->die = nullDieFunction;
self->think = ABarricade_Blast;
self->s.eFlags &= ~EF_FIRING; //prevent any firing effects
-
+
if( self->spawned )
self->nextthink = level.time + 5000;
else
@@ -832,7 +844,7 @@ void ABarricade_Think( gentity_t *self )
G_Damage( self, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE );
return;
}
-
+
creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
@@ -864,7 +876,7 @@ void AAcidTube_Damage( gentity_t *self )
self->s.eFlags |= EF_FIRING;
G_AddEvent( self, EV_ALIEN_ACIDTUBE, DirToByte( self->s.origin2 ) );
}
-
+
if( ( self->timestamp + ACIDTUBE_REPEAT ) > level.time )
self->think = AAcidTube_Damage;
else
@@ -900,22 +912,22 @@ void AAcidTube_Think( gentity_t *self )
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
//if there is no creep nearby die
if( !findCreep( self ) )
{
G_Damage( self, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE );
return;
}
-
- if( self->spawned && findOvermind( self ) )
+
+ if( self->spawned && findOvermind( self ) )
{
//do some damage
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( !G_Visible( self, enemy ) )
continue;
@@ -960,10 +972,10 @@ void AHive_Think( gentity_t *self )
vec3_t dirToTarget;
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
-
+
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
//if there is no creep nearby die
if( !findCreep( self ) )
{
@@ -973,15 +985,15 @@ void AHive_Think( gentity_t *self )
if( self->timestamp < level.time )
self->active = qfalse; //nothing has returned in HIVE_REPEAT seconds, forget about it
-
- if( self->spawned && !self->active && findOvermind( self ) )
+
+ if( self->spawned && !self->active && findOvermind( self ) )
{
//do some damage
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( enemy->health <= 0 )
continue;
@@ -993,11 +1005,11 @@ void AHive_Think( gentity_t *self )
self->active = qtrue;
self->target_ent = enemy;
self->timestamp = level.time + HIVE_REPEAT;
-
+
VectorSubtract( enemy->s.pos.trBase, self->s.pos.trBase, dirToTarget );
VectorNormalize( dirToTarget );
vectoangles( dirToTarget, self->turretAim );
-
+
//fire at target
FireWeapon( self );
G_setBuildableAnim( self, BANIM_ATTACK1, qfalse );
@@ -1036,7 +1048,7 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx
BG_FindBBoxForBuildable( BA_A_HOVEL, NULL, hovelMaxs );
BG_FindBBoxForClass( player->client->ps.stats[ STAT_PCLASS ],
mins, maxs, NULL, NULL, NULL );
-
+
VectorCopy( hovel->s.origin2, normal );
AngleVectors( hovel->s.angles, forward, NULL, NULL );
VectorInverse( forward );
@@ -1048,21 +1060,21 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx
vectoangles( forward, angles );
VectorMA( origin, HOVEL_TRACE_DEPTH, normal, start );
-
+
//compute a place up in the air to start the real trace
trap_Trace( &tr, origin, mins, maxs, start, player->s.number, MASK_PLAYERSOLID );
VectorMA( origin, ( HOVEL_TRACE_DEPTH * tr.fraction ) - 1.0f, normal, start );
VectorMA( origin, -HOVEL_TRACE_DEPTH, normal, end );
-
+
trap_Trace( &tr, start, mins, maxs, end, player->s.number, MASK_PLAYERSOLID );
-
+
if( tr.startsolid )
return qtrue;
VectorCopy( tr.endpos, origin );
-
+
trap_Trace( &tr, origin, mins, maxs, origin, player->s.number, MASK_PLAYERSOLID );
-
+
if( provideExit )
{
G_SetOrigin( player, origin );
@@ -1070,7 +1082,7 @@ qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideEx
VectorCopy( vec3_origin, player->client->ps.velocity );
SetClientViewAngle( player, angles );
}
-
+
if( tr.fraction < 1.0f )
return qtrue;
else
@@ -1106,8 +1118,8 @@ Called when an alien uses a hovel
void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
vec3_t hovelOrigin, hovelAngles, inverseNormal;
-
- if( self->spawned && findOvermind( self ) )
+
+ if( self->spawned && findOvermind( self ) )
{
if( self->active )
{
@@ -1169,7 +1181,7 @@ void AHovel_Think( gentity_t *self )
else
G_setIdleBuildableAnim( self, BANIM_IDLE1 );
}
-
+
creepSlow( self );
self->nextthink = level.time + 200;
@@ -1199,31 +1211,31 @@ void AHovel_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->timestamp = level.time;
self->think = ASpawn_Melt;
self->nextthink = level.time + 500; //wait .5 seconds before damaging others
-
+
//if the hovel is occupied free the occupant
if( self->active )
{
gentity_t *builder = self->builder;
vec3_t newOrigin;
vec3_t newAngles;
-
+
VectorCopy( self->s.angles, newAngles );
newAngles[ ROLL ] = 0;
-
+
VectorCopy( self->s.origin, newOrigin );
VectorMA( newOrigin, 1.0f, self->s.origin2, newOrigin );
-
+
//prevent lerping
builder->client->ps.eFlags ^= EF_TELEPORT_BIT;
-
+
G_SetOrigin( builder, newOrigin );
VectorCopy( newOrigin, builder->client->ps.origin );
SetClientViewAngle( builder, newAngles );
-
+
//client leaves hovel
builder->client->ps.stats[ STAT_STATE ] &= ~SS_HOVELING;
}
-
+
self->r.contents = 0; //stop collisions...
trap_LinkEntity( self ); //...requires a relink
}
@@ -1248,10 +1260,10 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace )
{
int maxAmmo, maxClips;
gclient_t *client = other->client;
-
+
if( !self->spawned )
return;
-
+
if( !findOvermind( self ) )
return;
@@ -1260,15 +1272,15 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace )
if( client && client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
return;
-
+
//only allow boostage once every 30 seconds
if( client->lastBoostedTime + BOOSTER_INTERVAL > level.time )
return;
-
+
//restore ammo, if any
BG_FindAmmoForWeapon( client->ps.weapon, &maxAmmo, &maxClips );
BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips );
-
+
if( !( client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) )
{
client->ps.stats[ STAT_STATE ] |= SS_BOOSTED;
@@ -1295,7 +1307,7 @@ void ADef_FireOnEnemy( gentity_t *self, int firespeed, float range )
vec3_t halfAcceleration, thirdJerk;
float distanceToTarget = BG_FindRangeForBuildable( self->s.modelindex );
int i;
-
+
VectorScale( self->enemy->acceleration, 1.0f / 2.0f, halfAcceleration );
VectorScale( self->enemy->jerk, 1.0f / 3.0f, thirdJerk );
@@ -1308,7 +1320,7 @@ void ADef_FireOnEnemy( gentity_t *self, int firespeed, float range )
{
VectorSubtract( self->enemy->s.pos.trBase, self->s.pos.trBase, dirToTarget );
distanceToTarget = VectorLength( dirToTarget );
-
+
G_LogPrintf( "ADef_FireOnEnemy failed.\n"
" %dth iteration\n enemy location: %v\n"
" enemy accleration: %v\n enemy jerk: %v\n"
@@ -1316,9 +1328,9 @@ void ADef_FireOnEnemy( gentity_t *self, int firespeed, float range )
i, self->enemy->s.pos.trBase, self->enemy->acceleration,
self->enemy->jerk, self->s.pos.trBase, distanceToTarget );
- return;
+ return;
}
-
+
VectorMA( self->enemy->s.pos.trBase, time, self->enemy->s.pos.trDelta,
dirToTarget );
VectorMA( dirToTarget, time * time, halfAcceleration, dirToTarget );
@@ -1328,7 +1340,7 @@ void ADef_FireOnEnemy( gentity_t *self, int firespeed, float range )
distanceToTarget -= self->enemy->r.maxs[ 0 ];
}
-
+
VectorNormalize( dirToTarget );
vectoangles( dirToTarget, self->turretAim );
@@ -1400,7 +1412,7 @@ void ADef_FindEnemy( gentity_t *ent, int range )
//if target is not valid keep searching
if( !ADef_CheckTarget( ent, target, range ) )
continue;
-
+
//we found a target
ent->enemy = target;
return;
@@ -1442,7 +1454,7 @@ void ATrapper_Think( gentity_t *self )
//if a new target cannot be found don't do anything
if( !self->enemy )
return;
-
+
//if we are pointing at our target and we can fire shoot it
if( self->count < level.time )
ADef_FireOnEnemy( self, firespeed, range );
@@ -1480,7 +1492,7 @@ void HRepeater_Think( gentity_t *self )
reactor = qtrue;
}
}
-
+
if( G_NumberOfDependants( self ) == 0 )
{
//if no dependants for x seconds then disappear
@@ -1511,7 +1523,7 @@ void HRepeater_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
if( !self->spawned )
return;
-
+
G_GiveClientMaxAmmo( self, qtrue );
}
@@ -1535,7 +1547,7 @@ void HReactor_Think( gentity_t *self )
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
if( self->spawned && ( self->health > 0 ) )
{
//do some damage
@@ -1543,22 +1555,22 @@ void HReactor_Think( gentity_t *self )
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
self->timestamp = level.time;
G_SelectiveRadiusDamage( self->s.pos.trBase, self, REACTOR_ATTACK_DAMAGE,
REACTOR_ATTACK_RANGE, self, MOD_REACTOR, PTE_HUMANS );
-
+
tent = G_TempEntity( enemy->s.pos.trBase, EV_TESLATRAIL );
VectorCopy( self->s.pos.trBase, tent->s.origin2 );
-
+
tent->s.generic1 = self->s.number; //src
tent->s.clientNum = enemy->s.number; //dest
}
}
-
+
//reactor under attack
if( self->health < self->lastHealth &&
level.time > level.humanBaseAttackTimer && G_isDCC( ) )
@@ -1566,7 +1578,7 @@ void HReactor_Think( gentity_t *self )
level.humanBaseAttackTimer = level.time + DCC_ATTACK_PERIOD;
G_BroadcastEvent( EV_DCC_ATTACK, 0 );
}
-
+
self->lastHealth = self->health;
}
@@ -1591,7 +1603,7 @@ void HArmoury_Activate( gentity_t *self, gentity_t *other, gentity_t *activator
//only humans can activate this
if( activator->client->ps.stats[ STAT_PTEAM ] != PTE_HUMANS )
return;
-
+
//if this is powered then call the armoury menu
if( self->powered )
G_TriggerMenu( activator->client->ps.clientNum, MN_H_ARMOURY );
@@ -1611,7 +1623,7 @@ void HArmoury_Think( gentity_t *self )
{
//make sure we have power
self->nextthink = level.time + POWER_REFRESH_TIME;
-
+
self->powered = findPower( self );
}
@@ -1635,7 +1647,7 @@ void HDCC_Think( gentity_t *self )
{
//make sure we have power
self->nextthink = level.time + POWER_REFRESH_TIME;
-
+
self->powered = findPower( self );
}
@@ -1667,7 +1679,7 @@ void HMedistat_Think( gentity_t *self )
self->nextthink = level.time + POWER_REFRESH_TIME;
return;
}
-
+
if( self->spawned )
{
VectorAdd( self->s.origin, self->r.maxs, maxs );
@@ -1675,7 +1687,7 @@ void HMedistat_Think( gentity_t *self )
mins[ 2 ] += fabs( self->r.mins[ 2 ] ) + self->r.maxs[ 2 ];
maxs[ 2 ] += 60; //player height
-
+
//if active use the healing idle
if( self->active )
G_setIdleBuildableAnim( self, BANIM_IDLE2 );
@@ -1685,7 +1697,7 @@ void HMedistat_Think( gentity_t *self )
for( i = 0; i < num; i++ )
{
player = &g_entities[ entityList[ i ] ];
-
+
if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] &&
@@ -1698,19 +1710,19 @@ void HMedistat_Think( gentity_t *self )
if( !occupied )
{
self->enemy = NULL;
-
+
//look for something to heal
for( i = 0; i < num; i++ )
{
player = &g_entities[ entityList[ i ] ];
-
+
if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] &&
player->client->ps.pm_type != PM_DEAD )
{
self->enemy = player;
-
+
//start the heal anim
if( !self->active )
{
@@ -1729,17 +1741,17 @@ void HMedistat_Think( gentity_t *self )
{
G_setBuildableAnim( self, BANIM_CONSTRUCT2, qtrue );
G_setIdleBuildableAnim( self, BANIM_IDLE1 );
-
+
self->active = qfalse;
}
else if( self->enemy ) //heal!
{
if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_POISONED )
self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
-
+
if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE )
self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE;
-
+
self->enemy->health++;
//if they're completely healed, give them a medkit
@@ -1792,12 +1804,12 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
VectorSubtract( self->enemy->s.pos.trBase, self->s.pos.trBase, dirToTarget );
VectorNormalize( dirToTarget );
-
+
CrossProduct( self->s.origin2, refNormal, xNormal );
VectorNormalize( xNormal );
rotAngle = RAD2DEG( acos( DotProduct( self->s.origin2, refNormal ) ) );
RotatePointAroundVector( dttAdjusted, xNormal, dirToTarget, rotAngle );
-
+
vectoangles( dttAdjusted, angleToTarget );
angularDiff[ PITCH ] = AngleSubtract( self->s.angles2[ PITCH ], angleToTarget[ PITCH ] );
@@ -1815,10 +1827,10 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
temp = fabs( self->s.angles2[ PITCH ] );
if( temp > 180 )
temp -= 360;
-
+
if( temp < -MGTURRET_VERTICALCAP )
self->s.angles2[ PITCH ] = (-360) + MGTURRET_VERTICALCAP;
-
+
//if not pointing at our target then move accordingly
if( angularDiff[ YAW ] < (-accuracyTolerance) )
self->s.angles2[ YAW ] += angularSpeed;
@@ -1826,7 +1838,7 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
self->s.angles2[ YAW ] -= angularSpeed;
else
self->s.angles2[ YAW ] = angleToTarget[ YAW ];
-
+
AngleVectors( self->s.angles2, dttAdjusted, NULL, NULL );
RotatePointAroundVector( dirToTarget, xNormal, dttAdjusted, -rotAngle );
vectoangles( dirToTarget, self->turretAim );
@@ -1835,7 +1847,7 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
if( abs( angleToTarget[ YAW ] - self->s.angles2[ YAW ] ) <= accuracyTolerance &&
abs( angleToTarget[ PITCH ] - self->s.angles2[ PITCH ] ) <= accuracyTolerance )
return qtrue;
-
+
return qfalse;
}
@@ -1851,7 +1863,7 @@ qboolean HMGTurret_CheckTarget( gentity_t *self, gentity_t *target, qboolean ign
{
trace_t trace;
gentity_t *traceEnt;
-
+
if( !target )
return qfalse;
@@ -1860,10 +1872,10 @@ qboolean HMGTurret_CheckTarget( gentity_t *self, gentity_t *target, qboolean ign
if( target->client->ps.stats[ STAT_STATE ] & SS_HOVELING )
return qfalse;
-
+
if( target->health <= 0 )
return qfalse;
-
+
if( Distance( self->s.origin, target->s.pos.trBase ) > MGTURRET_RANGE )
return qfalse;
@@ -1872,7 +1884,7 @@ qboolean HMGTurret_CheckTarget( gentity_t *self, gentity_t *target, qboolean ign
return qfalse;
trap_Trace( &trace, self->s.pos.trBase, NULL, NULL, target->s.pos.trBase, self->s.number, MASK_SHOT );
-
+
traceEnt = &g_entities[ trace.entityNum ];
if( !traceEnt->client )
@@ -1903,19 +1915,19 @@ void HMGTurret_FindEnemy( gentity_t *self )
VectorSet( range, MGTURRET_RANGE, MGTURRET_RANGE, MGTURRET_RANGE );
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
//find aliens
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
target = &g_entities[ entityList[ i ] ];
-
+
if( target->client && target->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
//if target is not valid keep searching
if( !HMGTurret_CheckTarget( self, target, qfalse ) )
continue;
-
+
//we found a target
self->enemy = target;
return;
@@ -1928,20 +1940,20 @@ void HMGTurret_FindEnemy( gentity_t *self )
for( i = 0; i < num; i++ )
{
target = &g_entities[ entityList[ i ] ];
-
+
if( target->client && target->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
//if target is not valid keep searching
if( !HMGTurret_CheckTarget( self, target, qtrue ) )
continue;
-
+
//we found a target
self->enemy = target;
return;
}
}
}
-
+
//couldn't find a target
self->enemy = NULL;
}
@@ -1962,19 +1974,19 @@ void HMGTurret_Think( gentity_t *self )
//used for client side muzzle flashes
self->s.eFlags &= ~EF_FIRING;
-
+
//if not powered don't do anything and check again for power next think
if( !( self->powered = findPower( self ) ) )
{
self->nextthink = level.time + POWER_REFRESH_TIME;
return;
}
-
+
if( self->spawned )
{
//find a dcc for self
self->dcced = findDCC( self );
-
+
//if the current target is not valid find a new one
if( !HMGTurret_CheckTarget( self, self->enemy, qfalse ) )
{
@@ -1987,7 +1999,7 @@ void HMGTurret_Think( gentity_t *self )
//if a new target cannot be found don't do anything
if( !self->enemy )
return;
-
+
self->enemy->targeted = self;
//if we are pointing at our target and we can fire shoot it
@@ -1995,7 +2007,7 @@ void HMGTurret_Think( gentity_t *self )
{
//fire at target
FireWeapon( self );
-
+
self->s.eFlags |= EF_FIRING;
G_AddEvent( self, EV_FIRE_WEAPON, 0 );
G_setBuildableAnim( self, BANIM_ATTACK1, qfalse );
@@ -2038,22 +2050,22 @@ void HTeslaGen_Think( gentity_t *self )
self->nextthink = level.time + POWER_REFRESH_TIME;
return;
}
-
+
if( self->spawned && self->count < level.time )
{
//used to mark client side effects
self->s.eFlags &= ~EF_FIRING;
-
+
VectorSet( range, TESLAGEN_RANGE, TESLAGEN_RANGE, TESLAGEN_RANGE );
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
+
//find aliens
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS &&
enemy->health > 0 )
{
@@ -2107,7 +2119,7 @@ void HSpawn_Disappear( gentity_t *self )
self->think = freeBuildable;
self->nextthink = level.time + 100;
-
+
self->r.contents = 0; //stop collisions...
trap_LinkEntity( self ); //...requires a relink
}
@@ -2139,7 +2151,7 @@ void HSpawn_Blast( gentity_t *self )
self->think = freeBuildable;
self->nextthink = level.time + 100;
-
+
self->r.contents = 0; //stop collisions...
trap_LinkEntity( self ); //...requires a relink
}
@@ -2157,11 +2169,11 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//pretty events and cleanup
G_setBuildableAnim( self, BANIM_DESTROY1, qtrue );
G_setIdleBuildableAnim( self, BANIM_DESTROYED );
-
+
self->die = nullDieFunction;
self->powered = qfalse; //free up power
self->s.eFlags &= ~EF_FIRING; //prevent any firing effects
-
+
if( self->spawned )
{
self->think = HSpawn_Blast;
@@ -2201,7 +2213,8 @@ void HSpawn_Think( gentity_t *self )
//only suicide if at rest
if( self->s.groundEntityNum )
{
- if( ( ent = G_CheckSpawnPoint( self->s.origin, self->s.origin2, BA_H_SPAWN, NULL ) ) != NULL )
+ if( ( ent = G_CheckSpawnPoint( self->s.number, self->s.origin,
+ self->s.origin2, BA_H_SPAWN, NULL ) ) != NULL )
{
if( ent->s.eType == ET_BUILDABLE || ent->s.number == ENTITYNUM_WORLD ||
ent->s.eType == ET_MOVER )
@@ -2214,7 +2227,7 @@ void HSpawn_Think( gentity_t *self )
G_FreeEntity( ent ); //quietly remove
}
}
-
+
//spawn under attack
if( self->health < self->lastHealth &&
level.time > level.humanBaseAttackTimer && G_isDCC( ) )
@@ -2222,7 +2235,7 @@ void HSpawn_Think( gentity_t *self )
level.humanBaseAttackTimer = level.time + DCC_ATTACK_PERIOD;
G_BroadcastEvent( EV_DCC_ATTACK, 0 );
}
-
+
self->lastHealth = self->health;
}
@@ -2257,10 +2270,10 @@ void G_BuildableTouchTriggers( gentity_t *ent )
return;
BG_FindBBoxForBuildable( ent->s.modelindex, bmins, bmaxs );
-
+
VectorAdd( ent->s.origin, bmins, mins );
VectorAdd( ent->s.origin, bmaxs, maxs );
-
+
VectorSubtract( mins, range, mins );
VectorAdd( maxs, range, maxs );
@@ -2269,7 +2282,7 @@ void G_BuildableTouchTriggers( gentity_t *ent )
VectorAdd( ent->s.origin, bmins, mins );
VectorAdd( ent->s.origin, bmaxs, maxs );
- for( i = 0; i < num; i++ )
+ for( i = 0; i < num; i++ )
{
hit = &g_entities[ touch[ i ] ];
@@ -2282,7 +2295,7 @@ void G_BuildableTouchTriggers( gentity_t *ent )
//ignore buildables not yet spawned
if( !ent->spawned )
continue;
-
+
if( !trap_EntityContact( mins, maxs, hit ) )
continue;
@@ -2315,15 +2328,15 @@ void G_BuildableThink( gentity_t *ent, int msec )
if( ent->buildTime + bTime < level.time )
ent->spawned = qtrue;
}
-
+
ent->s.generic1 = (int)( ( (float)ent->health / (float)bHealth ) * B_HEALTH_SCALE );
if( ent->s.generic1 < 0 )
ent->s.generic1 = 0;
-
+
if( ent->powered )
ent->s.generic1 |= B_POWERED_TOGGLEBIT;
-
+
if( ent->dcced )
ent->s.generic1 |= B_DCCED_TOGGLEBIT;
@@ -2335,13 +2348,13 @@ void G_BuildableThink( gentity_t *ent, int msec )
if( ent->time1000 >= 1000 )
{
ent->time1000 -= 1000;
-
+
if( !ent->spawned )
ent->health += (int)( ceil( (float)bHealth / (float)( bTime * 0.001 ) ) );
else if( ent->biteam == BIT_ALIENS && ent->health > 0 && ent->health < bHealth &&
bRegen && ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time )
ent->health += bRegen;
-
+
if( ent->health > bHealth )
ent->health = bHealth;
}
@@ -2351,13 +2364,13 @@ void G_BuildableThink( gentity_t *ent, int msec )
if( ent->clientSpawnTime > 0 )
ent->clientSpawnTime -= msec;
-
+
if( ent->clientSpawnTime < 0 )
ent->clientSpawnTime = 0;
//check if this buildable is touching any triggers
G_BuildableTouchTriggers( ent );
-
+
//fall back on normal physics routines
G_Physics( ent, msec );
}
@@ -2377,19 +2390,19 @@ qboolean G_BuildableRange( vec3_t origin, float r, buildable_t buildable )
vec3_t mins, maxs;
int i, num;
gentity_t *ent;
-
+
VectorSet( range, r, r, r );
VectorAdd( origin, range, maxs );
VectorSubtract( origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
ent = &g_entities[ entityList[ i ] ];
-
+
if( ent->s.eType != ET_BUILDABLE )
continue;
-
+
if( ent->biteam == BIT_HUMANS && !ent->powered )
continue;
@@ -2423,7 +2436,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
playerState_t *ps = &ent->client->ps;
BG_FindBBoxForBuildable( buildable, mins, maxs );
-
+
BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, trap_Trace, entity_origin, angles, &tr1 );
trap_Trace( &tr2, entity_origin, mins, maxs, entity_origin, ent->s.number, MASK_PLAYERSOLID );
@@ -2434,7 +2447,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//this item does not fit here
if( tr2.fraction < 1.0 || tr3.fraction < 1.0 )
return IBE_NOROOM; //NO other reason is allowed to override this
-
+
VectorCopy( tr1.plane.normal, normal );
minNormal = BG_FindMinNormalForBuildable( buildable );
invert = BG_FindInvertNormalForBuildable( buildable );
@@ -2442,12 +2455,12 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//can we build at this angle?
if( !( normal[ 2 ] >= minNormal || ( invert && normal[ 2 ] <= -minNormal ) ) )
return IBE_NORMAL;
-
+
if( tr1.entityNum != ENTITYNUM_WORLD )
return IBE_NORMAL;
//check there is enough room to spawn from (presuming this is a spawn)
- if( G_CheckSpawnPoint( origin, normal, buildable, NULL ) != NULL )
+ if( G_CheckSpawnPoint( -1, origin, normal, buildable, NULL ) != NULL )
return IBE_NORMAL;
contents = trap_PointContents( entity_origin, -1 );
@@ -2459,21 +2472,21 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
if( buildable == BA_A_HOVEL )
{
vec3_t builderMins, builderMaxs;
-
+
//this assumes the adv builder is the biggest thing that'll use the hovel
BG_FindBBoxForClass( PCL_ALIEN_BUILDER0_UPG, builderMins, builderMaxs, NULL, NULL, NULL );
if( APropHovel_Blocked( angles, origin, normal, ent ) )
reason = IBE_HOVELEXIT;
}
-
+
//check there is creep near by for building on
if( BG_FindCreepTestForBuildable( buildable ) )
{
if( !isCreep( entity_origin ) )
reason = IBE_NOCREEP;
}
-
+
//check permission to build here
if( tr1.surfaceFlags & SURF_NOALIENBUILD || tr1.surfaceFlags & SURF_NOBUILD ||
contents & CONTENTS_NOALIENBUILD || contents & CONTENTS_NOBUILD )
@@ -2491,7 +2504,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//if none found...
if( i >= level.num_entities && buildable != BA_A_OVERMIND )
reason = IBE_NOOVERMIND;
-
+
//can we only have one of these?
if( BG_FindUniqueTestForBuildable( buildable ) )
{
@@ -2524,7 +2537,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//this buildable requires a DCC
if( BG_FindDCCTestForBuildable( buildable ) && !G_isDCC( ) )
reason = IBE_NODCC;
-
+
//check that there is a parent reactor when building a repeater
if( buildable == BA_H_REPEATER )
{
@@ -2533,16 +2546,16 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
if( tempent->s.eType != ET_BUILDABLE )
continue;
- if( tempent->s.modelindex == BA_H_REACTOR )
+ if( tempent->s.modelindex == BA_H_REACTOR )
break;
}
-
+
if( i >= level.num_entities )
reason = IBE_RPTWARN;
else if( G_isPower( entity_origin ) )
reason = IBE_RPTWARN2;
}
-
+
//check permission to build here
if( tr1.surfaceFlags & SURF_NOHUMANBUILD || tr1.surfaceFlags & SURF_NOBUILD ||
contents & CONTENTS_NOHUMANBUILD || contents & CONTENTS_NOBUILD )
@@ -2556,7 +2569,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
if( tempent->s.eType != ET_BUILDABLE )
continue;
- if( tempent->s.modelindex == BA_H_REACTOR )
+ if( tempent->s.modelindex == BA_H_REACTOR )
{
reason = IBE_REACTOR;
break;
@@ -2590,19 +2603,19 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
built->s.eType = ET_BUILDABLE;
built->classname = BG_FindEntityNameForBuildable( buildable );
-
+
built->s.modelindex = buildable; //so we can tell what this is on the client side
built->biteam = built->s.modelindex2 = BG_FindTeamForBuildable( buildable );
BG_FindBBoxForBuildable( buildable, built->r.mins, built->r.maxs );
built->health = 1;
-
+
built->splashDamage = BG_FindSplashDamageForBuildable( buildable );
built->splashRadius = BG_FindSplashRadiusForBuildable( buildable );
built->splashMethodOfDeath = BG_FindMODForBuildable( buildable );
-
+
built->nextthink = BG_FindNextThinkForBuildable( buildable );
-
+
built->takedamage = qtrue;
built->spawned = qfalse;
built->buildTime = built->s.time = level.time;
@@ -2615,96 +2628,96 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
built->think = ASpawn_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_A_BARRICADE:
built->die = ABarricade_Die;
built->think = ABarricade_Think;
built->pain = ABarricade_Pain;
break;
-
+
case BA_A_BOOSTER:
built->die = ABarricade_Die;
built->think = ABarricade_Think;
built->pain = ABarricade_Pain;
built->touch = ABooster_Touch;
break;
-
+
case BA_A_ACIDTUBE:
built->die = ABarricade_Die;
built->think = AAcidTube_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_A_HIVE:
built->die = ABarricade_Die;
built->think = AHive_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_A_TRAPPER:
built->die = ABarricade_Die;
built->think = ATrapper_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_A_OVERMIND:
built->die = ASpawn_Die;
built->think = AOvermind_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_A_HOVEL:
built->die = AHovel_Die;
built->use = AHovel_Use;
built->think = AHovel_Think;
built->pain = ASpawn_Pain;
break;
-
+
case BA_H_SPAWN:
built->die = HSpawn_Die;
built->think = HSpawn_Think;
break;
-
+
case BA_H_MGTURRET:
built->die = HSpawn_Die;
built->think = HMGTurret_Think;
break;
-
+
case BA_H_TESLAGEN:
built->die = HSpawn_Die;
built->think = HTeslaGen_Think;
break;
-
+
case BA_H_ARMOURY:
built->think = HArmoury_Think;
built->die = HSpawn_Die;
built->use = HArmoury_Activate;
break;
-
+
case BA_H_DCC:
built->think = HDCC_Think;
built->die = HSpawn_Die;
break;
-
+
case BA_H_MEDISTAT:
built->think = HMedistat_Think;
built->die = HSpawn_Die;
break;
-
+
case BA_H_REACTOR:
built->think = HReactor_Think;
built->die = HSpawn_Die;
built->use = HRepeater_Use;
built->powered = built->active = qtrue;
break;
-
+
case BA_H_REPEATER:
built->think = HRepeater_Think;
built->die = HSpawn_Die;
built->use = HRepeater_Use;
built->count = -1;
break;
-
+
default:
//erk
break;
@@ -2729,14 +2742,14 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
built->s.pos.trTime = level.time;
built->physicsBounce = BG_FindBounceForBuildable( buildable );
built->s.groundEntityNum = -1;
-
+
if( builder->client && builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING )
{
if( builder->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
VectorSet( normal, 0.0f, 0.0f, -1.0f );
else
VectorCopy( builder->client->ps.grapplePoint, normal );
-
+
//gently nudge the buildable onto the surface :)
VectorScale( normal, -50.0f, built->s.pos.trDelta );
}
@@ -2748,21 +2761,21 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
if( built->s.generic1 < 0 )
built->s.generic1 = 0;
-
+
if( ( built->powered = findPower( built ) ) )
built->s.generic1 |= B_POWERED_TOGGLEBIT;
-
+
if( ( built->dcced = findDCC( built ) ) )
built->s.generic1 |= B_DCCED_TOGGLEBIT;
-
+
built->s.generic1 &= ~B_SPAWNED_TOGGLEBIT;
VectorCopy( normal, built->s.origin2 );
-
+
G_AddEvent( built, EV_BUILD_CONSTRUCT, 0 );
G_setIdleBuildableAnim( built, BG_FindAnimForBuildable( buildable ) );
-
+
if( built->builtBy >= 0 )
G_setBuildableAnim( built, BANIM_CONSTRUCT1, qtrue );
@@ -2782,7 +2795,7 @@ qboolean G_ValidateBuild( gentity_t *ent, buildable_t buildable )
vec3_t origin;
dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
-
+
switch( G_itemFits( ent, buildable, dist, origin ) )
{
case IBE_NONE:
@@ -2841,21 +2854,21 @@ qboolean G_ValidateBuild( gentity_t *ent, buildable_t buildable )
case IBE_NOPOWER:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
return qfalse;
-
+
case IBE_NODCC:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NODCC );
return qfalse;
-
+
case IBE_SPWNWARN:
G_TriggerMenu( ent->client->ps.clientNum, MN_A_SPWNWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
-
+
case IBE_TNODEWARN:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_TNODEWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
-
+
case IBE_RPTWARN:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTWARN );
G_buildItem( ent, buildable, origin, ent->s.apos.trBase );
@@ -2894,7 +2907,7 @@ void FinishSpawningBuildable( gentity_t *ent )
built->spawned = qtrue; //map entities are already spawned
built->health = BG_FindHealthForBuildable( buildable );
built->s.generic1 |= B_SPAWNED_TOGGLEBIT;
-
+
// drop to floor
if( buildable != BA_NONE && BG_FindTrajectoryForBuildable( buildable ) == TR_BUOYANCY )
VectorSet( dest, built->s.origin[ 0 ], built->s.origin[ 1 ], built->s.origin[ 2 ] + 4096 );
@@ -2902,7 +2915,7 @@ void FinishSpawningBuildable( gentity_t *ent )
VectorSet( dest, built->s.origin[ 0 ], built->s.origin[ 1 ], built->s.origin[ 2 ] - 4096 );
trap_Trace( &tr, built->s.origin, built->r.mins, built->r.maxs, dest, built->s.number, built->clipmask );
-
+
if( tr.startsolid )
{
G_Printf( S_COLOR_YELLOW "FinishSpawningBuildable: %s startsolid at %s\n", built->classname, vtos( built->s.origin ) );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index d137b9bb..d8fb60a9 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -13,7 +13,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "g_local.h"
// g_client.c -- client functions that don't happen every frame
@@ -33,7 +33,7 @@ void SP_info_player_deathmatch( gentity_t *ent )
int i;
G_SpawnInt( "nobots", "0", &i);
-
+
if( i )
ent->flags |= FL_NO_BOTS;
@@ -98,9 +98,9 @@ void G_AddCreditToClient( gclient_t *client, short credit, qboolean cap )
return;
}
}
-
+
client->ps.persistant[ PERS_CREDIT ] += credit;
-
+
if( cap )
{
if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
@@ -114,7 +114,7 @@ void G_AddCreditToClient( gclient_t *client, short credit, qboolean cap )
client->ps.persistant[ PERS_CREDIT ] = HUMAN_MAX_CREDITS;
}
}
-
+
if( client->ps.persistant[ PERS_CREDIT ] < 0 )
client->ps.persistant[ PERS_CREDIT ] = 0;
}
@@ -179,7 +179,7 @@ gentity_t *SelectNearestDeathmatchSpawnPoint( vec3_t from )
{
VectorSubtract( spot->s.origin, from, delta );
dist = VectorLength( delta );
-
+
if( dist < nearestDist )
{
nearestDist = dist;
@@ -252,31 +252,31 @@ gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, ve
VectorSubtract( spot->s.origin, avoidPoint, delta );
dist = VectorLength( delta );
-
+
for( i = 0; i < numSpots; i++ )
{
if( dist > list_dist[ i ] )
{
if( numSpots >= 64 )
numSpots = 64 - 1;
-
+
for( j = numSpots; j > i; j-- )
{
list_dist[ j ] = list_dist[ j - 1 ];
list_spot[ j ] = list_spot[ j - 1 ];
}
-
+
list_dist[ i ] = dist;
list_spot[ i ] = spot;
numSpots++;
-
+
if( numSpots > 64 )
numSpots = 64;
-
+
break;
}
}
-
+
if( i >= numSpots && numSpots < 64 )
{
list_dist[ numSpots ] = dist;
@@ -284,14 +284,14 @@ gentity_t *SelectRandomFurthestSpawnPoint ( vec3_t avoidPoint, vec3_t origin, ve
numSpots++;
}
}
-
+
if( !numSpots )
{
spot = G_Find( NULL, FOFS( classname ), "info_player_deathmatch" );
-
+
if( !spot )
G_Error( "Couldn't find a spawn point" );
-
+
VectorCopy( spot->s.origin, origin );
origin[ 2 ] += 9;
VectorCopy( spot->s.angles, angles );
@@ -324,7 +324,7 @@ gentity_t *SelectAlienSpawnPoint( vec3_t preference )
if( level.numAlienSpawns <= 0 )
return NULL;
-
+
count = 0;
spot = NULL;
@@ -333,7 +333,7 @@ gentity_t *SelectAlienSpawnPoint( vec3_t preference )
{
if( !spot->spawned )
continue;
-
+
if( spot->health <= 0 )
continue;
@@ -342,10 +342,11 @@ gentity_t *SelectAlienSpawnPoint( vec3_t preference )
if( spot->clientSpawnTime > 0 )
continue;
-
- if( G_CheckSpawnPoint( spot->s.origin, spot->s.origin2, BA_A_SPAWN, NULL ) != NULL )
+
+ if( G_CheckSpawnPoint( spot->s.number, spot->s.origin,
+ spot->s.origin2, BA_A_SPAWN, NULL ) != NULL )
continue;
-
+
spots[ count ] = spot;
count++;
}
@@ -372,7 +373,7 @@ gentity_t *SelectHumanSpawnPoint( vec3_t preference )
if( level.numHumanSpawns <= 0 )
return NULL;
-
+
count = 0;
spot = NULL;
@@ -381,7 +382,7 @@ gentity_t *SelectHumanSpawnPoint( vec3_t preference )
{
if( !spot->spawned )
continue;
-
+
if( spot->health <= 0 )
continue;
@@ -390,10 +391,11 @@ gentity_t *SelectHumanSpawnPoint( vec3_t preference )
if( spot->clientSpawnTime > 0 )
continue;
-
- if( G_CheckSpawnPoint( spot->s.origin, spot->s.origin2, BA_H_SPAWN, NULL ) != NULL )
+
+ if( G_CheckSpawnPoint( spot->s.number, spot->s.origin,
+ spot->s.origin2, BA_H_SPAWN, NULL ) != NULL )
continue;
-
+
spots[ count ] = spot;
count++;
}
@@ -439,15 +441,15 @@ gentity_t *SelectTremulousSpawnPoint( pTeam_t team, vec3_t preference, vec3_t or
return NULL;
if( team == PTE_ALIENS )
- G_CheckSpawnPoint( spot->s.origin, spot->s.origin2, BA_A_SPAWN, origin );
+ G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_A_SPAWN, origin );
else if( team == PTE_HUMANS )
- G_CheckSpawnPoint( spot->s.origin, spot->s.origin2, BA_H_SPAWN, origin );
+ G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_H_SPAWN, origin );
VectorCopy( spot->s.angles, angles );
angles[ ROLL ] = 0;
return spot;
-
+
}
@@ -571,18 +573,18 @@ void BodySink( gentity_t *ent )
if( !ent->active )
{
ent->active = qtrue;
-
+
//sinking bodies can't be infested
ent->killedBy = ent->s.powerups = MAX_CLIENTS;
ent->timestamp = level.time;
}
-
+
if( level.time - ent->timestamp > 6500 )
{
G_FreeEntity( ent );
return;
}
-
+
ent->nextthink = level.time + 100;
ent->s.pos.trBase[ 2 ] -= 1;
}
@@ -629,7 +631,7 @@ void SpawnCorpse( gentity_t *ent )
contents = trap_PointContents( origin, -1 );
if( contents & CONTENTS_NODROP )
return;
-
+
body = G_Spawn( );
VectorCopy( ent->s.apos.trBase, body->s.angles );
@@ -639,10 +641,9 @@ void SpawnCorpse( gentity_t *ent )
body->timestamp = level.time;
body->s.event = 0;
body->r.contents = CONTENTS_CORPSE;
- body->clipmask = MASK_DEADSOLID;
body->s.clientNum = ent->client->ps.stats[ STAT_PCLASS ];
body->nonSegModel = ent->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL;
-
+
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
body->classname = "humanCorpse";
else
@@ -651,8 +652,8 @@ void SpawnCorpse( gentity_t *ent )
body->s.powerups = MAX_CLIENTS;
body->think = BodySink;
- body->nextthink = level.time + 60000;
-
+ body->nextthink = level.time + 20000;
+
body->s.legsAnim = ent->s.legsAnim;
if( !body->nonSegModel )
@@ -698,11 +699,11 @@ void SpawnCorpse( gentity_t *ent )
body->health = ent->health = ent->client->ps.stats[ STAT_HEALTH ];
ent->health = 0;
-
+
//change body dimensions
BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );
vDiff = body->r.mins[ 2 ] - ent->r.mins[ 2 ];
-
+
//drop down to match the *model* origins of ent and body
VectorSet( dest, origin[ 0 ], origin[ 1 ], origin[ 2 ] - vDiff );
trap_Trace( &tr, origin, body->r.mins, body->r.maxs, dest, body->s.number, body->clipmask );
@@ -713,7 +714,7 @@ void SpawnCorpse( gentity_t *ent )
body->s.pos.trType = TR_GRAVITY;
body->s.pos.trTime = level.time;
VectorCopy( ent->client->ps.velocity, body->s.pos.trDelta );
-
+
VectorCopy ( body->s.pos.trBase, body->r.currentOrigin );
trap_LinkEntity( body );
}
@@ -739,7 +740,7 @@ void SetClientViewAngle( gentity_t *ent, vec3_t angle )
cmdAngle = ANGLE2SHORT( angle[ i ] );
ent->client->ps.delta_angles[ i ] = cmdAngle - ent->client->pers.cmd.angles[ i ];
}
-
+
VectorCopy( angle, ent->s.angles );
VectorCopy( ent->s.angles, ent->client->ps.viewangles );
}
@@ -755,12 +756,6 @@ void respawn( gentity_t *ent )
//TA: Clients can't respawn - they must go thru the class cmd
ClientSpawn( ent, NULL, NULL, NULL );
-
- //FIXME: need different spawn effects for different teams
-
- // add a teleportation effect
- //tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN );
- //tent->s.clientNum = ent->s.clientNum;
}
/*
@@ -863,7 +858,7 @@ static void ClientCleanName( const char *in, char *out, int outSize )
colorlessLen++;
len++;
}
-
+
*out = 0;
// don't allow empty names
@@ -894,7 +889,7 @@ static qboolean G_NonSegModel( const char *filename )
G_Printf( "File not found: %s\n", filename );
return qfalse;
}
-
+
if( len <= 0 )
return qfalse;
@@ -903,7 +898,7 @@ static qboolean G_NonSegModel( const char *filename )
G_Printf( "File %s too long\n", filename );
return qfalse;
}
-
+
trap_FS_Read( text, len, f );
text[ len ] = 0;
trap_FS_FCloseFile( f );
@@ -915,7 +910,7 @@ static qboolean G_NonSegModel( const char *filename )
while( 1 )
{
token = COM_Parse( &text_p );
-
+
//EOF
if( !token[ 0 ] )
break;
@@ -966,13 +961,13 @@ void ClientUserinfoChanged( int clientNum )
// check for local client
s = Info_ValueForKey( userinfo, "ip" );
-
+
if( !strcmp( s, "localhost" ) )
client->pers.localClient = qtrue;
// check the item prediction
s = Info_ValueForKey( userinfo, "cg_predictItems" );
-
+
if( !atoi( s ) )
client->pers.predictItemPickup = qfalse;
else
@@ -1001,7 +996,7 @@ void ClientUserinfoChanged( int clientNum )
// set max health
health = atoi( Info_ValueForKey( userinfo, "handicap" ) );
client->pers.maxHealth = health;
-
+
if( client->pers.maxHealth < 1 || client->pers.maxHealth > 100 )
client->pers.maxHealth = 100;
@@ -1046,7 +1041,7 @@ void ClientUserinfoChanged( int clientNum )
// wallwalk follow
s = Info_ValueForKey( userinfo, "cg_wwFollow" );
-
+
if( atoi( s ) )
client->ps.persistant[ PERS_STATE ] |= PS_WALLCLIMBINGFOLLOW;
else
@@ -1054,7 +1049,7 @@ void ClientUserinfoChanged( int clientNum )
// wallwalk toggle
s = Info_ValueForKey( userinfo, "cg_wwToggle" );
-
+
if( atoi( s ) )
client->ps.persistant[ PERS_STATE ] |= PS_WALLCLIMBINGTOGGLE;
else
@@ -1062,7 +1057,7 @@ void ClientUserinfoChanged( int clientNum )
// teamInfo
s = Info_ValueForKey( userinfo, "teamoverlay" );
-
+
if( ! *s || atoi( s ) != 0 )
client->pers.teamInfo = qtrue;
else
@@ -1083,7 +1078,7 @@ void ClientUserinfoChanged( int clientNum )
team = PTE_NONE;
else
team = client->ps.stats[ STAT_PTEAM ];
-
+
// send over a subset of the userinfo keys so other clients can
// print scoreboards, display models, and play custom sounds
s = va( "n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d",
@@ -1137,7 +1132,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot )
// check for a password
value = Info_ValueForKey( userinfo, "password" );
-
+
if( g_password.string[ 0 ] && Q_stricmp( g_password.string, "none" ) &&
strcmp( g_password.string, value ) != 0 )
return "Invalid password";
@@ -1221,14 +1216,14 @@ void ClientBegin( int clientNum )
tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN );
tent->s.clientNum = ent->s.clientNum;
}
-
+
G_InitCommandQueue( clientNum );
G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) );
// request the clients PTR code
G_SendCommandFromServer( ent - g_entities, "ptrcrequest" );
-
+
G_LogPrintf( "ClientBegin: %i\n", clientNum );
// count current clients and rank for scoreboard
@@ -1262,7 +1257,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
vec3_t up = { 0.0f, 0.0f, 1.0f };
int maxAmmo, maxClips;
weapon_t weapon;
-
+
index = ent - g_entities;
client = ent->client;
@@ -1283,10 +1278,10 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
if( origin != NULL )
VectorCopy( origin, spawn_origin );
-
+
if( angles != NULL )
VectorCopy( angles, spawn_angles );
-
+
// find a spawn point
// do it before setting health back up, so farthest
// ranging doesn't count this client
@@ -1308,7 +1303,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
}
spawnPoint = spawn;
-
+
if( ent != spawn )
{
//start spawn animation on spawnPoint
@@ -1331,21 +1326,21 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
saved = client->pers;
savedSess = client->sess;
savedPing = client->ps.ping;
-
+
for( i = 0; i < MAX_PERSISTANT; i++ )
persistant[ i ] = client->ps.persistant[ i ];
-
+
eventSequence = client->ps.eventSequence;
memset( client, 0, sizeof( *client ) );
-
+
client->pers = saved;
client->sess = savedSess;
client->ps.ping = savedPing;
client->lastkilled_client = -1;
-
+
for( i = 0; i < MAX_PERSISTANT; i++ )
client->ps.persistant[ i ] = persistant[ i ];
-
+
client->ps.eventSequence = eventSequence;
// increment the spawncount so the client will detect the respawn
@@ -1380,7 +1375,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->ps.eFlags = flags;
client->ps.clientNum = index;
-
+
BG_FindBBoxForClass( ent->client->pers.classSelection, ent->r.mins, ent->r.maxs, NULL, NULL, NULL );
if( client->sess.sessionTeam != TEAM_SPECTATOR )
@@ -1400,21 +1395,21 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
weapon = BG_FindStartWeaponForClass( ent->client->pers.classSelection );
else
weapon = WP_NONE;
-
+
BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
BG_AddWeaponToInventory( weapon, client->ps.stats );
BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips );
ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.classSelection;
ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.teamSelection;
-
+
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
ent->client->ps.stats[ STAT_STATE ] = 0;
VectorSet( ent->client->ps.grapplePoint, 0.0f, 0.0f, 1.0f );
// health will count down towards max_health
ent->health = client->ps.stats[ STAT_HEALTH ] = client->ps.stats[ STAT_MAX_HEALTH ]; //* 1.25;
-
+
//if evolving scale health
if( ent == spawn )
{
@@ -1425,9 +1420,9 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
//clear the credits array
for( i = 0; i < MAX_CLIENTS; i++ )
ent->credits[ i ] = 0;
-
+
client->ps.stats[ STAT_STAMINA ] = MAX_STAMINA;
-
+
G_SetOrigin( ent, spawn_origin );
VectorCopy( spawn_origin, client->ps.origin );
@@ -1447,11 +1442,11 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
{
spawn_angles[ YAW ] += 180.0f;
AngleNormalize360( spawn_angles[ YAW ] );
-
+
if( spawnPoint->s.origin2[ 2 ] > 0.0f )
{
vec3_t forward, dir;
-
+
AngleVectors( spawn_angles, forward, NULL, NULL );
VectorScale( forward, F_VEL, forward );
VectorAdd( spawnPoint->s.origin2, forward, dir );
@@ -1459,7 +1454,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
VectorScale( dir, UP_VEL, client->ps.velocity );
}
-
+
G_AddPredictableEvent( ent, EV_PLAYER_RESPAWN, 0 );
}
}
@@ -1511,7 +1506,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
// select the highest weapon number available, after any
// spawn given items have fired
client->ps.weapon = 1;
-
+
for( i = WP_NUM_WEAPONS - 1; i > 0 ; i-- )
{
if( BG_InventoryContainsWeapon( i, client->ps.stats ) )
@@ -1566,7 +1561,7 @@ void ClientDisconnect( int clientNum )
int i;
ent = g_entities + clientNum;
-
+
if( !ent->client )
return;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 5a6e516e..606d1875 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -13,7 +13,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "g_local.h"
/*
@@ -32,13 +32,13 @@ void G_SanitiseName( char *in, char *out )
in += 2; // skip color code
continue;
}
-
+
if( *in < 32 )
{
in++;
continue;
}
-
+
*out++ = tolower( *in++ );
}
@@ -64,7 +64,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s )
if( s[ 0 ] >= '0' && s[ 0 ] <= '9' )
{
idnum = atoi( s );
-
+
if( idnum < 0 || idnum >= level.maxclients )
{
G_SendCommandFromServer( to - g_entities, va( "print \"Bad client slot: %i\n\"", idnum ) );
@@ -72,26 +72,26 @@ int G_ClientNumberFromString( gentity_t *to, char *s )
}
cl = &level.clients[ idnum ];
-
+
if( cl->pers.connected != CON_CONNECTED )
{
G_SendCommandFromServer( to - g_entities, va( "print \"Client %i is not active\n\"", idnum ) );
return -1;
}
-
+
return idnum;
}
// check for a name match
G_SanitiseName( s, s2 );
-
+
for( idnum = 0, cl = level.clients; idnum < level.maxclients; idnum++, cl++ )
{
if( cl->pers.connected != CON_CONNECTED )
continue;
-
+
G_SanitiseName( cl->pers.netname, n2 );
-
+
if( !strcmp( n2, s2 ) )
return idnum;
}
@@ -137,7 +137,7 @@ void ScoreboardMessage( gentity_t *ent )
if( cl->ps.stats[ STAT_HEALTH ] > 0 )
{
weapon = cl->ps.weapon;
-
+
if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, cl->ps.stats ) )
upgrade = UP_BATTLESUIT;
else if( BG_InventoryContainsUpgrade( UP_JETPACK, cl->ps.stats ) )
@@ -156,16 +156,16 @@ void ScoreboardMessage( gentity_t *ent )
weapon = WP_NONE;
upgrade = UP_NONE;
}
-
+
Com_sprintf( entry, sizeof( entry ),
" %d %d %d %d %d %d", level.sortedClients[ i ], cl->ps.persistant[ PERS_SCORE ],
ping, ( level.time - cl->pers.enterTime ) / 60000, weapon, upgrade );
-
+
j = strlen( entry );
-
+
if( stringlength + j > 1024 )
break;
-
+
strcpy( string + stringlength, entry );
stringlength += j;
}
@@ -201,11 +201,11 @@ qboolean CheatsOk( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) );
return qfalse;
}
-
+
if( ent->health <= 0 )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"You must be alive to use this command\n\"" ) );
- return qfalse;
+ return qfalse;
}
return qtrue;
@@ -226,18 +226,18 @@ char *ConcatArgs( int start )
len = 0;
c = trap_Argc( );
-
+
for( i = start; i < c; i++ )
{
trap_Argv( i, arg, sizeof( arg ) );
tlen = strlen( arg );
-
+
if( len + tlen >= MAX_STRING_CHARS - 1 )
break;
memcpy( line + len, arg, tlen );
len += tlen;
-
+
if( i != c - 1 )
{
line[ len ] = ' ';
@@ -312,7 +312,7 @@ void Cmd_God_f( gentity_t *ent )
return;
ent->flags ^= FL_GODMODE;
-
+
if( !( ent->flags & FL_GODMODE ) )
msg = "godmode OFF\n";
else
@@ -339,7 +339,7 @@ void Cmd_Notarget_f( gentity_t *ent )
return;
ent->flags ^= FL_NOTARGET;
-
+
if( !( ent->flags & FL_NOTARGET ) )
msg = "notarget OFF\n";
else
@@ -405,16 +405,16 @@ void Cmd_Kill_f( gentity_t *ent )
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
return;
-
+
if( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING )
return;
-
+
if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING )
{
G_SendCommandFromServer( ent-g_entities, "print \"Leave the hovel first (use your destroy key)\n\"" );
return;
}
-
+
if( ent->health <= 0 )
return;
@@ -457,13 +457,13 @@ void G_ChangeTeam( gentity_t *ent, pTeam_t newTeam )
G_RemoveFromSpawnQueue( &level.alienSpawnQueue, ent->client->ps.clientNum );
else if( oldTeam == PTE_HUMANS )
G_RemoveFromSpawnQueue( &level.humanSpawnQueue, ent->client->ps.clientNum );
-
+
level.bankCredits[ ent->client->ps.clientNum ] = 0;
ent->client->ps.persistant[ PERS_CREDIT ] = 0;
ent->client->pers.classSelection = PCL_NONE;
ClientSpawn( ent, NULL, NULL, NULL );
}
-
+
ent->client->pers.joinedATeam = qtrue;
//update ClientInfo
@@ -497,7 +497,7 @@ void Cmd_Team_f( gentity_t *ent )
G_TriggerMenu( ent->client->ps.clientNum, MN_A_TEAMFULL );
return;
}
-
+
team = PTE_ALIENS;
}
else if( !Q_stricmp( s, "humans" ) )
@@ -507,7 +507,7 @@ void Cmd_Team_f( gentity_t *ent )
G_TriggerMenu( ent->client->ps.clientNum, MN_H_TEAMFULL );
return;
}
-
+
team = PTE_HUMANS;
}
else if( !Q_stricmp( s, "auto" ) )
@@ -526,7 +526,7 @@ void Cmd_Team_f( gentity_t *ent )
}
G_ChangeTeam( ent, team );
-
+
if( team == PTE_ALIENS )
G_SendCommandFromServer( -1, va( "print \"%s" S_COLOR_WHITE " joined the aliens\n\"", ent->client->pers.netname ) );
else if( team == PTE_HUMANS )
@@ -543,13 +543,13 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons
{
if( !other )
return;
-
+
if( !other->inuse )
return;
-
+
if( !other->client )
return;
-
+
if( other->client->pers.connected != CON_CONNECTED )
return;
@@ -582,20 +582,20 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
Q_COLOR_ESCAPE, COLOR_WHITE );
color = COLOR_GREEN;
break;
-
+
case SAY_TEAM:
G_LogPrintf( "sayteam: %s: %s\n", ent->client->pers.netname, chatText );
if( Team_GetLocationMsg( ent, location, sizeof( location ) ) )
- Com_sprintf( name, sizeof( name ), EC"(%s%c%c"EC") (%s)"EC": ",
+ Com_sprintf( name, sizeof( name ), EC"(%s%c%c"EC") (%s)"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );
else
- Com_sprintf( name, sizeof( name ), EC"(%s%c%c"EC")"EC": ",
+ Com_sprintf( name, sizeof( name ), EC"(%s%c%c"EC")"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
color = COLOR_CYAN;
break;
-
+
case SAY_TELL:
- if( target &&
+ if( target &&
target->client->ps.stats[ STAT_PTEAM ] == ent->client->ps.stats[ STAT_PTEAM ] &&
Team_GetLocationMsg( ent, location, sizeof( location ) ) )
Com_sprintf( name, sizeof( name ), EC"[%s%c%c"EC"] (%s)"EC": ",
@@ -665,7 +665,7 @@ static void Cmd_Tell_f( gentity_t *ent )
trap_Argv( 1, arg, sizeof( arg ) );
targetNum = atoi( arg );
-
+
if( targetNum < 0 || targetNum >= level.maxclients )
return;
@@ -715,13 +715,13 @@ void Cmd_CallVote_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, "print \"A vote is already in progress\n\"" );
return;
}
-
+
if( ent->client->pers.voteCount >= MAX_VOTE_COUNT )
{
G_SendCommandFromServer( ent-g_entities, "print \"You have called the maximum number of votes\n\"" );
return;
}
-
+
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
{
G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" );
@@ -767,7 +767,7 @@ void Cmd_CallVote_f( gentity_t *ent )
char s[ MAX_STRING_CHARS ];
trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof( s ) );
-
+
if( *s )
Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s; set nextmap \"%s\"", arg1, arg2, s );
else
@@ -780,13 +780,13 @@ void Cmd_CallVote_f( gentity_t *ent )
char s[ MAX_STRING_CHARS ];
trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof( s ) );
-
+
if( !*s )
{
G_SendCommandFromServer( ent-g_entities, "print \"nextmap not set\n\"" );
return;
}
-
+
Com_sprintf( level.voteString, sizeof( level.voteString ), "vstr nextmap" );
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
}
@@ -828,7 +828,7 @@ void Cmd_Vote_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, "print \"No vote in progress\n\"" );
return;
}
-
+
if( ent->client->ps.eFlags & EF_VOTED )
{
G_SendCommandFromServer( ent-g_entities, "print \"Vote already cast\n\"" );
@@ -874,7 +874,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
char arg2[ MAX_STRING_TOKENS ];
team = ent->client->ps.stats[ STAT_PTEAM ];
-
+
if( team == PTE_HUMANS )
cs_offset = 0;
else if( team == PTE_ALIENS )
@@ -893,13 +893,13 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, "print \"A team vote is already in progress\n\"" );
return;
}
-
+
if( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT )
{
G_SendCommandFromServer( ent-g_entities, "print \"You have called the maximum number of team votes\n\"" );
return;
}
-
+
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
{
G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to call a vote as spectator\n\"" );
@@ -909,7 +909,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
// make sure it is a valid command to vote on
trap_Argv( 1, arg1, sizeof( arg1 ) );
trap_Argv( 2, arg2, sizeof( arg2 ) );
-
+
if( strchr( arg1, ';' ) || strchr( arg2, ';' ) )
{
G_SendCommandFromServer( ent-g_entities, "print \"Invalid team vote string\n\"" );
@@ -922,22 +922,22 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
Q_strncpyz( kickee, arg2, sizeof( kickee ) );
Q_CleanStr( kickee );
-
+
for( i = 0; i < level.maxclients; i++ )
{
if( level.clients[ i ].pers.connected == CON_DISCONNECTED )
continue;
-
+
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] != team )
continue;
-
+
Q_strncpyz( netname, level.clients[ i ].pers.netname, sizeof( netname ) );
Q_CleanStr( netname );
-
+
if( !Q_stricmp( netname, kickee ) )
break;
}
-
+
if( i >= level.maxclients )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"%s is not a valid player on your team\n\"", arg2 ) );
@@ -958,7 +958,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
{
if( level.clients[ i ].pers.connected == CON_DISCONNECTED )
continue;
-
+
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team )
G_SendCommandFromServer( i, va("print \"%s called a team vote\n\"", ent->client->pers.netname ) );
}
@@ -973,7 +973,7 @@ void Cmd_CallTeamVote_f( gentity_t *ent )
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == team )
level.clients[ i ].ps.eFlags &= ~EF_TEAMVOTED;
}
-
+
ent->client->ps.eFlags |= EF_TEAMVOTED;
trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, va( "%i", level.teamVoteTime[ cs_offset ] ) );
@@ -1006,13 +1006,13 @@ void Cmd_TeamVote_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, "print \"No team vote in progress\n\"" );
return;
}
-
+
if( ent->client->ps.eFlags & EF_TEAMVOTED )
{
G_SendCommandFromServer( ent-g_entities, "print \"Team vote already cast\n\"" );
return;
}
-
+
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_NONE )
{
G_SendCommandFromServer( ent-g_entities, "print \"Not allowed to vote as spectator\n\"" );
@@ -1033,7 +1033,7 @@ void Cmd_TeamVote_f( gentity_t *ent )
else
{
level.teamVoteNo[ cs_offset ]++;
- trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) );
+ trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va( "%i", level.teamVoteNo[ cs_offset ] ) );
}
// a majority will be determined in TeamCheckVote, which will also account
@@ -1057,7 +1057,7 @@ void Cmd_SetViewpos_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Cheats are not enabled on this server\n\"" ) );
return;
}
-
+
if( trap_Argc( ) != 5 )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"usage: setviewpos x y z yaw\n\"" ) );
@@ -1065,7 +1065,7 @@ void Cmd_SetViewpos_f( gentity_t *ent )
}
VectorClear( angles );
-
+
for( i = 0 ; i < 3 ; i++ )
{
trap_Argv( i + 1, buffer, sizeof( buffer ) );
@@ -1095,8 +1095,8 @@ void Cmd_Class_f( gentity_t *ent )
vec3_t infestOrigin;
int allowedClasses[ PCL_NUM_CLASSES ];
int numClasses = 0;
- pClass_t currentClass = ent->client->ps.stats[ STAT_PCLASS ];
-
+ pClass_t currentClass = ent->client->ps.stats[ STAT_PCLASS ];
+
int numLevels;
vec3_t fromMins, fromMaxs, toMins, toMaxs;
vec3_t temp;
@@ -1106,10 +1106,10 @@ void Cmd_Class_f( gentity_t *ent )
vec3_t mins, maxs;
int num;
gentity_t *other;
-
+
if( ent->client->ps.stats[ STAT_HEALTH ] <= 0 )
return;
-
+
clientNum = ent->client - level.clients;
trap_Argv( 1, s, sizeof( s ) );
@@ -1126,7 +1126,7 @@ void Cmd_Class_f( gentity_t *ent )
allowedClasses[ 1 ] = PCL_ALIEN_LEVEL0;
numClasses = 2;
}
-
+
if( ent->client->pers.teamSelection == PTE_ALIENS &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) &&
@@ -1139,12 +1139,12 @@ void Cmd_Class_f( gentity_t *ent )
//check there are no humans nearby
VectorAdd( ent->client->ps.origin, range, maxs );
VectorSubtract( ent->client->ps.origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
other = &g_entities[ entityList[ i ] ];
-
+
if( ( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ||
( other->s.eType == ET_BUILDABLE && other->biteam == BIT_HUMANS ) )
{
@@ -1160,7 +1160,7 @@ void Cmd_Class_f( gentity_t *ent )
G_TriggerMenu( clientNum, MN_A_NOOVMND_EVOLVE );
return;
}
-
+
//guard against selling the HBUILD weapons exploit
if( ( currentClass == PCL_ALIEN_BUILDER0 ||
currentClass == PCL_ALIEN_BUILDER0_UPG ) &&
@@ -1169,7 +1169,7 @@ void Cmd_Class_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot evolve until build timer expires\n\"" ) );
return;
}
-
+
//evolve now
ent->client->pers.classSelection = BG_FindClassNumForName( s );
@@ -1178,7 +1178,7 @@ void Cmd_Class_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown class\n\"" ) );
return;
}
-
+
numLevels = BG_ClassCanEvolveFromTo( currentClass,
ent->client->pers.classSelection,
(short)ent->client->ps.persistant[ PERS_CREDIT ], 0 );
@@ -1189,7 +1189,7 @@ void Cmd_Class_f( gentity_t *ent )
toMins, toMaxs, NULL, NULL, NULL );
VectorCopy( ent->s.pos.trBase, infestOrigin );
-
+
infestOrigin[ 2 ] += ( fabs( toMins[ 2 ] ) - fabs( fromMins[ 2 ] ) ) + 1.0f;
VectorCopy( infestOrigin, temp );
temp[ 2 ] += EVOLVE_TRACE_HEIGHT;
@@ -1198,14 +1198,14 @@ void Cmd_Class_f( gentity_t *ent )
trap_Trace( &tr, infestOrigin, toMins, toMaxs, temp, ent->s.number, MASK_SHOT );
VectorCopy( infestOrigin, temp );
temp[ 2 ] += ( EVOLVE_TRACE_HEIGHT * tr.fraction ) - 1.0f;
-
+
//trace down to the ground so that we can evolve on slopes
trap_Trace( &tr, temp, toMins, toMaxs, infestOrigin, ent->s.number, MASK_SHOT );
VectorCopy( tr.endpos, infestOrigin );
-
+
//make REALLY sure
trap_Trace( &tr2, ent->s.pos.trBase, NULL, NULL, infestOrigin, ent->s.number, MASK_SHOT );
-
+
//check there is room to evolve
if( !tr.startsolid && tr2.fraction == 1.0f )
{
@@ -1219,10 +1219,10 @@ void Cmd_Class_f( gentity_t *ent )
ent->client->pers.evolveHealthFraction = 0.0f;
else if( ent->client->pers.evolveHealthFraction > 1.0f )
ent->client->pers.evolveHealthFraction = 1.0f;
-
+
//remove credit
G_AddCreditToClient( ent->client, -(short)numLevels, qtrue );
-
+
ClientUserinfoChanged( clientNum );
VectorCopy( infestOrigin, ent->s.pos.trBase );
ClientSpawn( ent, ent, ent->s.pos.trBase, ent->s.apos.trBase );
@@ -1324,7 +1324,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct )
if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING )
G_Damage( ent->client->hovel, ent, ent, forward, ent->s.origin, 10000, 0, MOD_SUICIDE );
-
+
if( !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) )
{
AngleVectors( ent->client->ps.viewangles, forward, NULL, NULL );
@@ -1349,7 +1349,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10000, 0, MOD_SUICIDE );
else
G_FreeEntity( traceEnt );
-
+
ent->client->ps.stats[ STAT_MISC ] +=
BG_FindBuildDelayForWeapon( ent->s.weapon ) >> 2;
}
@@ -1375,7 +1375,7 @@ void Cmd_ActivateItem_f( gentity_t *ent )
if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
-
+
if( upgrade != UP_NONE && BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
BG_ActivateUpgrade( upgrade, ent->client->ps.stats );
else if( weapon != WP_NONE && BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) )
@@ -1402,7 +1402,7 @@ void Cmd_DeActivateItem_f( gentity_t *ent )
if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
-
+
if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
BG_DeactivateUpgrade( upgrade, ent->client->ps.stats );
else
@@ -1452,7 +1452,7 @@ void Cmd_ToggleItem_f( gentity_t *ent )
if( i == WP_NUM_WEAPONS )
weapon = WP_BLASTER;
}
-
+
G_ForceWeaponChange( ent, weapon );
}
else if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) )
@@ -1492,14 +1492,14 @@ void Cmd_Buy_f( gentity_t *ent )
}
trap_Argv( 1, s, sizeof( s ) );
-
+
//aliens don't buy stuff
if( ent->client->pers.teamSelection != PTE_HUMANS )
return;
weapon = BG_FindWeaponNumForName( s );
upgrade = BG_FindUpgradeNumForName( s );
-
+
//special case to keep norf happy
if( weapon == WP_NONE && upgrade == UP_AMMO )
{
@@ -1526,50 +1526,50 @@ void Cmd_Buy_f( gentity_t *ent )
G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD );
return;
}
-
+
//can afford this?
if( BG_FindPriceForWeapon( weapon ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
return;
}
-
+
//have space to carry this?
if( BG_FindSlotsForWeapon( weapon ) & ent->client->ps.stats[ STAT_SLOTS ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
-
+
if( BG_FindTeamForWeapon( weapon ) != WUT_HUMANS )
{
//shouldn't need a fancy dialog
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
return;
}
-
+
//are we /allowed/ to buy this?
if( !BG_FindPurchasableForWeapon( weapon ) )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
-
+
//are we /allowed/ to buy this?
if( !BG_FindStagesForWeapon( weapon, g_humanStage.integer ) )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
-
+
//add to inventory
BG_AddWeaponToInventory( weapon, ent->client->ps.stats );
BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
-
+
if( BG_FindUsesEnergyForWeapon( weapon ) &&
BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
-
+
BG_PackAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups,
maxAmmo, maxClips );
@@ -1577,7 +1577,7 @@ void Cmd_Buy_f( gentity_t *ent )
//set build delay/pounce etc to 0
ent->client->ps.stats[ STAT_MISC ] = 0;
-
+
//subtract from funds
G_AddCreditToClient( ent->client, -(short)BG_FindPriceForWeapon( weapon ), qfalse );
}
@@ -1589,42 +1589,42 @@ void Cmd_Buy_f( gentity_t *ent )
G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD );
return;
}
-
+
//can afford this?
if( BG_FindPriceForUpgrade( upgrade ) > (short)ent->client->ps.persistant[ PERS_CREDIT ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOFUNDS );
return;
}
-
+
//have space to carry this?
if( BG_FindSlotsForUpgrade( upgrade ) & ent->client->ps.stats[ STAT_SLOTS ] )
{
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOSLOTS );
return;
}
-
+
if( BG_FindTeamForUpgrade( upgrade ) != WUT_HUMANS )
{
//shouldn't need a fancy dialog
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy alien items\n\"" ) );
return;
}
-
+
//are we /allowed/ to buy this?
if( !BG_FindPurchasableForUpgrade( upgrade ) )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
-
+
//are we /allowed/ to buy this?
if( !BG_FindStagesForUpgrade( upgrade, g_humanStage.integer ) )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't buy this item\n\"" ) );
return;
}
-
+
if( upgrade == UP_AMMO )
G_GiveClientMaxAmmo( ent, buyingEnergyAmmo );
else
@@ -1632,7 +1632,7 @@ void Cmd_Buy_f( gentity_t *ent )
//add to inventory
BG_AddUpgradeToInventory( upgrade, ent->client->ps.stats );
}
-
+
if( upgrade == UP_BATTPACK )
G_GiveClientMaxAmmo( ent, qtrue );
@@ -1643,16 +1643,16 @@ void Cmd_Buy_f( gentity_t *ent )
{
G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown item\n\"" ) );
}
-
+
if( trap_Argc( ) >= 2 )
{
trap_Argv( 2, s, sizeof( s ) );
-
+
//retrigger the armoury menu
if( !Q_stricmp( s, "retrigger" ) )
ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES;
}
-
+
//update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
}
@@ -1684,7 +1684,7 @@ void Cmd_Sell_f( gentity_t *ent )
weapon = BG_FindWeaponNumForName( s );
upgrade = BG_FindUpgradeNumForName( s );
-
+
if( weapon != WP_NONE )
{
//are we /allowed/ to sell this?
@@ -1693,7 +1693,7 @@ void Cmd_Sell_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"You can't sell this weapon\n\"" ) );
return;
}
-
+
//remove weapon if carried
if( BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) )
{
@@ -1704,7 +1704,7 @@ void Cmd_Sell_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
return;
}
-
+
BG_RemoveWeaponFromInventory( weapon, ent->client->ps.stats );
//add to funds
@@ -1730,7 +1730,7 @@ void Cmd_Sell_f( gentity_t *ent )
if( upgrade == UP_BATTPACK )
G_GiveClientMaxAmmo( ent, qtrue );
-
+
//add to funds
G_AddCreditToClient( ent->client, (short)BG_FindPriceForUpgrade( upgrade ), qfalse );
}
@@ -1746,7 +1746,7 @@ void Cmd_Sell_f( gentity_t *ent )
G_SendCommandFromServer( ent-g_entities, va( "print \"Cannot sell until build timer expires\n\"" ) );
continue;
}
-
+
if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) &&
BG_FindPurchasableForWeapon( i ) )
{
@@ -1755,7 +1755,7 @@ void Cmd_Sell_f( gentity_t *ent )
//add to funds
G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( i ), qfalse );
}
-
+
//if we have this weapon selected, force a new selection
if( i == ent->client->ps.weapon )
G_ForceWeaponChange( ent, WP_NONE );
@@ -1774,7 +1774,7 @@ void Cmd_Sell_f( gentity_t *ent )
if( i == UP_BATTPACK )
{
int j;
-
+
//remove energy
for( j = WP_NONE; j < WP_NUM_WEAPONS; j++ )
{
@@ -1786,7 +1786,7 @@ void Cmd_Sell_f( gentity_t *ent )
}
}
}
-
+
//add to funds
G_AddCreditToClient( ent->client, (short)BG_FindPriceForUpgrade( i ), qfalse );
}
@@ -1794,16 +1794,16 @@ void Cmd_Sell_f( gentity_t *ent )
}
else
G_SendCommandFromServer( ent-g_entities, va( "print \"Unknown item\n\"" ) );
-
+
if( trap_Argc( ) >= 2 )
{
trap_Argv( 2, s, sizeof( s ) );
-
+
//retrigger the armoury menu
if( !Q_stricmp( s, "retrigger" ) )
ent->client->retriggerArmouryMenu = level.framenum + RAM_FRAMES;
}
-
+
//update ClientInfo
ClientUserinfoChanged( ent->client->ps.clientNum );
}
@@ -1826,7 +1826,7 @@ void Cmd_Build_f( gentity_t *ent )
buildable = BG_FindBuildNumForName( s );
team = ent->client->ps.stats[ STAT_PTEAM ];
-
+
if( buildable != BA_NONE &&
( ( 1 << ent->client->ps.weapon ) & BG_FindBuildWeaponForBuildable( buildable ) ) &&
!( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
@@ -1835,7 +1835,7 @@ void Cmd_Build_f( gentity_t *ent )
( team == PTE_HUMANS && BG_FindStagesForBuildable( buildable, g_humanStage.integer ) ) ) )
{
dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] );
-
+
//these are the errors displayed when the builder first selects something to use
switch( G_itemFits( ent, buildable, dist, origin ) )
{
@@ -1873,11 +1873,11 @@ void Cmd_Build_f( gentity_t *ent )
case IBE_NOPOWER:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
break;
-
+
case IBE_NOCREEP:
G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOCREEP );
break;
-
+
case IBE_NODCC:
G_TriggerMenu( ent->client->ps.clientNum, MN_H_NODCC );
break;
@@ -1904,7 +1904,7 @@ void Cmd_Boost_f( gentity_t *ent )
if( ent->client->pers.cmd.buttons & BUTTON_WALKING )
return;
-
+
if( ( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) &&
( ent->client->ps.stats[ STAT_STAMINA ] > 0 ) )
ent->client->ps.stats[ STAT_STATE ] |= SS_SPEEDBOOST;
@@ -1930,8 +1930,8 @@ to free floating spectator mode
*/
void G_StopFollowing( gentity_t *ent )
{
- ent->client->ps.persistant[ PERS_TEAM ] = TEAM_SPECTATOR;
- ent->client->sess.sessionTeam = TEAM_SPECTATOR;
+ ent->client->ps.persistant[ PERS_TEAM ] = TEAM_SPECTATOR;
+ ent->client->sess.sessionTeam = TEAM_SPECTATOR;
ent->client->sess.spectatorState = SPECTATOR_FREE;
ent->client->sess.spectatorClient = -1;
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
@@ -1960,7 +1960,7 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir )
int clientnum = ent->client->sess.spectatorClient;
int original = clientnum;
qboolean selectAny = qfalse;
-
+
if( dir > 1 )
dir = 1;
else if( dir < -1 )
@@ -1977,21 +1977,21 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir )
clientnum = original = 0;
selectAny = qtrue;
}
-
+
do
{
clientnum += dir;
-
+
if( clientnum >= level.maxclients )
clientnum = 0;
-
+
if( clientnum < 0 )
clientnum = level.maxclients - 1;
// avoid selecting existing follow target
if( clientnum == original && !selectAny )
continue; //effectively break;
-
+
// can't follow self
if( &level.clients[ clientnum ] == ent->client )
continue;
@@ -2008,7 +2008,7 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir )
ent->client->sess.spectatorClient = clientnum;
ent->client->sess.spectatorState = SPECTATOR_FOLLOW;
return qtrue;
-
+
} while( clientnum != original );
return qfalse;
@@ -2035,7 +2035,7 @@ void Cmd_Follow_f( gentity_t *ent, qboolean toggle )
{
trap_Argv( 1, arg, sizeof( arg ) );
i = G_ClientNumberFromString( ent, arg );
-
+
if( i == -1 )
return;
@@ -2096,7 +2096,7 @@ void Cmd_PTRCVerify_f( gentity_t *ent )
if( G_VerifyPTRC( code ) )
{
connection = G_FindConnectionForCode( code );
-
+
// valid code
if( connection->clientTeam != PTE_NONE )
G_SendCommandFromServer( ent->client->ps.clientNum, "ptrcconfirm" );
@@ -2108,7 +2108,7 @@ void Cmd_PTRCVerify_f( gentity_t *ent )
{
// invalid code -- generate a new one
connection = G_GenerateNewConnection( ent->client );
-
+
if( connection )
{
G_SendCommandFromServer( ent->client->ps.clientNum,
@@ -2153,7 +2153,7 @@ void Cmd_PTRCRestore_f( gentity_t *ent )
{
// set the correct team
G_ChangeTeam( ent, connection->clientTeam );
-
+
// set the correct credit
ent->client->ps.persistant[ PERS_CREDIT ] = 0;
G_AddCreditToClient( ent->client, connection->clientCredit, qtrue );
@@ -2181,7 +2181,7 @@ void Cmd_Test_f( gentity_t *ent )
ent->client->lastPoisonCloudedTime = level.time;
ent->client->lastPoisonCloudedClient = ent;
G_SendCommandFromServer( ent->client->ps.clientNum, "poisoncloud" );*/
-
+
/* ent->client->ps.stats[ STAT_STATE ] |= SS_POISONED;
ent->client->lastPoisonTime = level.time;
ent->client->lastPoisonClient = ent;*/
@@ -2209,19 +2209,19 @@ void ClientCommand( int clientNum )
Cmd_Say_f( ent, SAY_ALL, qfalse );
return;
}
-
+
if( Q_stricmp( cmd, "say_team" ) == 0 )
{
Cmd_Say_f( ent, SAY_TEAM, qfalse );
return;
}
-
+
if( Q_stricmp( cmd, "tell" ) == 0 )
{
Cmd_Tell_f( ent );
return;
}
-
+
if( Q_stricmp( cmd, "score" ) == 0 )
{
Cmd_Score_f( ent );
@@ -2276,12 +2276,12 @@ void ClientCommand( int clientNum )
Cmd_Vote_f( ent );
else if( Q_stricmp( cmd, "callteamvote" ) == 0 )
Cmd_CallTeamVote_f( ent );
- else if( Q_stricmp( cmd, "follow" ) == 0 )
- Cmd_Follow_f( ent, qfalse );
- else if( Q_stricmp (cmd, "follownext") == 0)
- Cmd_FollowCycle_f( ent, 1 );
- else if( Q_stricmp( cmd, "followprev" ) == 0 )
- Cmd_FollowCycle_f( ent, -1 );
+ else if( Q_stricmp( cmd, "follow" ) == 0 )
+ Cmd_Follow_f( ent, qfalse );
+ else if( Q_stricmp (cmd, "follownext") == 0)
+ Cmd_FollowCycle_f( ent, 1 );
+ else if( Q_stricmp( cmd, "followprev" ) == 0 )
+ Cmd_FollowCycle_f( ent, -1 );
else if( Q_stricmp( cmd, "teamvote" ) == 0 )
Cmd_TeamVote_f( ent );
else if( Q_stricmp( cmd, "setviewpos" ) == 0 )
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 29032050..fb822c3c 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -137,7 +137,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
char *killerName, *obit;
float totalDamage = 0.0f;
gentity_t *player;
-
+
if( self->client->ps.pm_type == PM_DEAD )
return;
@@ -163,7 +163,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if( attacker )
{
killer = attacker->s.number;
-
+
if( attacker->client )
killerName = attacker->client->pers.netname;
else
@@ -211,11 +211,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if( attacker && attacker->client )
{
attacker->client->lastkilled_client = self->s.number;
-
+
if( attacker == self || OnSameTeam( self, attacker ) )
{
AddScore( attacker, -1 );
-
+
//punish team kills and suicides
if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
G_AddCreditToClient( attacker->client, -1, qtrue );
@@ -235,7 +235,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//total up all the damage done by every client
for( i = 0; i < MAX_CLIENTS; i++ )
totalDamage += (float)self->credits[ i ];
-
+
// if players did more than DAMAGE_FRACTION_FOR_KILL increment the stage counters
if( totalDamage >= ( self->client->ps.stats[ STAT_MAX_HEALTH ] * DAMAGE_FRACTION_FOR_KILL ) )
{
@@ -244,27 +244,27 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
trap_Cvar_Set( "g_humanKills", va( "%d", g_humanKills.integer + 1 ) );
}
-
+
if( totalDamage > 0.0f )
{
if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
//nice simple happy bouncy human land
float classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] );
-
+
for( i = 0; i < MAX_CLIENTS; i++ )
{
player = g_entities + i;
if( !player->client )
continue;
-
+
if( player->client->ps.stats[ STAT_PTEAM ] != PTE_HUMANS )
continue;
if( !self->credits[ i ] )
continue;
-
+
//add credit
G_AddCreditToClient( player->client,
(int)( classValue * ( (float)self->credits[ i ] / totalDamage ) ), qtrue );
@@ -276,27 +276,27 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
float humanValue = BG_GetValueOfHuman( &self->client->ps );
int frags;
int unclaimedFrags = (int)humanValue;
-
+
for( i = 0; i < MAX_CLIENTS; i++ )
{
player = g_entities + i;
if( !player->client )
continue;
-
+
if( player->client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS )
continue;
-
+
//this client did no damage
if( !self->credits[ i ] )
continue;
-
+
//nothing left to claim
if( !unclaimedFrags )
break;
-
+
frags = (int)floor( humanValue * ( (float)self->credits[ i ] / totalDamage ) );
-
+
if( frags > 0 )
{
//add kills
@@ -317,12 +317,12 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//have enough credit to claim even one frag
//so simply give the top <unclaimedFrags> clients
//a frag each
-
+
for( i = 0; i < unclaimedFrags; i++ )
{
int maximum = 0;
int topClient = 0;
-
+
for( j = 0; j < MAX_CLIENTS; j++ )
{
//this client did no damage
@@ -339,7 +339,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if( maximum > 0 )
{
player = g_entities + topClient;
-
+
//add kills
G_AddCreditToClient( player->client, 1, qtrue );
@@ -350,9 +350,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
}
}
}
-
+
Cmd_Score_f( self ); // show scores
-
+
// send updated scores to any clients that are following this one,
// or they would get stale scoreboards
for( i = 0 ; i < level.maxclients ; i++ )
@@ -362,10 +362,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
client = &level.clients[ i ];
if( client->pers.connected != CON_CONNECTED )
continue;
-
+
if( client->sess.sessionTeam != TEAM_SPECTATOR )
continue;
-
+
if( client->sess.spectatorClient == self->s.number )
Cmd_Score_f( g_entities + i );
}
@@ -435,7 +435,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
self->client->ps.legsAnim =
( ( self->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
-
+
if( !( self->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
{
self->client->ps.torsoAnim =
@@ -461,29 +461,29 @@ G_ParseArmourScript
*/
void G_ParseArmourScript( char *buf, int upgrade )
{
- char *token;
- int count;
+ char *token;
+ int count;
- count = 0;
+ count = 0;
- while( 1 )
+ while( 1 )
{
- token = COM_Parse( &buf );
-
- if( !token[0] )
- break;
-
- if( strcmp( token, "{" ) )
+ token = COM_Parse( &buf );
+
+ if( !token[0] )
+ break;
+
+ if( strcmp( token, "{" ) )
{
- G_Printf( "Missing { in armour file\n" );
- break;
- }
+ G_Printf( "Missing { in armour file\n" );
+ break;
+ }
- if( count == MAX_ARMOUR_REGIONS )
+ if( count == MAX_ARMOUR_REGIONS )
{
- G_Printf( "Max armour regions exceeded in locdamage file\n" );
- break;
- }
+ G_Printf( "Max armour regions exceeded in locdamage file\n" );
+ break;
+ }
//default
g_armourRegions[ upgrade ][ count ].minHeight = 0.0;
@@ -492,63 +492,63 @@ void G_ParseArmourScript( char *buf, int upgrade )
g_armourRegions[ upgrade ][ count ].maxAngle = 360;
g_armourRegions[ upgrade ][ count ].modifier = 1.0;
g_armourRegions[ upgrade ][ count ].crouch = qfalse;
-
+
while( 1 )
{
- token = COM_ParseExt( &buf, qtrue );
-
- if( !token[0] )
+ token = COM_ParseExt( &buf, qtrue );
+
+ if( !token[0] )
{
- G_Printf( "Unexpected end of armour file\n" );
- break;
- }
-
- if( !Q_stricmp( token, "}" ) )
+ G_Printf( "Unexpected end of armour file\n" );
+ break;
+ }
+
+ if( !Q_stricmp( token, "}" ) )
{
- break;
+ break;
}
else if( !strcmp( token, "minHeight" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "0" );
+ if ( !token[0] )
+ strcpy( token, "0" );
g_armourRegions[ upgrade ][ count ].minHeight = atof( token );
}
else if( !strcmp( token, "maxHeight" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "100" );
+ if ( !token[0] )
+ strcpy( token, "100" );
g_armourRegions[ upgrade ][ count ].maxHeight = atof( token );
}
else if( !strcmp( token, "minAngle" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "0" );
+ if ( !token[0] )
+ strcpy( token, "0" );
g_armourRegions[ upgrade ][ count ].minAngle = atoi( token );
}
else if( !strcmp( token, "maxAngle" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "360" );
+ if ( !token[0] )
+ strcpy( token, "360" );
g_armourRegions[ upgrade ][ count ].maxAngle = atoi( token );
}
else if( !strcmp( token, "modifier" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "1.0" );
+ if ( !token[0] )
+ strcpy( token, "1.0" );
g_armourRegions[ upgrade ][ count ].modifier = atof( token );
}
@@ -556,11 +556,11 @@ void G_ParseArmourScript( char *buf, int upgrade )
{
g_armourRegions[ upgrade ][ count ].crouch = qtrue;
}
- }
+ }
g_numArmourRegions[ upgrade ]++;
count++;
- }
+ }
}
@@ -571,29 +571,29 @@ G_ParseDmgScript
*/
void G_ParseDmgScript( char *buf, int class )
{
- char *token;
- int count;
+ char *token;
+ int count;
- count = 0;
+ count = 0;
- while( 1 )
+ while( 1 )
{
- token = COM_Parse( &buf );
-
- if( !token[0] )
- break;
-
- if( strcmp( token, "{" ) )
+ token = COM_Parse( &buf );
+
+ if( !token[0] )
+ break;
+
+ if( strcmp( token, "{" ) )
{
- G_Printf( "Missing { in locdamage file\n" );
- break;
- }
+ G_Printf( "Missing { in locdamage file\n" );
+ break;
+ }
- if( count == MAX_LOCDAMAGE_REGIONS )
+ if( count == MAX_LOCDAMAGE_REGIONS )
{
- G_Printf( "Max damage regions exceeded in locdamage file\n" );
- break;
- }
+ G_Printf( "Max damage regions exceeded in locdamage file\n" );
+ break;
+ }
//default
g_damageRegions[ class ][ count ].minHeight = 0.0;
@@ -602,63 +602,63 @@ void G_ParseDmgScript( char *buf, int class )
g_damageRegions[ class ][ count ].maxAngle = 360;
g_damageRegions[ class ][ count ].modifier = 1.0;
g_damageRegions[ class ][ count ].crouch = qfalse;
-
+
while( 1 )
{
- token = COM_ParseExt( &buf, qtrue );
-
- if( !token[0] )
+ token = COM_ParseExt( &buf, qtrue );
+
+ if( !token[0] )
{
- G_Printf( "Unexpected end of locdamage file\n" );
- break;
- }
-
- if( !Q_stricmp( token, "}" ) )
+ G_Printf( "Unexpected end of locdamage file\n" );
+ break;
+ }
+
+ if( !Q_stricmp( token, "}" ) )
{
- break;
+ break;
}
else if( !strcmp( token, "minHeight" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "0" );
+ if ( !token[0] )
+ strcpy( token, "0" );
g_damageRegions[ class ][ count ].minHeight = atof( token );
}
else if( !strcmp( token, "maxHeight" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "100" );
+ if ( !token[0] )
+ strcpy( token, "100" );
g_damageRegions[ class ][ count ].maxHeight = atof( token );
}
else if( !strcmp( token, "minAngle" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "0" );
+ if ( !token[0] )
+ strcpy( token, "0" );
g_damageRegions[ class ][ count ].minAngle = atoi( token );
}
else if( !strcmp( token, "maxAngle" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "360" );
+ if ( !token[0] )
+ strcpy( token, "360" );
g_damageRegions[ class ][ count ].maxAngle = atoi( token );
}
else if( !strcmp( token, "modifier" ) )
{
- token = COM_ParseExt( &buf, qfalse );
+ token = COM_ParseExt( &buf, qfalse );
- if ( !token[0] )
- strcpy( token, "1.0" );
+ if ( !token[0] )
+ strcpy( token, "1.0" );
g_damageRegions[ class ][ count ].modifier = atof( token );
}
@@ -666,15 +666,15 @@ void G_ParseDmgScript( char *buf, int class )
{
g_damageRegions[ class ][ count ].crouch = qtrue;
}
- }
+ }
g_numDamageRegions[ class ]++;
count++;
- }
+ }
}
-/*
+/*
============
G_CalcDamageModifier
============
@@ -693,7 +693,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
if( point == NULL )
return 1.0f;
- clientHeight = targ->r.maxs[ 2 ] - targ->r.mins[ 2 ];
+ clientHeight = targ->r.maxs[ 2 ] - targ->r.mins[ 2 ];
if( targ->client->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING )
VectorCopy( targ->client->ps.grapplePoint, normal );
@@ -702,25 +702,25 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
VectorMA( targ->r.currentOrigin, targ->r.mins[ 2 ], normal, floor );
VectorSubtract( point, floor, pMINUSfloor );
-
+
hitRelative = DotProduct( normal, pMINUSfloor ) / VectorLength( normal );
if( hitRelative < 0.0f )
hitRelative = 0.0f;
-
+
if( hitRelative > clientHeight )
hitRelative = clientHeight;
hitRatio = hitRelative / clientHeight;
-
- VectorSubtract( targ->r.currentOrigin, point, bulletPath );
+
+ VectorSubtract( targ->r.currentOrigin, point, bulletPath );
vectoangles( bulletPath, bulletAngle );
clientRotation = targ->client->ps.viewangles[ YAW ];
bulletRotation = bulletAngle[ YAW ];
hitRotation = abs( clientRotation - bulletRotation );
-
+
hitRotation = hitRotation % 360; // Keep it in the 0-359 range
if( !( dflags & DAMAGE_NO_LOCDAMAGE ) )
@@ -728,7 +728,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
for( i = 0; i < g_numDamageRegions[ class ]; i++ )
{
qboolean rotationBound;
-
+
if( g_damageRegions[ class ][ i ].minAngle >
g_damageRegions[ class ][ i ].maxAngle )
{
@@ -741,7 +741,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
rotationBound = ( hitRotation >= g_damageRegions[ class ][ i ].minAngle &&
hitRotation <= g_damageRegions[ class ][ i ].maxAngle );
}
-
+
if( rotationBound &&
hitRatio >= g_damageRegions[ class ][ i ].minHeight &&
hitRatio <= g_damageRegions[ class ][ i ].maxHeight &&
@@ -758,7 +758,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
for( j = 0; j < g_numArmourRegions[ i ]; j++ )
{
qboolean rotationBound;
-
+
if( g_armourRegions[ i ][ j ].minAngle >
g_armourRegions[ i ][ j ].maxAngle )
{
@@ -771,7 +771,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
rotationBound = ( hitRotation >= g_armourRegions[ i ][ j ].minAngle &&
hitRotation <= g_armourRegions[ i ][ j ].maxAngle );
}
-
+
if( rotationBound &&
hitRatio >= g_armourRegions[ i ][ j ].minHeight &&
hitRatio <= g_armourRegions[ i ][ j ].maxHeight &&
@@ -781,7 +781,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att
}
}
}
-
+
return modifier;
}
@@ -796,9 +796,9 @@ void G_InitDamageLocations( void )
char *modelName;
char filename[ MAX_QPATH ];
int i;
- int len;
- fileHandle_t fileHandle;
- char buffer[ MAX_LOCDAMAGE_TEXT ];
+ int len;
+ fileHandle_t fileHandle;
+ char buffer[ MAX_LOCDAMAGE_TEXT ];
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
@@ -811,7 +811,7 @@ void G_InitDamageLocations( void )
G_Printf( va( S_COLOR_RED "file not found: %s\n", filename ) );
continue;
}
-
+
if( len >= MAX_LOCDAMAGE_TEXT )
{
G_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_LOCDAMAGE_TEXT ) );
@@ -822,21 +822,21 @@ void G_InitDamageLocations( void )
trap_FS_Read( buffer, len, fileHandle );
buffer[len] = 0;
trap_FS_FCloseFile( fileHandle );
-
+
G_ParseDmgScript( buffer, i );
}
-
+
for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
{
modelName = BG_FindNameForUpgrade( i );
Com_sprintf( filename, sizeof( filename ), "armour/%s.armour", modelName );
len = trap_FS_FOpenFile( filename, &fileHandle, FS_READ );
-
+
//no file - no parsage
if ( !fileHandle )
continue;
-
+
if( len >= MAX_LOCDAMAGE_TEXT )
{
G_Printf( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_LOCDAMAGE_TEXT ) );
@@ -847,7 +847,7 @@ void G_InitDamageLocations( void )
trap_FS_Read( buffer, len, fileHandle );
buffer[len] = 0;
trap_FS_FCloseFile( fileHandle );
-
+
G_ParseArmourScript( buffer, i );
}
}
@@ -906,7 +906,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if( !inflictor )
inflictor = &g_entities[ ENTITYNUM_WORLD ];
-
+
if( !attacker )
attacker = &g_entities[ ENTITYNUM_WORLD ];
@@ -916,13 +916,13 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if( targ->use && ( targ->moverState == MOVER_POS1 ||
targ->moverState == ROTATOR_POS1 ) )
targ->use( targ, inflictor, attacker );
-
+
return;
}
client = targ->client;
- if( client )
+ if( client )
{
if( client->noclip )
return;
@@ -940,10 +940,10 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
knockback = (int)( (float)knockback *
BG_FindKnockbackScaleForClass( targ->client->ps.stats[ STAT_PCLASS ] ) );
}
-
+
if( knockback > 200 )
knockback = 200;
-
+
if( targ->flags & FL_NO_KNOCKBACK )
knockback = 0;
@@ -970,10 +970,10 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
t = knockback * 2;
if( t < 50 )
t = 50;
-
+
if( t > 200 )
t = 200;
-
+
targ->client->ps.pm_time = t;
targ->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
}
@@ -1019,11 +1019,11 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
client->ps.persistant[ PERS_ATTACKER ] = attacker->s.number;
else
client->ps.persistant[ PERS_ATTACKER ] = ENTITYNUM_WORLD;
-
+
client->damage_armor += asave;
client->damage_blood += take;
client->damage_knockback += knockback;
-
+
if( dir )
{
VectorCopy ( dir, client->damage_from );
@@ -1058,7 +1058,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if( take < 1 )
take = 1;
-
+
if( g_debugDamage.integer )
{
G_Printf( "%i: client:%i health:%i damage:%i armor:%i\n", level.time, targ->s.number,
@@ -1072,7 +1072,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if( targ->client )
targ->client->ps.stats[ STAT_HEALTH ] = targ->health;
-
+
targ->lastDamageTime = level.time;
//TA: add to the attackers "account" on the target
@@ -1194,7 +1194,7 @@ qboolean G_SelectiveRadiusDamage( vec3_t origin, gentity_t *attacker, float dama
if( ent == ignore )
continue;
-
+
if( !ent->takedamage )
continue;
@@ -1265,7 +1265,7 @@ qboolean G_RadiusDamage( vec3_t origin, gentity_t *attacker, float damage,
if( ent == ignore )
continue;
-
+
if( !ent->takedamage )
continue;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index a56993fc..9b3aeb0e 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -14,7 +14,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
#include "q_shared.h"
#include "bg_public.h"
#include "g_public.h"
@@ -50,12 +50,12 @@ typedef enum
MOVER_POS2,
MOVER_1TO2,
MOVER_2TO1,
-
+
ROTATOR_POS1,
ROTATOR_POS2,
ROTATOR_1TO2,
ROTATOR_2TO1,
-
+
MODEL_POS1,
MODEL_POS2,
MODEL_1TO2,
@@ -186,7 +186,7 @@ struct gentity_s
pTeam_t stageTeam;
stage_t stageStage;
-
+
int biteam; //TA: buildable item team
gentity_t *parentNode; //TA: for creep and defence/spawn dependencies
qboolean active; //TA: for power repeater, but could be useful elsewhere
@@ -228,7 +228,7 @@ struct gentity_s
int triggerGravity; //TA: gravity for this trigger
int suicideTime; //TA: when the client will suicide
-
+
int lastDamageTime;
};
@@ -357,7 +357,7 @@ struct gclient_s
int latched_buttons;
vec3_t oldOrigin;
-
+
// sum up damage over an entire frame, so
// shotgun blasts give a single big kick
int damage_armor; // damage absorbed by armor
@@ -429,7 +429,7 @@ struct gclient_s
typedef struct spawnQueue_s
{
int clients[ MAX_CLIENTS ];
-
+
int front, back;
} spawnQueue_t;
@@ -453,7 +453,7 @@ typedef struct damageRegion_s
{
float minHeight, maxHeight;
int minAngle, maxAngle;
-
+
float modifier;
qboolean crouch;
@@ -467,7 +467,7 @@ typedef struct armourRegion_s
{
float minHeight, maxHeight;
int minAngle, maxAngle;
-
+
float modifier;
qboolean crouch;
@@ -560,18 +560,18 @@ typedef struct
//TA: extra stuff:
int numAlienSpawns;
int numHumanSpawns;
-
+
int numAlienClients;
int numHumanClients;
-
+
float averageNumAlienClients;
int numAlienSamples;
float averageNumHumanClients;
int numHumanSamples;
-
+
int numLiveAlienClients;
int numLiveHumanClients;
-
+
int alienBuildPoints;
int humanBuildPoints;
int humanBuildPointsPowered;
@@ -625,14 +625,14 @@ void G_Physics( gentity_t *ent, int msec );
typedef enum
{
IBE_NONE,
-
+
IBE_NOOVERMIND,
IBE_OVERMIND,
IBE_NOASSERT,
IBE_SPWNWARN,
IBE_NOCREEP,
IBE_HOVELEXIT,
-
+
IBE_REACTOR,
IBE_REPEATER,
IBE_TNODEWARN,
@@ -640,7 +640,7 @@ typedef enum
IBE_RPTWARN2,
IBE_NOPOWER,
IBE_NODCC,
-
+
IBE_NORMAL,
IBE_NOROOM,
IBE_PERMISSION,
@@ -649,12 +649,13 @@ typedef enum
} itemBuildError_t;
qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideExit );
-gentity_t *G_CheckSpawnPoint( vec3_t origin, vec3_t normal, buildable_t spawn, vec3_t spawnOrigin );
+gentity_t *G_CheckSpawnPoint( int spawnNum, vec3_t origin, vec3_t normal,
+ buildable_t spawn, vec3_t spawnOrigin );
qboolean G_isPower( vec3_t origin );
qboolean G_isDCC( void );
qboolean G_isOvermind( void );
-
+
void G_BuildableThink( gentity_t *ent, int msec );
qboolean G_BuildableRange( vec3_t origin, float r, buildable_t buildable );
itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance, vec3_t origin );
@@ -947,9 +948,9 @@ typedef enum
typedef struct mapRotationCondition_s
{
char dest[ MAX_QPATH ];
-
+
qboolean unconditional;
-
+
mapConditionVariable_t lhs;
mapConditionOperator_t op;
@@ -960,7 +961,7 @@ typedef struct mapRotationCondition_s
typedef struct mapRotationEntry_s
{
char name[ MAX_QPATH ];
-
+
char postCmds[ MAX_QPATH ][ MAX_MAP_COMMANDS ];
int numCmds;
@@ -971,7 +972,7 @@ typedef struct mapRotationEntry_s
typedef struct mapRotation_s
{
char name[ MAX_QPATH ];
-
+
mapRotationEntry_t maps[ MAX_MAP_ROTATION_MAPS ];
int numMaps;
int currentMap;
@@ -989,7 +990,7 @@ qboolean G_StartMapRotation( char *name, qboolean changeMap );
void G_StopMapRotation( void );
qboolean G_MapRotationActive( void );
void G_InitMapRotations( void );
-
+
//
// g_ptr.c
//
diff --git a/src/game/g_main.c b/src/game/g_main.c
index abde0daf..700c5782 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -160,7 +160,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_smoothClients, "g_smoothClients", "1", 0, 0, qfalse},
{ &pmove_fixed, "pmove_fixed", "0", CVAR_SYSTEMINFO, 0, qfalse},
{ &pmove_msec, "pmove_msec", "8", CVAR_SYSTEMINFO, 0, qfalse},
-
+
{ &g_humanBuildPoints, "g_humanBuildPoints", "100", 0, 0, qfalse },
{ &g_alienBuildPoints, "g_alienBuildPoints", "100", 0, 0, qfalse },
{ &g_humanStage, "g_humanStage", "0", 0, 0, qfalse },
@@ -178,7 +178,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_currentMapRotation, "g_currentMapRotation", "-1", 0, 0, qfalse }, // -1 = NOT_ROTATING
{ &g_currentMap, "g_currentMap", "0", 0, 0, qfalse },
{ &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse },
-
+
{ &g_rankings, "g_rankings", "0", 0, 0, qfalse}
};
@@ -210,38 +210,38 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4,
case GAME_INIT:
G_InitGame( arg0, arg1, arg2 );
return 0;
-
+
case GAME_SHUTDOWN:
G_ShutdownGame( arg0 );
return 0;
-
+
case GAME_CLIENT_CONNECT:
return (int)ClientConnect( arg0, arg1, arg2 );
-
+
case GAME_CLIENT_THINK:
ClientThink( arg0 );
return 0;
-
+
case GAME_CLIENT_USERINFO_CHANGED:
ClientUserinfoChanged( arg0 );
return 0;
-
+
case GAME_CLIENT_DISCONNECT:
ClientDisconnect( arg0 );
return 0;
-
+
case GAME_CLIENT_BEGIN:
ClientBegin( arg0 );
return 0;
-
+
case GAME_CLIENT_COMMAND:
ClientCommand( arg0 );
return 0;
-
+
case GAME_RUN_FRAME:
G_RunFrame( arg0 );
return 0;
-
+
case GAME_CONSOLE_COMMAND:
return ConsoleCommand( );
}
@@ -265,7 +265,7 @@ void QDECL G_Printf( const char *fmt, ... )
Com_sprintf( clientText, 1048, "gprintf \"%s\"", text );
G_SendCommandFromServer( -1, clientText );
}
-
+
trap_Printf( text );
}
@@ -300,33 +300,33 @@ void G_FindTeams( void )
c = 0;
c2 = 0;
-
+
for( i = 1, e = g_entities+i; i < level.num_entities; i++, e++ )
{
if( !e->inuse )
continue;
-
+
if( !e->team )
continue;
-
+
if( e->flags & FL_TEAMSLAVE )
continue;
-
+
e->teammaster = e;
c++;
c2++;
-
+
for( j = i + 1, e2 = e + 1; j < level.num_entities; j++, e2++ )
{
if( !e2->inuse )
continue;
-
+
if( !e2->team )
continue;
-
+
if( e2->flags & FL_TEAMSLAVE )
continue;
-
+
if( !strcmp( e->team, e2->team ) )
{
c2++;
@@ -368,7 +368,7 @@ void G_RegisterCvars( void )
{
trap_Cvar_Register( cv->vmCvar, cv->cvarName,
cv->defaultString, cv->cvarFlags );
-
+
if( cv->vmCvar )
cv->modificationCount = cv->vmCvar->modificationCount;
@@ -436,13 +436,13 @@ static void G_GenerateParticleFileList( void )
numFiles = trap_FS_GetFileList( "scripts", ".particle", fileList, MAX_PARTICLE_FILES * MAX_QPATH );
filePtr = fileList;
-
+
for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 )
{
fileLen = strlen( filePtr );
strcpy( fileName, "scripts/" );
strcat( fileName, filePtr );
- trap_SetConfigstring( CS_PARTICLE_FILES + i, fileName );
+ trap_SetConfigstring( CS_PARTICLE_FILES + i, fileName );
}
}
@@ -483,7 +483,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
trap_FS_FOpenFile( g_log.string, &level.logFile, FS_APPEND_SYNC );
else
trap_FS_FOpenFile( g_log.string, &level.logFile, FS_APPEND );
-
+
if( !level.logFile )
G_Printf( "WARNING: Couldn't open logfile: %s\n", g_log.string );
else
@@ -491,7 +491,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
char serverinfo[ MAX_INFO_STRING ];
trap_GetServerinfo( serverinfo, sizeof( serverinfo ) );
-
+
G_LogPrintf( "------------------------------------------------------------\n" );
G_LogPrintf( "InitGame: %s\n", serverinfo );
}
@@ -522,7 +522,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
&level.clients[ 0 ].ps, sizeof( level.clients[ 0 ] ) );
trap_SetConfigstring( CS_INTERMISSION, "0" );
-
+
// parse the key/value pairs and spawn gentities
G_SpawnEntitiesFromString( );
@@ -537,7 +537,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
G_InitMapRotations( );
G_InitSpawnQueue( &level.alienSpawnQueue );
G_InitSpawnQueue( &level.humanSpawnQueue );
-
+
if( g_debugMapRotation.integer )
G_PrintRotations( );
@@ -653,7 +653,7 @@ Initialise a spawn queue
void G_InitSpawnQueue( spawnQueue_t *sq )
{
int i;
-
+
sq->back = sq->front = 0;
sq->back = QUEUE_MINUS1( sq->back );
@@ -678,7 +678,7 @@ int G_GetSpawnQueueLength( spawnQueue_t *sq )
while( length >= MAX_CLIENTS )
length -= MAX_CLIENTS;
-
+
return length;
}
@@ -692,13 +692,13 @@ Remove from front element from a spawn queue
int G_PopSpawnQueue( spawnQueue_t *sq )
{
int clientNum = sq->clients[ sq->front ];
-
+
if( G_GetSpawnQueueLength( sq ) > 0 )
{
sq->clients[ sq->front ] = -1;
sq->front = QUEUE_PLUS1( sq->front );
g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED;
-
+
return clientNum;
}
else
@@ -716,7 +716,7 @@ int G_PeekSpawnQueue( spawnQueue_t *sq )
{
return sq->clients[ sq->front ];
}
-
+
/*
============
G_PushSpawnQueue
@@ -755,13 +755,13 @@ qboolean G_RemoveFromSpawnQueue( spawnQueue_t *sq, int clientNum )
do
{
sq->clients[ i ] = sq->clients[ QUEUE_PLUS1( i ) ];
-
+
i = QUEUE_PLUS1( i );
} while( i != QUEUE_PLUS1( sq->back ) );
sq->back = QUEUE_MINUS1( sq->back );
g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED;
-
+
return qtrue;
}
@@ -815,7 +815,7 @@ void G_PrintSpawnQueue( spawnQueue_t *sq )
int length = G_GetSpawnQueueLength( sq );
G_Printf( "l:%d f:%d b:%d :", length, sq->front, sq->back );
-
+
if( length > 0 )
{
do
@@ -871,7 +871,7 @@ void G_SpawnClients( pTeam_t team )
if( clientNum < 0 )
return;
-
+
ent = &g_entities[ clientNum ];
ent->client->sess.sessionTeam = TEAM_FREE;
@@ -895,7 +895,7 @@ void G_CountSpawns( void )
level.numAlienSpawns = 0;
level.numHumanSpawns = 0;
-
+
for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ )
{
if( !ent->inuse )
@@ -903,11 +903,11 @@ void G_CountSpawns( void )
if( ent->s.modelindex == BA_A_SPAWN && ent->health > 0 )
level.numAlienSpawns++;
-
+
if( ent->s.modelindex == BA_H_SPAWN && ent->health > 0 )
level.numHumanSpawns++;
}
-
+
//let the client know how many spawns there are
trap_SetConfigstring( CS_SPAWNS, va( "%d %d",
level.numAlienSpawns, level.numHumanSpawns ) );
@@ -942,13 +942,13 @@ void G_CalculateBuildPoints( void )
localHTP = g_humanBuildPoints.integer;
localATP = g_alienBuildPoints.integer;
}
-
+
level.humanBuildPoints = level.humanBuildPointsPowered = localHTP;
level.alienBuildPoints = localATP;
level.reactorPresent = qfalse;
level.overmindPresent = qfalse;
-
+
for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ )
{
if( !ent->inuse )
@@ -958,7 +958,7 @@ void G_CalculateBuildPoints( void )
continue;
buildable = ent->s.modelindex;
-
+
if( buildable != BA_NONE )
{
if( buildable == BA_H_REACTOR && ent->spawned && ent->health > 0 )
@@ -987,13 +987,13 @@ void G_CalculateBuildPoints( void )
level.humanBuildPointsPowered -= level.humanBuildPoints;
level.humanBuildPoints = 0;
}
-
+
if( level.alienBuildPoints < 0 )
{
localATP -= level.alienBuildPoints;
level.alienBuildPoints = 0;
}
-
+
trap_SetConfigstring( CS_BUILDPOINTS,
va( "%d %d %d %d %d", level.alienBuildPoints,
localATP,
@@ -1009,24 +1009,24 @@ void G_CalculateBuildPoints( void )
if( alienPlayerCountMod < 0.1f )
alienPlayerCountMod = 0.1f;
-
+
if( humanPlayerCountMod < 0.1f )
humanPlayerCountMod = 0.1f;
-
+
if( g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 )
alienNextStageThreshold = (int)( ceil( (float)g_alienStage2Threshold.integer * alienPlayerCountMod ) );
else if( g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 )
alienNextStageThreshold = (int)( ceil( (float)g_alienStage3Threshold.integer * alienPlayerCountMod ) );
else
alienNextStageThreshold = -1;
-
+
if( g_humanStage.integer == S1 && g_humanMaxStage.integer > S1 )
humanNextStageThreshold = (int)( ceil( (float)g_humanStage2Threshold.integer * humanPlayerCountMod ) );
else if( g_humanStage.integer == S2 && g_humanMaxStage.integer > S2 )
humanNextStageThreshold = (int)( ceil( (float)g_humanStage3Threshold.integer * humanPlayerCountMod ) );
else
humanNextStageThreshold = -1;
-
+
trap_SetConfigstring( CS_STAGES, va( "%d %d %d %d %d %d",
g_alienStage.integer, g_humanStage.integer,
g_alienKills.integer, g_humanKills.integer,
@@ -1046,10 +1046,10 @@ void G_CalculateStages( void )
if( alienPlayerCountMod < 0.1f )
alienPlayerCountMod = 0.1f;
-
+
if( humanPlayerCountMod < 0.1f )
humanPlayerCountMod = 0.1f;
-
+
if( g_alienKills.integer >=
(int)( ceil( (float)g_alienStage2Threshold.integer * alienPlayerCountMod ) ) &&
g_alienStage.integer == S1 && g_alienMaxStage.integer > S1 )
@@ -1057,7 +1057,7 @@ void G_CalculateStages( void )
G_Checktrigger_stages( PTE_ALIENS, S2 );
trap_Cvar_Set( "g_alienStage", va( "%d", S2 ) );
}
-
+
if( g_alienKills.integer >=
(int)( ceil( (float)g_alienStage3Threshold.integer * alienPlayerCountMod ) ) &&
g_alienStage.integer == S2 && g_alienMaxStage.integer > S2 )
@@ -1100,13 +1100,13 @@ void G_CalculateAvgPlayers( void )
level.numAlienSamples = 0;
trap_Cvar_Set( "g_alienKills", "0" );
}
-
+
if( !level.numHumanClients )
{
level.numHumanSamples = 0;
trap_Cvar_Set( "g_humanKills", "0" );
}
-
+
//calculate average number of clients for stats
level.averageNumAlienClients =
( ( level.averageNumAlienClients * level.numAlienSamples )
@@ -1137,7 +1137,7 @@ void CalculateRanks( void )
int score;
int newScore;
gclient_t *cl;
-
+
level.follow1 = -1;
level.follow2 = -1;
level.numConnectedClients = 0;
@@ -1187,7 +1187,7 @@ void CalculateRanks( void )
level.numPlayingClients++;
if( !(g_entities[ i ].r.svFlags & SVF_BOT) )
level.numVotingClients++;
-
+
if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
level.numteamVotingClients[ 0 ]++;
else if( level.clients[ i ].ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
@@ -1213,7 +1213,7 @@ void CalculateRanks( void )
{
cl = &level.clients[ level.sortedClients[ i ] ];
newScore = cl->ps.persistant[ PERS_SCORE ];
-
+
if( i == 0 || newScore != score )
{
rank = i;
@@ -1226,7 +1226,7 @@ void CalculateRanks( void )
level.clients[ level.sortedClients[ i - 1 ] ].ps.persistant[ PERS_RANK ] = rank;
level.clients[ level.sortedClients[ i ] ].ps.persistant[ PERS_RANK ] = rank;
}
-
+
score = newScore;
}
@@ -1296,10 +1296,10 @@ If a new client connects, this will be called after the spawn function.
*/
void MoveClientToIntermission( gentity_t *ent )
{
- // take out of follow mode if needed
- if( ent->client->sess.spectatorState == SPECTATOR_FOLLOW )
- G_StopFollowing( ent );
-
+ // take out of follow mode if needed
+ if( ent->client->sess.spectatorState == SPECTATOR_FOLLOW )
+ G_StopFollowing( ent );
+
// move to the spot
VectorCopy( level.intermission_origin, ent->s.origin );
VectorCopy( level.intermission_origin, ent->client->ps.origin );
@@ -1332,7 +1332,7 @@ void FindIntermissionPoint( void )
// find the intermission spot
ent = G_Find( NULL, FOFS( classname ), "info_player_intermission" );
-
+
if( !ent )
{ // the map creator forgot to put in an intermission point...
SelectSpawnPoint( vec3_origin, level.intermission_origin, level.intermission_angle );
@@ -1345,7 +1345,7 @@ void FindIntermissionPoint( void )
if( ent->target )
{
target = G_PickTarget( ent->target );
-
+
if( target )
{
VectorSubtract( target->s.origin, level.intermission_origin, dir );
@@ -1376,14 +1376,14 @@ void BeginIntermission( void )
for( i = 0; i < level.maxclients; i++ )
{
client = g_entities + i;
-
+
if( !client->inuse )
continue;
-
+
// respawn if dead
if( client->health <= 0 )
respawn(client);
-
+
MoveClientToIntermission( client );
}
@@ -1506,7 +1506,7 @@ void LogExit( const char *string )
if( cl->ps.stats[ STAT_PTEAM ] == PTE_NONE )
continue;
-
+
if( cl->pers.connected == CON_CONNECTING )
continue;
@@ -1555,7 +1555,7 @@ void CheckIntermissionExit( void )
ExitLevel( );
return;
}
-
+
// see which players are ready
ready = 0;
notReady = 0;
@@ -1566,7 +1566,7 @@ void CheckIntermissionExit( void )
cl = level.clients + i;
if( cl->pers.connected != CON_CONNECTED )
continue;
-
+
if( cl->ps.stats[ STAT_PTEAM ] == PTE_NONE )
continue;
@@ -1668,7 +1668,7 @@ void CheckExitRules( void )
level.intermissionQueued = 0;
BeginIntermission( );
}
-
+
return;
}
@@ -1677,12 +1677,12 @@ void CheckExitRules( void )
if( level.time - level.startTime >= g_timelimit.integer * 60000 )
{
G_SendCommandFromServer( -1, "print \"Timelimit hit\n\"" );
-
+
G_LogPrintf( "STATS T:L A:%f H:%f M:%s D:%d AS:%d HS:%d\n",
level.averageNumAlienClients, level.averageNumHumanClients,
s, level.time - level.startTime,
g_alienStage.integer, g_humanStage.integer );
-
+
level.lastWin = PTE_NONE;
LogExit( "Timelimit hit." );
return;
@@ -1702,7 +1702,7 @@ void CheckExitRules( void )
level.averageNumAlienClients, level.averageNumHumanClients,
s, level.time - level.startTime,
g_alienStage.integer, g_humanStage.integer );
-
+
LogExit( "Humans win." );
return;
}
@@ -1718,7 +1718,7 @@ void CheckExitRules( void )
level.averageNumAlienClients, level.averageNumHumanClients,
s, level.time - level.startTime,
g_alienStage.integer, g_humanStage.integer );
-
+
LogExit( "Aliens win." );
return;
}
@@ -1758,10 +1758,10 @@ void CheckVote( void )
else
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) );
}
-
+
if( !level.voteTime )
return;
-
+
if( level.time - level.voteTime >= VOTE_TIME )
{
if( level.voteYes > level.voteNo )
@@ -1795,7 +1795,7 @@ void CheckVote( void )
return;
}
}
-
+
level.voteTime = 0;
trap_SetConfigstring( CS_VOTE_TIME, "" );
}
@@ -1819,7 +1819,7 @@ void CheckTeamVote( int team )
if( !level.teamVoteTime[ cs_offset ] )
return;
-
+
if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME )
{
G_SendCommandFromServer( -1, "print \"Team vote failed\n\"" );
@@ -1844,7 +1844,7 @@ void CheckTeamVote( int team )
return;
}
}
-
+
level.teamVoteTime[ cs_offset ] = 0;
trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, "" );
}
@@ -1862,7 +1862,7 @@ void CheckCvars( void )
if( g_password.modificationCount != lastMod )
{
lastMod = g_password.modificationCount;
-
+
if( *g_password.string && Q_stricmp( g_password.string, "none" ) )
trap_Cvar_Set( "g_needpass", "1" );
else
@@ -1884,14 +1884,14 @@ void G_RunThink( gentity_t *ent )
thinktime = ent->nextthink;
if( thinktime <= 0 )
return;
-
+
if( thinktime > level.time )
return;
ent->nextthink = 0;
if( !ent->think )
G_Error( "NULL ent->think" );
-
+
ent->think( ent );
}
@@ -1930,7 +1930,7 @@ void G_RunFrame( int levelTime )
gentity_t *ent;
int msec;
int start, end;
-
+
// if we are waiting for the level to restart, do nothing
if( level.restarted )
return;
@@ -1951,7 +1951,7 @@ void G_RunFrame( int levelTime )
//
start = trap_Milliseconds( );
ent = &g_entities[ 0 ];
-
+
for( i = 0; i < level.num_entities; i++, ent++ )
{
if( !ent->inuse )
@@ -1970,7 +1970,7 @@ void G_RunFrame( int levelTime )
//ent->client->ps.events[1] = 0;
}
}
-
+
if( ent->freeAfterEvent )
{
// tempEntities or dropped items completely go away after their event
@@ -2013,13 +2013,13 @@ void G_RunFrame( int levelTime )
G_Physics( ent, msec );
continue;
}
-
+
if( ent->s.eType == ET_MOVER )
{
G_RunMover( ent );
continue;
}
-
+
if( i < MAX_CLIENTS )
{
G_RunClient( ent );
@@ -2031,16 +2031,16 @@ void G_RunFrame( int levelTime )
end = trap_Milliseconds();
start = trap_Milliseconds();
-
+
// perform final fixups on the players
ent = &g_entities[ 0 ];
-
+
for( i = 0; i < level.maxclients; i++, ent++ )
{
if( ent->inuse )
ClientEndFrame( ent );
}
-
+
end = trap_Milliseconds();
//TA:
@@ -2054,7 +2054,7 @@ void G_RunFrame( int levelTime )
//send any pending commands
G_ProcessCommandQueues( );
-
+
// see if it is time to end the level
CheckExitRules( );
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index c6010c34..fb98c4a8 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -32,7 +32,7 @@ static qboolean G_ParseMapCommandSection( mapRotationEntry_t *mre, char **text_p
while( 1 )
{
token = COM_Parse( text_p );
-
+
if( !token )
break;
@@ -53,7 +53,7 @@ static qboolean G_ParseMapCommandSection( mapRotationEntry_t *mre, char **text_p
Q_strcat( mre->postCmds[ mre->numCmds ], sizeof( mre->postCmds[ 0 ] ), " " );
token = COM_ParseExt( text_p, qfalse );
}
-
+
if( mre->numCmds == MAX_MAP_COMMANDS )
{
G_Printf( S_COLOR_RED "ERROR: maximum number of map commands (%d) reached\n",
@@ -85,7 +85,7 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
while( 1 )
{
token = COM_Parse( text_p );
-
+
if( !token )
break;
@@ -105,17 +105,17 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
G_Printf( S_COLOR_RED "ERROR: failed to parse map command section\n" );
return qfalse;
}
-
+
mnSet = qfalse;
continue;
}
else if( !Q_stricmp( token, "goto" ) )
{
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
mrc = &mre->conditions[ mre->numConditions ];
mrc->unconditional = qtrue;
Q_strncpyz( mrc->dest, token, sizeof( mrc->dest ) );
@@ -134,21 +134,21 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
else if( !Q_stricmp( token, "if" ) )
{
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
mrc = &mre->conditions[ mre->numConditions ];
-
+
if( !Q_stricmp( token, "numClients" ) )
{
mrc->lhs = MCV_NUMCLIENTS;
-
+
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
if( !Q_stricmp( token, "<" ) )
mrc->op = MCO_LT;
else if( !Q_stricmp( token, ">" ) )
@@ -160,23 +160,23 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
G_Printf( S_COLOR_RED "ERROR: invalid operator in expression: %s\n", token );
return qfalse;
}
-
+
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
mrc->numClients = atoi( token );
}
else if( !Q_stricmp( token, "lastWin" ) )
{
mrc->lhs = MCV_LASTWIN;
-
+
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
if( !Q_stricmp( token, "aliens" ) )
mrc->lastWin = PTE_ALIENS;
else if( !Q_stricmp( token, "humans" ) )
@@ -196,10 +196,10 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
}
token = COM_Parse( text_p );
-
+
if( !token )
break;
-
+
mrc->unconditional = qfalse;
Q_strncpyz( mrc->dest, token, sizeof( mrc->dest ) );
@@ -218,7 +218,7 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
return qtrue; //reached the end of this map rotation
mre = &mr->maps[ mr->numMaps ];
-
+
if( mr->numMaps == MAX_MAP_ROTATION_MAPS )
{
G_Printf( S_COLOR_RED "ERROR: maximum number of maps in one rotation (%d) reached\n",
@@ -227,7 +227,7 @@ static qboolean G_ParseMapRotation( mapRotation_t *mr, char **text_p )
}
else
mr->numMaps++;
-
+
Q_strncpyz( mre->name, token, sizeof( mre->name ) );
mnSet = qtrue;
}
@@ -263,7 +263,7 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
G_Printf( S_COLOR_RED "ERROR: map rotation file %s too long\n", fileName );
return qfalse;
}
-
+
trap_FS_Read( text, len, f );
text[ len ] = 0;
trap_FS_FCloseFile( f );
@@ -275,7 +275,7 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
while( 1 )
{
token = COM_Parse( &text_p );
-
+
if( !token )
break;
@@ -295,9 +295,9 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
return qfalse;
}
}
-
+
Q_strncpyz( mapRotations.rotations[ mapRotations.numRotations ].name, mrName, MAX_QPATH );
-
+
if( !G_ParseMapRotation( &mapRotations.rotations[ mapRotations.numRotations ], &text_p ) )
{
G_Printf( S_COLOR_RED "ERROR: %s: failed to parse map rotation %s\n", fileName, mrName );
@@ -306,7 +306,7 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
//start parsing particle systems again
mrNameSet = qfalse;
-
+
if( mapRotations.numRotations == MAX_MAP_ROTATIONS )
{
G_Printf( S_COLOR_RED "ERROR: maximum number of map rotations (%d) reached\n",
@@ -315,7 +315,7 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
}
else
mapRotations.numRotations++;
-
+
continue;
}
else
@@ -352,7 +352,7 @@ void G_PrintRotations( void )
int i, j, k;
G_Printf( "Map rotations as parsed:\n\n" );
-
+
for( i = 0; i < mapRotations.numRotations; i++ )
{
G_Printf( "rotation: %s\n{\n", mapRotations.rotations[ i ].name );
@@ -368,7 +368,7 @@ void G_PrintRotations( void )
}
G_Printf( " }\n" );
-
+
for( k = 0; k < mapRotations.rotations[ i ].maps[ j ].numConditions; k++ )
{
G_Printf( " conditional: %s\n",
@@ -376,10 +376,10 @@ void G_PrintRotations( void )
}
}
-
+
G_Printf( "}\n" );
}
-
+
G_Printf( "Total memory used: %d bytes\n", sizeof( mapRotations ) );
}
@@ -396,7 +396,7 @@ static int *G_GetCurrentMapArray( void )
int i = 0;
char text[ MAX_MAP_ROTATIONS * 2 ];
char *text_p, *token;
-
+
Q_strncpyz( text, g_currentMap.string, sizeof( text ) );
text_p = text;
@@ -404,16 +404,16 @@ static int *G_GetCurrentMapArray( void )
while( 1 )
{
token = COM_Parse( &text_p );
-
+
if( !token )
break;
if( !Q_stricmp( token, "" ) )
break;
-
+
currentMap[ i++ ] = atoi( token );
}
-
+
return currentMap;
}
@@ -429,7 +429,7 @@ static void G_SetCurrentMap( int currentMap, int rotation )
char text[ MAX_MAP_ROTATIONS * 2 ] = { 0 };
int *p = G_GetCurrentMapArray( );
int i;
-
+
p[ rotation ] = currentMap;
for( i = 0; i < mapRotations.numRotations; i++ )
@@ -449,7 +449,7 @@ Return the current map in some rotation
static int G_GetCurrentMap( int rotation )
{
int *p = G_GetCurrentMapArray( );
-
+
return p[ rotation ];
}
@@ -465,10 +465,10 @@ static void G_IssueMapChange( int rotation )
int i;
int map = G_GetCurrentMap( rotation );
char cmd[ MAX_TOKEN_CHARS ];
-
+
trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n",
mapRotations.rotations[ rotation ].maps[ map ].name ) );
-
+
for( i = 0; i < mapRotations.rotations[ rotation ].maps[ map ].numCmds; i++ )
{
Q_strncpyz( cmd, mapRotations.rotations[ rotation ].maps[ map ].postCmds[ i ],
@@ -498,7 +498,7 @@ static mapConditionType_t G_ResolveConditionDestination( int *n, char *name )
return MCT_MAP;
}
}
-
+
//...then search the rotation names
for( i = 0; i < mapRotations.numRotations; i++ )
{
@@ -508,7 +508,7 @@ static mapConditionType_t G_ResolveConditionDestination( int *n, char *name )
return MCT_ROTATION;
}
}
-
+
//this should probably be prevented by a 2nd pass at compile time
//but i'm lazy (FIXME)
return MCT_ERR;
@@ -555,7 +555,7 @@ static qboolean G_EvaluateMapCondition( mapRotationCondition_t *mrc )
G_Printf( S_COLOR_RED "ERROR: malformed map switch condition\n" );
break;
}
-
+
return qfalse;
}
@@ -577,9 +577,9 @@ qboolean G_AdvanceMapRotation( void )
if( ( currentRotation = g_currentMapRotation.integer ) == NOT_ROTATING )
return qfalse;
-
+
currentMap = G_GetCurrentMap( currentRotation );
-
+
mr = &mapRotations.rotations[ currentRotation ];
mre = &mr->maps[ currentMap ];
nextMap = ( currentMap + 1 ) % mr->numMaps;
@@ -591,7 +591,7 @@ qboolean G_AdvanceMapRotation( void )
if( mrc->unconditional || G_EvaluateMapCondition( mrc ) )
{
mct = G_ResolveConditionDestination( &n, mrc->dest );
-
+
switch( mct )
{
case MCT_MAP:
@@ -611,7 +611,7 @@ qboolean G_AdvanceMapRotation( void )
}
}
}
-
+
G_SetCurrentMap( nextMap, currentRotation );
G_IssueMapChange( currentRotation );
@@ -641,7 +641,7 @@ qboolean G_StartMapRotation( char *name, qboolean changeMap )
break;
}
}
-
+
if( i == mapRotations.numRotations )
return qfalse;
else
@@ -689,7 +689,7 @@ void G_InitMapRotations( void )
if( trap_FS_FOpenFile( fileName, &f, FS_READ ) > 0 )
{
trap_FS_FCloseFile( f );
-
+
if( !G_ParseMapRotationFile( fileName ) )
G_Printf( S_COLOR_RED "ERROR: failed to parse %s file\n", fileName );
}
diff --git a/src/game/g_mem.c b/src/game/g_mem.c
index c553859b..2f3ed5c7 100644
--- a/src/game/g_mem.c
+++ b/src/game/g_mem.c
@@ -8,194 +8,194 @@
#include "g_local.h"
-#define POOLSIZE (256 * 1024)
-#define FREEMEMCOOKIE ((int)0xDEADBE3F) // Any unlikely to be used value
-#define ROUNDBITS 31 // Round to 32 bytes
+#define POOLSIZE (256 * 1024)
+#define FREEMEMCOOKIE ((int)0xDEADBE3F) // Any unlikely to be used value
+#define ROUNDBITS 31 // Round to 32 bytes
struct freememnode
{
- // Size of ROUNDBITS
- int cookie, size; // Size includes node (obviously)
- struct freememnode *prev, *next;
+ // Size of ROUNDBITS
+ int cookie, size; // Size includes node (obviously)
+ struct freememnode *prev, *next;
};
-static char memoryPool[POOLSIZE];
+static char memoryPool[POOLSIZE];
static struct freememnode *freehead;
-static int freemem;
+static int freemem;
void *G_Alloc( int size )
{
- // Find a free block and allocate.
- // Does two passes, attempts to fill same-sized free slot first.
-
- struct freememnode *fmn, *prev, *next, *smallest;
- int allocsize, smallestsize;
- char *endptr;
- int *ptr;
-
- allocsize = ( size + sizeof(int) + ROUNDBITS ) & ~ROUNDBITS; // Round to 32-byte boundary
- ptr = NULL;
-
- smallest = NULL;
- smallestsize = POOLSIZE + 1; // Guaranteed not to miss any slots :)
- for( fmn = freehead; fmn; fmn = fmn->next )
- {
- if( fmn->cookie != FREEMEMCOOKIE )
- G_Error( "G_Alloc: Memory corruption detected!\n" );
-
- if( fmn->size >= allocsize )
- {
- // We've got a block
- if( fmn->size == allocsize )
- {
- // Same size, just remove
-
- prev = fmn->prev;
- next = fmn->next;
- if( prev )
- prev->next = next; // Point previous node to next
- if( next )
- next->prev = prev; // Point next node to previous
- if( fmn == freehead )
- freehead = next; // Set head pointer to next
- ptr = (int *) fmn;
- break; // Stop the loop, this is fine
- }
- else
+ // Find a free block and allocate.
+ // Does two passes, attempts to fill same-sized free slot first.
+
+ struct freememnode *fmn, *prev, *next, *smallest;
+ int allocsize, smallestsize;
+ char *endptr;
+ int *ptr;
+
+ allocsize = ( size + sizeof(int) + ROUNDBITS ) & ~ROUNDBITS; // Round to 32-byte boundary
+ ptr = NULL;
+
+ smallest = NULL;
+ smallestsize = POOLSIZE + 1; // Guaranteed not to miss any slots :)
+ for( fmn = freehead; fmn; fmn = fmn->next )
+ {
+ if( fmn->cookie != FREEMEMCOOKIE )
+ G_Error( "G_Alloc: Memory corruption detected!\n" );
+
+ if( fmn->size >= allocsize )
+ {
+ // We've got a block
+ if( fmn->size == allocsize )
{
- // Keep track of the smallest free slot
- if( fmn->size < smallestsize )
- {
- smallest = fmn;
- smallestsize = fmn->size;
- }
- }
- }
- }
-
- if( !ptr && smallest )
- {
- // We found a slot big enough
- smallest->size -= allocsize;
- endptr = (char *) smallest + smallest->size;
- ptr = (int *) endptr;
- }
-
- if( ptr )
- {
- freemem -= allocsize;
- if( g_debugAlloc.integer )
- G_Printf( "G_Alloc of %i bytes (%i left)\n", allocsize, freemem );
- memset( ptr, 0, allocsize );
- *ptr++ = allocsize; // Store a copy of size for deallocation
- return( (void *) ptr );
- }
-
- G_Error( "G_Alloc: failed on allocation of %i bytes\n", size );
- return( NULL );
+ // Same size, just remove
+
+ prev = fmn->prev;
+ next = fmn->next;
+ if( prev )
+ prev->next = next; // Point previous node to next
+ if( next )
+ next->prev = prev; // Point next node to previous
+ if( fmn == freehead )
+ freehead = next; // Set head pointer to next
+ ptr = (int *) fmn;
+ break; // Stop the loop, this is fine
+ }
+ else
+ {
+ // Keep track of the smallest free slot
+ if( fmn->size < smallestsize )
+ {
+ smallest = fmn;
+ smallestsize = fmn->size;
+ }
+ }
+ }
+ }
+
+ if( !ptr && smallest )
+ {
+ // We found a slot big enough
+ smallest->size -= allocsize;
+ endptr = (char *) smallest + smallest->size;
+ ptr = (int *) endptr;
+ }
+
+ if( ptr )
+ {
+ freemem -= allocsize;
+ if( g_debugAlloc.integer )
+ G_Printf( "G_Alloc of %i bytes (%i left)\n", allocsize, freemem );
+ memset( ptr, 0, allocsize );
+ *ptr++ = allocsize; // Store a copy of size for deallocation
+ return( (void *) ptr );
+ }
+
+ G_Error( "G_Alloc: failed on allocation of %i bytes\n", size );
+ return( NULL );
}
void G_Free( void *ptr )
{
- // Release allocated memory, add it to the free list.
-
- struct freememnode *fmn;
- char *freeend;
- int *freeptr;
-
- freeptr = ptr;
- freeptr--;
-
- freemem += *freeptr;
- if( g_debugAlloc.integer )
- G_Printf( "G_Free of %i bytes (%i left)\n", *freeptr, freemem );
-
- for( fmn = freehead; fmn; fmn = fmn->next )
- {
- freeend = ((char *) fmn) + fmn->size;
- if( freeend == (char *) freeptr )
- {
- // Released block can be merged to an existing node
-
- fmn->size += *freeptr; // Add size of node.
- return;
- }
- }
- // No merging, add to head of list
-
- fmn = (struct freememnode *) freeptr;
- fmn->size = *freeptr; // Set this first to avoid corrupting *freeptr
- fmn->cookie = FREEMEMCOOKIE;
- fmn->prev = NULL;
- fmn->next = freehead;
- freehead->prev = fmn;
- freehead = fmn;
+ // Release allocated memory, add it to the free list.
+
+ struct freememnode *fmn;
+ char *freeend;
+ int *freeptr;
+
+ freeptr = ptr;
+ freeptr--;
+
+ freemem += *freeptr;
+ if( g_debugAlloc.integer )
+ G_Printf( "G_Free of %i bytes (%i left)\n", *freeptr, freemem );
+
+ for( fmn = freehead; fmn; fmn = fmn->next )
+ {
+ freeend = ((char *) fmn) + fmn->size;
+ if( freeend == (char *) freeptr )
+ {
+ // Released block can be merged to an existing node
+
+ fmn->size += *freeptr; // Add size of node.
+ return;
+ }
+ }
+ // No merging, add to head of list
+
+ fmn = (struct freememnode *) freeptr;
+ fmn->size = *freeptr; // Set this first to avoid corrupting *freeptr
+ fmn->cookie = FREEMEMCOOKIE;
+ fmn->prev = NULL;
+ fmn->next = freehead;
+ freehead->prev = fmn;
+ freehead = fmn;
}
void G_InitMemory( void )
{
- // Set up the initial node
-
- freehead = (struct freememnode *)memoryPool;
- freehead->cookie = FREEMEMCOOKIE;
- freehead->size = POOLSIZE;
- freehead->next = NULL;
- freehead->prev = NULL;
- freemem = sizeof( memoryPool );
+ // Set up the initial node
+
+ freehead = (struct freememnode *)memoryPool;
+ freehead->cookie = FREEMEMCOOKIE;
+ freehead->size = POOLSIZE;
+ freehead->next = NULL;
+ freehead->prev = NULL;
+ freemem = sizeof( memoryPool );
}
void G_DefragmentMemory( void )
{
- // If there's a frenzy of deallocation and we want to
- // allocate something big, this is useful. Otherwise...
- // not much use.
-
- struct freememnode *startfmn, *endfmn, *fmn;
-
- for( startfmn = freehead; startfmn; )
- {
- endfmn = (struct freememnode *)(((char *) startfmn) + startfmn->size);
- for( fmn = freehead; fmn; )
- {
- if( fmn->cookie != FREEMEMCOOKIE )
- G_Error( "G_DefragmentMemory: Memory corruption detected!\n" );
-
- if( fmn == endfmn )
- {
- // We can add fmn onto startfmn.
-
- if( fmn->prev )
- fmn->prev->next = fmn->next;
- if( fmn->next )
- {
- if( !(fmn->next->prev = fmn->prev) )
- freehead = fmn->next; // We're removing the head node
- }
- startfmn->size += fmn->size;
- memset( fmn, 0, sizeof(struct freememnode) ); // A redundant call, really.
-
- startfmn = freehead;
- endfmn = fmn = NULL; // Break out of current loop
- }
- else
- fmn = fmn->next;
- }
-
- if( endfmn )
- startfmn = startfmn->next; // endfmn acts as a 'restart' flag here
- }
+ // If there's a frenzy of deallocation and we want to
+ // allocate something big, this is useful. Otherwise...
+ // not much use.
+
+ struct freememnode *startfmn, *endfmn, *fmn;
+
+ for( startfmn = freehead; startfmn; )
+ {
+ endfmn = (struct freememnode *)(((char *) startfmn) + startfmn->size);
+ for( fmn = freehead; fmn; )
+ {
+ if( fmn->cookie != FREEMEMCOOKIE )
+ G_Error( "G_DefragmentMemory: Memory corruption detected!\n" );
+
+ if( fmn == endfmn )
+ {
+ // We can add fmn onto startfmn.
+
+ if( fmn->prev )
+ fmn->prev->next = fmn->next;
+ if( fmn->next )
+ {
+ if( !(fmn->next->prev = fmn->prev) )
+ freehead = fmn->next; // We're removing the head node
+ }
+ startfmn->size += fmn->size;
+ memset( fmn, 0, sizeof(struct freememnode) ); // A redundant call, really.
+
+ startfmn = freehead;
+ endfmn = fmn = NULL; // Break out of current loop
+ }
+ else
+ fmn = fmn->next;
+ }
+
+ if( endfmn )
+ startfmn = startfmn->next; // endfmn acts as a 'restart' flag here
+ }
}
void Svcmd_GameMem_f( void )
{
- // Give a breakdown of memory
+ // Give a breakdown of memory
- struct freememnode *fmn;
+ struct freememnode *fmn;
- G_Printf( "Game memory status: %i out of %i bytes allocated\n", POOLSIZE - freemem, POOLSIZE );
+ G_Printf( "Game memory status: %i out of %i bytes allocated\n", POOLSIZE - freemem, POOLSIZE );
- for( fmn = freehead; fmn; fmn = fmn->next )
- G_Printf( " %dd: %d bytes free.\n", fmn, fmn->size );
- G_Printf( "Status complete.\n" );
+ for( fmn = freehead; fmn; fmn = fmn->next )
+ G_Printf( " %dd: %d bytes free.\n", fmn, fmn->size );
+ G_Printf( "Status complete.\n" );
}
diff --git a/src/game/g_misc.c b/src/game/g_misc.c
index 99eff1ab..b7172ea3 100644
--- a/src/game/g_misc.c
+++ b/src/game/g_misc.c
@@ -265,17 +265,17 @@ Spawn function for particle system
void SP_misc_particle_system( gentity_t *self )
{
char *s;
-
+
G_SetOrigin( self, self->s.origin );
G_SpawnString( "psName", "", &s );
-
+
//add the particle system to the client precache list
self->s.modelindex = G_ParticleSystemIndex( s );
if( self->spawnflags & 1 )
self->s.eFlags |= EF_NODRAW;
-
+
self->use = SP_use_particle_system;
self->s.eType = ET_PARTICLE_SYSTEM;
trap_LinkEntity( self );
@@ -323,16 +323,16 @@ void SP_misc_anim_model( gentity_t *self )
self->s.weapon = (int)self->animation[ 1 ];
self->s.torsoAnim = (int)self->animation[ 2 ];
self->s.legsAnim = (int)self->animation[ 3 ];
-
+
self->s.angles2[ 0 ] = self->pos2[ 0 ];
-
+
//add the model to the client precache list
self->s.modelindex = G_ModelIndex( self->model );
self->use = SP_use_anim_model;
self->s.eType = ET_ANIMMAPOBJ;
-
+
trap_LinkEntity( self );
}
@@ -405,18 +405,18 @@ void SP_misc_light_flare( gentity_t *self )
self->s.eType = ET_LIGHTFLARE;
self->s.modelindex = G_ShaderIndex( self->targetShaderName );
VectorCopy( self->pos2, self->s.origin2 );
-
+
//try to find a spot near to the flare which is empty. This
//is used to facilitate visibility testing
findEmptySpot( self->s.origin, 8.0f, self->s.angles2 );
-
+
self->use = SP_use_light_flare;
-
+
G_SpawnFloat( "speed", "200", &self->speed );
self->s.time = self->speed;
G_SpawnInt( "mindist", "0", &self->s.generic1 );
-
+
if( self->spawnflags & 1 )
self->s.eFlags |= EF_NODRAW;
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 1d30974d..c55ab11f 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -112,19 +112,19 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) )
{
G_BounceMissile( ent, trace );
-
+
//only play a sound if requested
if( !( ent->s.eFlags & EF_NO_BOUNCE_SOUND ) )
G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 );
return;
}
-
+
if( !strcmp( ent->classname, "grenade" ) )
{
//grenade doesn't explode on impact
G_BounceMissile( ent, trace );
-
+
//only play a sound if requested
if( !( ent->s.eFlags & EF_NO_BOUNCE_SOUND ) )
G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 );
@@ -159,7 +159,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
G_Printf( S_COLOR_YELLOW "WARNING: hive entity has no parent in G_MissileImpact\n" );
else
ent->parent->active = qfalse;
-
+
G_FreeEntity( ent );
return;
}
@@ -170,7 +170,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
ent->think = AHive_ReturnToHive;
ent->nextthink = level.time + FRAMETIME;
-
+
//only damage humans
if( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
returnAfterDamage = qtrue;
@@ -178,7 +178,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
return;
}
}
-
+
// impact damage
if( other->takedamage )
{
@@ -190,8 +190,8 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity );
if( VectorLength( velocity ) == 0 )
velocity[ 2 ] = 1; // stepped on a grenade
-
- G_Damage( other, ent, attacker, velocity, ent->s.origin, ent->damage,
+
+ G_Damage( other, ent, attacker, velocity, ent->s.origin, ent->damage,
0, ent->methodOfDeath );
}
}
@@ -223,7 +223,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace )
// splash damage (doesn't apply to person directly hit)
if( ent->splashDamage )
- G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,
+ G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,
other, ent->splashMethodOfDeath );
trap_LinkEntity( ent );
@@ -247,7 +247,7 @@ void G_RunMissile( gentity_t *ent )
// ignore interactions with the missile owner
passent = ent->r.ownerNum;
-
+
// trace a line from the previous position to the current position
trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, passent, ent->clipmask );
@@ -272,7 +272,7 @@ void G_RunMissile( gentity_t *ent )
// If grapple, reset owner
if( ent->parent && ent->parent->client && ent->parent->client->hook == ent )
ent->parent->client->hook = NULL;
-
+
G_FreeEntity( ent );
return;
}
@@ -332,7 +332,7 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir )
VectorCopy( start, bolt->r.currentOrigin );
return bolt;
-}
+}
//=============================================================================
@@ -533,7 +533,7 @@ void AHive_ReturnToHive( gentity_t *self )
G_Printf( S_COLOR_YELLOW "WARNING: AHive_ReturnToHive called with no self->parent\n" );
return;
}
-
+
trap_UnlinkEntity( self->parent );
trap_Trace( &tr, self->r.currentOrigin, self->r.mins, self->r.maxs,
self->parent->r.currentOrigin, self->r.ownerNum, self->clipmask );
@@ -554,7 +554,7 @@ void AHive_ReturnToHive( gentity_t *self )
{
VectorSubtract( self->parent->r.currentOrigin, self->r.currentOrigin, dir );
VectorNormalize( dir );
-
+
//change direction towards the hive
VectorScale( dir, HIVE_SPEED, self->s.pos.trDelta );
SnapVector( self->s.pos.trDelta ); // save net bandwidth
@@ -577,7 +577,7 @@ void AHive_SearchAndDestroy( gentity_t *self )
{
vec3_t dir;
trace_t tr;
-
+
trap_Trace( &tr, self->r.currentOrigin, self->r.mins, self->r.maxs,
self->target_ent->r.currentOrigin, self->r.ownerNum, self->clipmask );
@@ -595,7 +595,7 @@ void AHive_SearchAndDestroy( gentity_t *self )
{
VectorSubtract( self->target_ent->r.currentOrigin, self->r.currentOrigin, dir );
VectorNormalize( dir );
-
+
//change direction towards the player
VectorScale( dir, HIVE_SPEED, self->s.pos.trDelta );
SnapVector( self->s.pos.trDelta ); // save net bandwidth
diff --git a/src/game/g_mover.c b/src/game/g_mover.c
index 822b8129..c3879b5b 100644
--- a/src/game/g_mover.c
+++ b/src/game/g_mover.c
@@ -85,7 +85,7 @@ G_TransposeMatrix
void G_TransposeMatrix( vec3_t matrix[ 3 ], vec3_t transpose[ 3 ] )
{
int i, j;
-
+
for( i = 0; i < 3; i++ )
{
for( j = 0; j < 3; j++ )
@@ -141,7 +141,7 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v
pushed_p->ent = check;
VectorCopy( check->s.pos.trBase, pushed_p->origin );
VectorCopy( check->s.apos.trBase, pushed_p->angles );
-
+
if( check->client )
{
pushed_p->deltayaw = check->client->ps.delta_angles[ YAW ];
@@ -149,23 +149,23 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v
}
pushed_p++;
- // try moving the contacted entity
+ // try moving the contacted entity
// figure movement due to the pusher's amove
G_CreateRotationMatrix( amove, transpose );
G_TransposeMatrix( transpose, matrix );
-
+
if( check->client )
VectorSubtract( check->client->ps.origin, pusher->r.currentOrigin, org );
else
VectorSubtract( check->s.pos.trBase, pusher->r.currentOrigin, org );
-
+
VectorCopy( org, org2 );
G_RotatePoint( org2, matrix );
VectorSubtract( org2, org, move2 );
// add movement
VectorAdd( check->s.pos.trBase, move, check->s.pos.trBase );
VectorAdd( check->s.pos.trBase, move2, check->s.pos.trBase );
-
+
if( check->client )
{
VectorAdd( check->client->ps.origin, move, check->client->ps.origin );
@@ -179,7 +179,7 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v
check->s.groundEntityNum = -1;
block = G_TestEntityPosition( check );
-
+
if( !block )
{
// pushed ok
@@ -187,7 +187,7 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v
VectorCopy( check->client->ps.origin, check->r.currentOrigin );
else
VectorCopy( check->s.pos.trBase, check->r.currentOrigin );
-
+
trap_LinkEntity( check );
return qtrue;
}
@@ -196,13 +196,13 @@ qboolean G_TryPushingEntity( gentity_t *check, gentity_t *pusher, vec3_t move, v
// this is only relevent for riding entities, not pushed
// Sliding trapdoors can cause this.
VectorCopy( ( pushed_p - 1 )->origin, check->s.pos.trBase );
-
+
if( check->client )
VectorCopy( ( pushed_p - 1 )->origin, check->client->ps.origin );
VectorCopy( ( pushed_p - 1 )->angles, check->s.apos.trBase );
block = G_TestEntityPosition( check );
-
+
if( !block )
{
check->s.groundEntityNum = -1;
@@ -245,7 +245,7 @@ qboolean G_MoverPush( gentity_t *pusher, vec3_t move, vec3_t amove, gentity_t **
float radius;
radius = RadiusFromBounds( pusher->r.mins, pusher->r.maxs );
-
+
for( i = 0 ; i < 3 ; i++ )
{
mins[ i ] = pusher->r.currentOrigin[ i ] + move[ i ] - radius;
@@ -305,7 +305,7 @@ qboolean G_MoverPush( gentity_t *pusher, vec3_t move, vec3_t amove, gentity_t **
|| check->r.absmax[ 1 ] <= mins[ 1 ]
|| check->r.absmax[ 2 ] <= mins[ 2 ] )
continue;
-
+
// see if the ent's bbox is inside the pusher's final position
// this does allow a fast moving object to pass through a thin entity...
if( !G_TestEntityPosition( check ) )
@@ -336,16 +336,16 @@ qboolean G_MoverPush( gentity_t *pusher, vec3_t move, vec3_t amove, gentity_t **
{
VectorCopy( p->origin, p->ent->s.pos.trBase );
VectorCopy( p->angles, p->ent->s.apos.trBase );
-
+
if( p->ent->client )
{
p->ent->client->ps.delta_angles[ YAW ] = p->deltayaw;
VectorCopy( p->origin, p->ent->client->ps.origin );
}
-
+
trap_LinkEntity( p->ent );
}
-
+
return qfalse;
}
@@ -468,19 +468,19 @@ void SetMoverState( gentity_t *ent, moverState_t moverState, int time )
ent->s.pos.trTime = time;
ent->s.apos.trTime = time;
-
+
switch( moverState )
{
case MOVER_POS1:
VectorCopy( ent->pos1, ent->s.pos.trBase );
ent->s.pos.trType = TR_STATIONARY;
break;
-
+
case MOVER_POS2:
VectorCopy( ent->pos2, ent->s.pos.trBase );
ent->s.pos.trType = TR_STATIONARY;
break;
-
+
case MOVER_1TO2:
VectorCopy( ent->pos1, ent->s.pos.trBase );
VectorSubtract( ent->pos2, ent->pos1, delta );
@@ -488,7 +488,7 @@ void SetMoverState( gentity_t *ent, moverState_t moverState, int time )
VectorScale( delta, f, ent->s.pos.trDelta );
ent->s.pos.trType = TR_LINEAR_STOP;
break;
-
+
case MOVER_2TO1:
VectorCopy( ent->pos2, ent->s.pos.trBase );
VectorSubtract( ent->pos1, ent->pos2, delta );
@@ -501,12 +501,12 @@ void SetMoverState( gentity_t *ent, moverState_t moverState, int time )
VectorCopy( ent->pos1, ent->s.apos.trBase );
ent->s.apos.trType = TR_STATIONARY;
break;
-
+
case ROTATOR_POS2:
VectorCopy( ent->pos2, ent->s.apos.trBase );
ent->s.apos.trType = TR_STATIONARY;
break;
-
+
case ROTATOR_1TO2:
VectorCopy( ent->pos1, ent->s.apos.trBase );
VectorSubtract( ent->pos2, ent->pos1, delta );
@@ -514,7 +514,7 @@ void SetMoverState( gentity_t *ent, moverState_t moverState, int time )
VectorScale( delta, f, ent->s.apos.trDelta );
ent->s.apos.trType = TR_LINEAR_STOP;
break;
-
+
case ROTATOR_2TO1:
VectorCopy( ent->pos2, ent->s.apos.trBase );
VectorSubtract( ent->pos1, ent->pos2, delta );
@@ -525,20 +525,20 @@ void SetMoverState( gentity_t *ent, moverState_t moverState, int time )
case MODEL_POS1:
break;
-
+
case MODEL_POS2:
break;
default:
break;
}
-
+
if( moverState >= MOVER_POS1 && moverState <= MOVER_2TO1 )
BG_EvaluateTrajectory( &ent->s.pos, level.time, ent->r.currentOrigin );
if( moverState >= ROTATOR_POS1 && moverState <= ROTATOR_2TO1 )
BG_EvaluateTrajectory( &ent->s.apos, level.time, ent->r.currentAngles );
-
+
trap_LinkEntity( ent );
}
@@ -610,7 +610,7 @@ void Think_ClosedModelDoor( gentity_t *ent )
// close areaportals
if( ent->teammaster == ent || !ent->teammaster )
trap_AdjustAreaPortalState( ent, qfalse );
-
+
ent->moverState = MODEL_POS1;
}
@@ -654,14 +654,14 @@ void Think_CloseModelDoor( gentity_t *ent )
{
//set brush non-solid
trap_UnlinkEntity( ent->clipBrush );
-
+
ent->nextthink = level.time + ent->wait;
return;
}
-
+
//toggle door state
ent->s.legsAnim = qfalse;
-
+
// play sound
if( ent->sound2to1 )
G_AddEvent( ent, EV_GENERAL_SOUND, ent->sound2to1 );
@@ -682,7 +682,7 @@ void Think_OpenModelDoor( gentity_t *ent )
{
//set brush non-solid
trap_UnlinkEntity( ent->clipBrush );
-
+
// looping sound
ent->s.loopSound = ent->soundLoop;
@@ -691,7 +691,7 @@ void Think_OpenModelDoor( gentity_t *ent )
G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos2 );
ent->moverState = MODEL_POS2;
-
+
// return to pos1 after a delay
ent->think = Think_CloseModelDoor;
ent->nextthink = level.time + ent->wait;
@@ -762,7 +762,7 @@ void Reached_BinaryMover( gentity_t *ent )
// fire targets
if( !ent->activator )
ent->activator = ent;
-
+
G_UseTargets( ent, ent->activator );
}
else if( ent->moverState == ROTATOR_2TO1 )
@@ -796,7 +796,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
// if this is a non-client-usable door return
if( ent->targetname && other && other->client )
return;
-
+
// only the master should be used
if( ent->flags & FL_TEAMSLAVE )
{
@@ -833,7 +833,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
// only partway down before reversing
total = ent->s.pos.trDuration;
partial = level.time - ent->s.pos.trTime;
-
+
if( partial > total )
partial = total;
@@ -847,7 +847,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
// only partway up before reversing
total = ent->s.pos.trDuration;
partial = level.time - ent->s.pos.trTime;
-
+
if( partial > total )
partial = total;
@@ -883,7 +883,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
// only partway down before reversing
total = ent->s.apos.trDuration;
partial = level.time - ent->s.apos.trTime;
-
+
if( partial > total )
partial = total;
@@ -897,7 +897,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
// only partway up before reversing
total = ent->s.apos.trDuration;
partial = level.time - ent->s.apos.trTime;
-
+
if( partial > total )
partial = total;
@@ -910,7 +910,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
//toggle door state
ent->s.legsAnim = qtrue;
-
+
ent->think = Think_OpenModelDoor;
ent->nextthink = level.time + ent->speed;
@@ -965,7 +965,7 @@ void InitMover( gentity_t *ent )
// if the "color" or "light" keys are set, setup constantLight
lightSet = G_SpawnFloat( "light", "100", &light );
colorSet = G_SpawnVector( "color", "1 1 1", color );
-
+
if( lightSet || colorSet )
{
int r, g, b, i;
@@ -1010,7 +1010,7 @@ void InitMover( gentity_t *ent )
VectorScale( move, ent->speed, ent->s.pos.trDelta );
ent->s.pos.trDuration = distance * 1000 / ent->speed;
-
+
if( ent->s.pos.trDuration <= 0 )
ent->s.pos.trDuration = 1;
}
@@ -1045,31 +1045,31 @@ void InitRotator( gentity_t *ent )
// if the "color" or "light" keys are set, setup constantLight
lightSet = G_SpawnFloat( "light", "100", &light );
colorSet = G_SpawnVector( "color", "1 1 1", color );
-
+
if( lightSet || colorSet )
{
int r, g, b, i;
r = color[ 0 ] * 255;
-
+
if( r > 255 )
r = 255;
-
+
g = color[ 1 ] * 255;
-
+
if( g > 255 )
g = 255;
-
+
b = color[ 2 ] * 255;
-
+
if( b > 255 )
b = 255;
-
+
i = light / 4;
-
+
if( i > 255 )
i = 255;
-
+
ent->s.constantLight = r | ( g << 8 ) | ( b << 16 ) | ( i << 24 );
}
@@ -1089,13 +1089,13 @@ void InitRotator( gentity_t *ent )
// calculate time to reach second position from speed
VectorSubtract( ent->pos2, ent->pos1, move );
angle = VectorLength( move );
-
+
if( !ent->speed )
ent->speed = 120;
-
+
VectorScale( move, ent->speed, ent->s.apos.trDelta );
ent->s.apos.trDuration = angle * 1000 / ent->speed;
-
+
if( ent->s.apos.trDuration <= 0 )
ent->s.apos.trDuration = 1;
}
@@ -1148,7 +1148,7 @@ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_
axis = ent->count;
VectorClear( dir );
-
+
if( fabs( other->s.origin[ axis ] - ent->r.absmax[ axis ] ) <
fabs( other->s.origin[ axis ] - ent->r.absmin[ axis ] ) )
{
@@ -1160,15 +1160,15 @@ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_
origin[ axis ] = ent->r.absmax[ axis ] + 20;
dir[ axis ] = 1;
}
-
+
for( i = 0; i < 3; i++ )
{
if( i == axis )
continue;
-
+
origin[ i ] = ( ent->r.absmin[ i ] + ent->r.absmax[ i ] ) * 0.5;
}
-
+
vectoangles( dir, angles );
TeleportPlayer( other, origin, angles );
}
@@ -1188,7 +1188,7 @@ static void manualDoorTriggerSpectator( gentity_t *door, gentity_t *player )
gentity_t triggerHull;
int best, i;
vec3_t mins, maxs;
-
+
//don't skip a door that is already open
if( door->moverState == MOVER_1TO2 ||
door->moverState == MOVER_POS2 ||
@@ -1197,7 +1197,7 @@ static void manualDoorTriggerSpectator( gentity_t *door, gentity_t *player )
door->moverState == MODEL_1TO2 ||
door->moverState == MODEL_POS2 )
return;
-
+
// find the bounds of everything on the team
VectorCopy( door->r.absmin, mins );
VectorCopy( door->r.absmax, maxs );
@@ -1215,7 +1215,7 @@ static void manualDoorTriggerSpectator( gentity_t *door, gentity_t *player )
if( maxs[ i ] - mins[ i ] < maxs[ best ] - mins[ best ] )
best = i;
}
-
+
maxs[ best ] += 60;
mins[ best ] -= 60;
@@ -1239,11 +1239,11 @@ void manualTriggerSpectator( gentity_t *trigger, gentity_t *player )
gentity_t *targets[ MAX_GENTITIES ];
int i = 0, j;
float minDistance = (float)INFINITE;
-
+
//restrict this hack to trigger_multiple only for now
if( strcmp( trigger->classname, "trigger_multiple" ) )
return;
-
+
if( !trigger->target )
return;
@@ -1254,7 +1254,7 @@ void manualTriggerSpectator( gentity_t *trigger, gentity_t *player )
targets[ i++ ] = t;
else if( t == trigger )
G_Printf( "WARNING: Entity used itself.\n" );
-
+
if( !trigger->inuse )
{
G_Printf( "triggerity was removed while using targets\n" );
@@ -1266,12 +1266,12 @@ void manualTriggerSpectator( gentity_t *trigger, gentity_t *player )
if( i > 0 )
{
gentity_t *closest = NULL;
-
+
//pick the closest door
for( j = 0; j < i; j++ )
{
float d = Distance( player->r.currentOrigin, targets[ j ]->r.currentOrigin );
-
+
if( d < minDistance )
{
minDistance = d;
@@ -1295,7 +1295,7 @@ void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace )
//buildables don't trigger movers
if( other->s.eType == ET_BUILDABLE )
return;
-
+
if( other->client && other->client->sess.sessionTeam == TEAM_SPECTATOR )
{
// if the door is not open and not opening
@@ -1350,7 +1350,7 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent )
if( maxs[ i ] - mins[ i ] < maxs[ best ] - mins[ best ] )
best = i;
}
-
+
maxs[ best ] += 60;
mins[ best ] -= 60;
@@ -1404,7 +1404,7 @@ void SP_func_door( gentity_t *ent )
ent->sound2to1 = G_SoundIndex( s );
G_SpawnString( "sound1to2", "sound/movers/doors/dr1_strt.wav", &s );
ent->sound1to2 = G_SoundIndex( s );
-
+
G_SpawnString( "soundPos2", "sound/movers/doors/dr1_end.wav", &s );
ent->soundPos2 = G_SoundIndex( s );
G_SpawnString( "soundPos1", "sound/movers/doors/dr1_end.wav", &s );
@@ -1419,7 +1419,7 @@ void SP_func_door( gentity_t *ent )
// default wait of 2 seconds
if( !ent->wait )
ent->wait = 2;
-
+
ent->wait *= 1000;
// default lip of 8 units
@@ -1480,7 +1480,7 @@ void SP_func_door( gentity_t *ent )
* TOGGLE wait in both the start and end states for a trigger event.
* X_AXIS open on the X-axis instead of the Z-axis
* Y_AXIS open on the Y-axis instead of the Z-axis
- *
+ *
* You need to have an origin brush as part of this entity. The center of that brush will be
* the point around which it is rotated. It will rotate around the Z axis by default. You can
* check either the X_AXIS or Y_AXIS box to change that.
@@ -1500,7 +1500,7 @@ void SP_func_door_rotating( gentity_t *ent )
ent->sound2to1 = G_SoundIndex( s );
G_SpawnString( "sound1to2", "sound/movers/doors/dr1_strt.wav", &s );
ent->sound1to2 = G_SoundIndex( s );
-
+
G_SpawnString( "soundPos2", "sound/movers/doors/dr1_end.wav", &s );
ent->soundPos2 = G_SoundIndex( s );
G_SpawnString( "soundPos1", "sound/movers/doors/dr1_end.wav", &s );
@@ -1511,77 +1511,77 @@ void SP_func_door_rotating( gentity_t *ent )
//default speed of 120
if( !ent->speed )
ent->speed = 120;
-
+
// if speed is negative, positize it and add reverse flag
if( ent->speed < 0 )
{
ent->speed *= -1;
ent->spawnflags |= 8;
}
-
+
// default of 2 seconds
if( !ent->wait )
ent->wait = 2;
-
+
ent->wait *= 1000;
-
+
// set the axis of rotation
VectorClear( ent->movedir );
VectorClear( ent->s.angles );
-
+
if( ent->spawnflags & 32 )
ent->movedir[ 2 ] = 1.0;
else if( ent->spawnflags & 64 )
ent->movedir[ 0 ] = 1.0;
else
ent->movedir[ 1 ] = 1.0;
-
+
// reverse direction if necessary
if( ent->spawnflags & 8 )
VectorNegate ( ent->movedir, ent->movedir );
-
+
// default distance of 90 degrees. This is something the mapper should not
// leave out, so we'll tell him if he does.
if( !ent->rotatorAngle )
{
G_Printf( "%s at %s with no rotatorAngle set.\n",
ent->classname, vtos( ent->s.origin ) );
-
+
ent->rotatorAngle = 90.0;
}
-
+
VectorCopy( ent->s.angles, ent->pos1 );
trap_SetBrushModel( ent, ent->model );
VectorMA( ent->pos1, ent->rotatorAngle, ent->movedir, ent->pos2 );
-
+
// if "start_open", reverse position 1 and 2
if( ent->spawnflags & 1 )
{
vec3_t temp;
-
+
VectorCopy( ent->pos2, temp );
VectorCopy( ent->s.angles, ent->pos2 );
VectorCopy( temp, ent->pos1 );
VectorNegate( ent->movedir, ent->movedir );
}
-
+
// set origin
VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );
-
+
InitRotator( ent );
-
+
ent->nextthink = level.time + FRAMETIME;
-
+
if( !( ent->flags & FL_TEAMSLAVE ) )
{
int health;
-
+
G_SpawnInt( "health", "0", &health );
-
+
if( health )
ent->takedamage = qtrue;
-
+
if( ent->targetname || health )
{
// non touch/shoot doors
@@ -1618,7 +1618,7 @@ void SP_func_door_model( gentity_t *ent )
ent->sound2to1 = G_SoundIndex( s );
G_SpawnString( "sound1to2", "sound/movers/doors/dr1_strt.wav", &s );
ent->sound1to2 = G_SoundIndex( s );
-
+
G_SpawnString( "soundPos2", "sound/movers/doors/dr1_end.wav", &s );
ent->soundPos2 = G_SoundIndex( s );
G_SpawnString( "soundPos1", "sound/movers/doors/dr1_end.wav", &s );
@@ -1631,7 +1631,7 @@ void SP_func_door_model( gentity_t *ent )
//default wait of 2 seconds
if( ent->wait <= 0 )
ent->wait = 2;
-
+
ent->wait *= 1000;
//brush model
@@ -1640,18 +1640,18 @@ void SP_func_door_model( gentity_t *ent )
trap_SetBrushModel( clipBrush, clipBrush->model );
clipBrush->s.eType = ET_INVISIBLE;
trap_LinkEntity( clipBrush );
-
+
//copy the bounds back from the clipBrush so the
//triggers can be made
VectorCopy( clipBrush->r.absmin, ent->r.absmin );
VectorCopy( clipBrush->r.absmax, ent->r.absmax );
VectorCopy( clipBrush->r.mins, ent->r.mins );
VectorCopy( clipBrush->r.maxs, ent->r.maxs );
-
+
G_SpawnVector( "modelOrigin", "0 0 0", ent->s.origin );
G_SpawnVector( "scale", "1 1 1", ent->s.origin2 );
-
+
// if the "model2" key is set, use a seperate model
// for drawing, but clip against the brushes
if( !ent->model2 )
@@ -1666,7 +1666,7 @@ void SP_func_door_model( gentity_t *ent )
// if the "color" or "light" keys are set, setup constantLight
lightSet = G_SpawnFloat( "light", "100", &light );
colorSet = G_SpawnVector( "color", "1 1 1", color );
-
+
if( lightSet || colorSet )
{
int r, g, b, i;
@@ -1704,16 +1704,16 @@ void SP_func_door_model( gentity_t *ent )
ent->s.apos.trTime = 0;
ent->s.apos.trDuration = 0;
VectorClear( ent->s.apos.trDelta );
-
+
ent->s.powerups = (int)ent->animation[ 0 ]; //first frame
ent->s.weapon = abs( (int)ent->animation[ 1 ] ); //number of frames
-
+
//must be at least one frame -- mapper has forgotten animation key
if( ent->s.weapon == 0 )
ent->s.weapon = 1;
-
+
ent->s.torsoAnim = ent->s.weapon * ( 1000.0f / ent->speed ); //framerate
-
+
trap_LinkEntity( ent );
if( !( ent->flags & FL_TEAMSLAVE ) )
@@ -1809,7 +1809,7 @@ void SpawnPlatTrigger( gentity_t *ent )
tmin[ 0 ] = ent->pos1[ 0 ] + ( ent->r.mins[ 0 ] + ent->r.maxs[ 0 ] ) * 0.5;
tmax[ 0 ] = tmin[ 0 ] + 1;
}
-
+
if( tmax[ 1 ] <= tmin[ 1 ] )
{
tmin[ 1 ] = ent->pos1[ 1 ] + ( ent->r.mins[ 1 ] + ent->r.maxs[ 1 ] ) * 0.5;
@@ -1843,7 +1843,7 @@ void SP_func_plat( gentity_t *ent )
ent->sound2to1 = G_SoundIndex( s );
G_SpawnString( "sound1to2", "sound/movers/plats/pt1_strt.wav", &s );
ent->sound1to2 = G_SoundIndex( s );
-
+
G_SpawnString( "soundPos2", "sound/movers/plats/pt1_end.wav", &s );
ent->soundPos2 = G_SoundIndex( s );
G_SpawnString( "soundPos1", "sound/movers/plats/pt1_end.wav", &s );
@@ -1938,7 +1938,7 @@ void SP_func_button( gentity_t *ent )
if( !ent->wait )
ent->wait = 1;
-
+
ent->wait *= 1000;
// first position
@@ -2033,7 +2033,7 @@ void Reached_Train( gentity_t *ent )
// otherwise use the train's speed
speed = ent->speed;
}
-
+
if( speed < 1 )
speed = 1;
@@ -2056,7 +2056,7 @@ void Reached_Train( gentity_t *ent )
ent->s.pos.trType = TR_STATIONARY;
return;
}
-
+
// if there is a "wait" value on the target, don't start moving yet
if( next->wait )
{
@@ -2074,7 +2074,7 @@ Start_Train
void Start_Train( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
vec3_t move;
-
+
//recalculate duration as the mover is highly
//unlikely to be right on a path_corner
VectorSubtract( ent->pos2, ent->pos1, move );
@@ -2092,12 +2092,12 @@ Stop_Train
void Stop_Train( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
vec3_t origin;
-
+
//get current origin
BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );
VectorCopy( origin, ent->pos1 );
SetMoverState( ent, MOVER_POS1, level.time );
-
+
ent->spawnflags |= TRAIN_START_OFF;
}
@@ -2132,7 +2132,7 @@ void Think_SetupTrainTargets( gentity_t *ent )
gentity_t *path, *next, *start;
ent->nextTrain = G_Find( NULL, FOFS( targetname ), ent->target );
-
+
if( !ent->nextTrain )
{
G_Printf( "func_train at %s with an unfound target\n",
@@ -2160,7 +2160,7 @@ void Think_SetupTrainTargets( gentity_t *ent )
do
{
next = G_Find( next, FOFS( targetname ), path->target );
-
+
if( !next )
{
G_Printf( "Train corner at %s without a target path_corner\n",
@@ -2206,10 +2206,10 @@ void Blocked_Train( gentity_t *self, gentity_t *other )
Stop_Train( self, other, other );
else
{
- if( !other->client )
- {
+ if( !other->client )
+ {
//whatever is blocking the train isn't a client
-
+
//KILL!!1!!!
G_Damage( other, self, self, NULL, NULL, 10000, 0, MOD_CRUSH );
@@ -2219,7 +2219,7 @@ void Blocked_Train( gentity_t *self, gentity_t *other )
{
vec3_t dir;
gentity_t *tent;
-
+
if( other->biteam == BIT_ALIENS )
{
VectorCopy( other->s.origin2, dir );
@@ -2233,13 +2233,13 @@ void Blocked_Train( gentity_t *self, gentity_t *other )
tent->s.eventParm = DirToByte( dir );
}
}
-
+
//if it's still around free it
if( other )
G_FreeEntity( other );
-
+
return;
- }
+ }
G_Damage( other, self, self, NULL, NULL, 10000, 0, MOD_CRUSH );
}
@@ -2348,7 +2348,7 @@ void SP_func_rotating( gentity_t *ent )
ent->s.apos.trDelta[ 0 ] = ent->speed;
else
ent->s.apos.trDelta[ 1 ] = ent->speed;
-
+
if( !ent->damage )
ent->damage = 2;
@@ -2446,7 +2446,7 @@ void SP_func_pendulum( gentity_t *ent )
// find pendulum length
length = fabs( ent->r.mins[ 2 ] );
-
+
if( length < 8 )
length = 8;
diff --git a/src/game/g_physics.c b/src/game/g_physics.c
index 63abaf9e..c6c03f69 100644
--- a/src/game/g_physics.c
+++ b/src/game/g_physics.c
@@ -82,7 +82,7 @@ void G_Physics( gentity_t *ent, int msec )
trace_t tr;
int contents;
int mask;
-
+
// if groundentity has been set to -1, it may have been pushed off an edge
if( ent->s.groundEntityNum == -1 )
{
@@ -100,7 +100,7 @@ void G_Physics( gentity_t *ent, int msec )
ent->s.pos.trTime = level.time;
}
}
-
+
// trace a line from the previous position to the current position
if( ent->clipmask )
mask = ent->clipmask;
@@ -120,7 +120,7 @@ void G_Physics( gentity_t *ent, int msec )
VectorMA( origin, -2.0f, ent->s.origin2, origin );
trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, ent->s.number, mask );
-
+
if( tr.fraction == 1.0f )
ent->s.groundEntityNum = -1;
@@ -145,7 +145,7 @@ void G_Physics( gentity_t *ent, int msec )
// check think function
G_RunThink( ent );
- if( tr.fraction == 1.0f )
+ if( tr.fraction == 1.0f )
return;
// if it is in a nodrop volume, remove it
diff --git a/src/game/g_ptr.c b/src/game/g_ptr.c
index 861f4b87..f597a196 100644
--- a/src/game/g_ptr.c
+++ b/src/game/g_ptr.c
@@ -27,7 +27,7 @@ Callback to detect ptrc clashes
static qboolean G_CheckForUniquePTRC( int code )
{
int i;
-
+
if( code == 0 )
return qfalse;
@@ -36,7 +36,7 @@ static qboolean G_CheckForUniquePTRC( int code )
if( connections[ i ].ptrCode == code )
return qfalse;
}
-
+
return qtrue;
}
@@ -70,7 +70,7 @@ connectionRecord_t *G_GenerateNewConnection( gclient_t *client )
// this should be really random
srand( trap_Milliseconds( ) );
-
+
// there is a very very small possibility that this
// will loop infinitely
do
@@ -105,16 +105,16 @@ Check a PTR code for validity
qboolean G_VerifyPTRC( int code )
{
int i;
-
+
if( code == 0 )
return qfalse;
-
+
for( i = 0; i < MAX_CLIENTS; i++ )
{
if( connections[ i ].ptrCode == code )
return qtrue;
}
-
+
return qfalse;
}
@@ -128,7 +128,7 @@ Finds a connection for a given code
connectionRecord_t *G_FindConnectionForCode( int code )
{
int i;
-
+
if( code == 0 )
return NULL;
diff --git a/src/game/g_public.h b/src/game/g_public.h
index 2d639cad..e5652b79 100644
--- a/src/game/g_public.h
+++ b/src/game/g_public.h
@@ -33,13 +33,13 @@
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
#define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin
// for link position (missiles and movers)
-#define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient)
-#define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client
- // so that it can be updated for ping tools without
- // lagging clients
-#define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox
-#define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client
- // (entityShared_t->singleClient)
+#define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient)
+#define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client
+ // so that it can be updated for ping tools without
+ // lagging clients
+#define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox
+#define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client
+ // (entityShared_t->singleClient)
//===============================================================
diff --git a/src/game/g_session.c b/src/game/g_session.c
index d05e81e1..1dcb8883 100644
--- a/src/game/g_session.c
+++ b/src/game/g_session.c
@@ -36,22 +36,22 @@ Called on game shutdown
*/
void G_WriteClientSessionData( gclient_t *client )
{
- const char *s;
- const char *var;
-
- s = va( "%i %i %i %i %i %i %i",
- client->sess.sessionTeam,
- client->sess.spectatorTime,
- client->sess.spectatorState,
- client->sess.spectatorClient,
- client->sess.wins,
- client->sess.losses,
+ const char *s;
+ const char *var;
+
+ s = va( "%i %i %i %i %i %i %i",
+ client->sess.sessionTeam,
+ client->sess.spectatorTime,
+ client->sess.spectatorState,
+ client->sess.spectatorClient,
+ client->sess.wins,
+ client->sess.losses,
client->sess.teamLeader
- );
+ );
- var = va( "session%i", client - level.clients );
+ var = va( "session%i", client - level.clients );
- trap_Cvar_Set( var, s );
+ trap_Cvar_Set( var, s );
}
/*
@@ -63,26 +63,26 @@ Called on a reconnect
*/
void G_ReadSessionData( gclient_t *client )
{
- char s[ MAX_STRING_CHARS ];
- const char *var;
+ char s[ MAX_STRING_CHARS ];
+ const char *var;
// bk001205 - format
int teamLeader;
int spectatorState;
int sessionTeam;
- var = va( "session%i", client - level.clients );
- trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
+ var = va( "session%i", client - level.clients );
+ trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
- sscanf( s, "%i %i %i %i %i %i %i",
- &sessionTeam,
- &client->sess.spectatorTime,
- &spectatorState,
- &client->sess.spectatorClient,
- &client->sess.wins,
- &client->sess.losses,
+ sscanf( s, "%i %i %i %i %i %i %i",
+ &sessionTeam,
+ &client->sess.spectatorTime,
+ &spectatorState,
+ &client->sess.spectatorClient,
+ &client->sess.wins,
+ &client->sess.losses,
&teamLeader
- );
+ );
// bk001205 - format issues
client->sess.sessionTeam = (team_t)sessionTeam;
@@ -100,12 +100,12 @@ Called on a first-time connect
*/
void G_InitSessionData( gclient_t *client, char *userinfo )
{
- clientSession_t *sess;
- const char *value;
+ clientSession_t *sess;
+ const char *value;
- sess = &client->sess;
+ sess = &client->sess;
- // initial team determination
+ // initial team determination
value = Info_ValueForKey( userinfo, "team" );
if( value[ 0 ] == 's' )
{
@@ -114,18 +114,18 @@ void G_InitSessionData( gclient_t *client, char *userinfo )
}
else
{
- if( g_maxGameClients.integer > 0 &&
+ if( g_maxGameClients.integer > 0 &&
level.numNonSpectatorClients >= g_maxGameClients.integer )
sess->sessionTeam = TEAM_SPECTATOR;
else
sess->sessionTeam = TEAM_FREE;
}
- sess->spectatorState = SPECTATOR_FREE;
- sess->spectatorTime = level.time;
+ sess->spectatorState = SPECTATOR_FREE;
+ sess->spectatorTime = level.time;
sess->spectatorClient = -1;
- G_WriteClientSessionData( client );
+ G_WriteClientSessionData( client );
}
@@ -137,14 +137,14 @@ G_WriteSessionData
*/
void G_WriteSessionData( void )
{
- int i;
+ int i;
//TA: ?
- trap_Cvar_Set( "session", va( "%i", 0 ) );
+ trap_Cvar_Set( "session", va( "%i", 0 ) );
- for( i = 0 ; i < level.maxclients ; i++ )
+ for( i = 0 ; i < level.maxclients ; i++ )
{
- if( level.clients[ i ].pers.connected == CON_CONNECTED )
- G_WriteClientSessionData( &level.clients[ i ] );
- }
+ if( level.clients[ i ].pers.connected == CON_CONNECTED )
+ G_WriteClientSessionData( &level.clients[ i ] );
+ }
}
diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c
index 5e9e6da0..2c279757 100644
--- a/src/game/g_spawn.c
+++ b/src/game/g_spawn.c
@@ -231,7 +231,7 @@ spawn_t spawns[ ] =
//TA: extra bits
{ "info_alien_intermission", SP_info_alien_intermission },
{ "info_human_intermission", SP_info_human_intermission },
-
+
{ "info_null", SP_info_null },
{ "info_notnull", SP_info_notnull }, // use target_position instead
@@ -292,7 +292,7 @@ spawn_t spawns[ ] =
{ "misc_particle_system", SP_misc_particle_system },
{ "misc_anim_model", SP_misc_anim_model },
{ "misc_light_flare", SP_misc_light_flare },
-
+
{ 0, 0 }
};
@@ -348,7 +348,7 @@ qboolean G_CallSpawn( gentity_t *ent )
return qtrue;
}
}
-
+
G_Printf( "%s doesn't have a spawn function\n", ent->classname );
return qfalse;
}
@@ -421,39 +421,39 @@ void G_ParseField( const char *key, const char *value, gentity_t *ent )
case F_LSTRING:
*(char **)( b + f->ofs ) = G_NewString( value );
break;
-
+
case F_VECTOR:
sscanf( value, "%f %f %f", &vec[ 0 ], &vec[ 1 ], &vec[ 2 ] );
-
+
( (float *)( b + f->ofs ) )[ 0 ] = vec[ 0 ];
( (float *)( b + f->ofs ) )[ 1 ] = vec[ 1 ];
( (float *)( b + f->ofs ) )[ 2 ] = vec[ 2 ];
break;
-
+
case F_VECTOR4:
sscanf( value, "%f %f %f %f", &vec4[ 0 ], &vec4[ 1 ], &vec4[ 2 ], &vec4[ 3 ] );
-
+
( (float *)( b + f->ofs ) )[ 0 ] = vec4[ 0 ];
( (float *)( b + f->ofs ) )[ 1 ] = vec4[ 1 ];
( (float *)( b + f->ofs ) )[ 2 ] = vec4[ 2 ];
( (float *)( b + f->ofs ) )[ 3 ] = vec4[ 3 ];
break;
-
+
case F_INT:
*(int *)( b + f->ofs ) = atoi( value );
break;
-
+
case F_FLOAT:
*(float *)( b + f->ofs ) = atof( value );
break;
-
+
case F_ANGLEHACK:
v = atof( value );
( (float *)( b + f->ofs ) )[ 0 ] = 0;
( (float *)( b + f->ofs ) )[ 1 ] = v;
( (float *)( b + f->ofs ) )[ 2 ] = 0;
break;
-
+
default:
case F_IGNORE:
break;
@@ -479,7 +479,7 @@ void G_SpawnGEntityFromSpawnVars( void )
{
int i;
gentity_t *ent;
-
+
// get the next free entity
ent = G_Spawn( );
@@ -487,7 +487,7 @@ void G_SpawnGEntityFromSpawnVars( void )
G_ParseField( level.spawnVars[ i ][ 0 ], level.spawnVars[ i ][ 1 ], ent );
G_SpawnInt( "notq3a", "0", &i );
-
+
if( i )
{
G_FreeEntity( ent );
@@ -551,7 +551,7 @@ qboolean G_ParseSpawnVars( void )
// end of spawn string
return qfalse;
}
-
+
if( com_token[ 0 ] != '{' )
G_Error( "G_ParseSpawnVars: found %s when expecting {", com_token );
@@ -597,7 +597,7 @@ void SP_worldspawn( void )
char *s;
G_SpawnString( "classname", "", &s );
-
+
if( Q_stricmp( s, "worldspawn" ) )
G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index 0c5c3b27..efe76991 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -95,11 +95,11 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
s++;
if ( !*s )
break;
-
+
s++;
continue;
}
-
+
G_Printf( "Bad filter address: %s\n", s );
return qfalse;
}
@@ -107,15 +107,15 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
j = 0;
while( *s >= '0' && *s <= '9' )
num[ j++ ] = *s++;
-
+
num[ j ] = 0;
b[ i ] = atoi( num );
-
+
m[ i ] = 255;
if( !*s )
break;
-
+
s++;
}
@@ -132,43 +132,43 @@ UpdateIPBans
*/
static void UpdateIPBans( void )
{
- byte b[ 4 ];
- byte m[ 4 ];
- int i, j;
- char iplist_final[ MAX_CVAR_VALUE_STRING ];
- char ip[ 64 ];
-
- *iplist_final = 0;
-
- for( i = 0 ; i < numIPFilters ; i++ )
- {
- if( ipFilters[ i ].compare == 0xffffffff )
- continue;
-
- *(unsigned *)b = ipFilters[ i ].compare;
- *(unsigned *)m = ipFilters[ i ].mask;
- *ip = 0;
-
- for( j = 0 ; j < 4 ; j++ )
- {
- if( m[ j ] != 255 )
- Q_strcat( ip, sizeof( ip ), "*" );
- else
- Q_strcat( ip, sizeof( ip ), va( "%i", b[ j ] ) );
-
- Q_strcat( ip, sizeof( ip ), ( j < 3 ) ? "." : " " );
- }
-
- if( strlen( iplist_final ) + strlen( ip ) < MAX_CVAR_VALUE_STRING )
- Q_strcat( iplist_final, sizeof( iplist_final ), ip );
- else
- {
- Com_Printf( "g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n" );
- break;
- }
- }
-
- trap_Cvar_Set( "g_banIPs", iplist_final );
+ byte b[ 4 ];
+ byte m[ 4 ];
+ int i, j;
+ char iplist_final[ MAX_CVAR_VALUE_STRING ];
+ char ip[ 64 ];
+
+ *iplist_final = 0;
+
+ for( i = 0 ; i < numIPFilters ; i++ )
+ {
+ if( ipFilters[ i ].compare == 0xffffffff )
+ continue;
+
+ *(unsigned *)b = ipFilters[ i ].compare;
+ *(unsigned *)m = ipFilters[ i ].mask;
+ *ip = 0;
+
+ for( j = 0 ; j < 4 ; j++ )
+ {
+ if( m[ j ] != 255 )
+ Q_strcat( ip, sizeof( ip ), "*" );
+ else
+ Q_strcat( ip, sizeof( ip ), va( "%i", b[ j ] ) );
+
+ Q_strcat( ip, sizeof( ip ), ( j < 3 ) ? "." : " " );
+ }
+
+ if( strlen( iplist_final ) + strlen( ip ) < MAX_CVAR_VALUE_STRING )
+ Q_strcat( iplist_final, sizeof( iplist_final ), ip );
+ else
+ {
+ Com_Printf( "g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n" );
+ break;
+ }
+ }
+
+ trap_Cvar_Set( "g_banIPs", iplist_final );
}
/*
@@ -193,10 +193,10 @@ qboolean G_FilterPacket( char *from )
m[ i ] = m[ i ] * 10 + ( *p - '0' );
p++;
}
-
+
if( !*p || *p == ':' )
break;
-
+
i++, p++;
}
@@ -221,7 +221,7 @@ static void AddIP( char *str )
for( i = 0 ; i < numIPFilters ; i++ )
if( ipFilters[ i ].compare == 0xffffffff )
break; // free spot
-
+
if( i == numIPFilters )
{
if( numIPFilters == MAX_IPFILTERS )
@@ -229,7 +229,7 @@ static void AddIP( char *str )
G_Printf( "IP filter list is full\n" );
return;
}
-
+
numIPFilters++;
}
@@ -254,16 +254,16 @@ void G_ProcessIPBans( void )
for( t = s = g_banIPs.string; *t; /* */ )
{
s = strchr( s, ' ' );
-
+
if( !s )
break;
-
+
while( *s == ' ' )
*s++ = 0;
-
+
if( *t )
AddIP( t );
-
+
t = s;
}
}
@@ -338,14 +338,14 @@ void Svcmd_EntityList_f( void )
gentity_t *check;
check = g_entities + 1;
-
+
for( e = 1; e < level.num_entities; e++, check++ )
{
if( !check->inuse )
continue;
G_Printf( "%3i:", e );
-
+
switch( check->s.eType )
{
case ET_GENERAL:
@@ -394,7 +394,7 @@ void Svcmd_EntityList_f( void )
if( check->classname )
G_Printf( "%s", check->classname );
-
+
G_Printf( "\n" );
}
}
@@ -409,7 +409,7 @@ gclient_t *ClientForString( const char *s )
if( s[ 0 ] >= '0' && s[ 0 ] <= '9' )
{
idnum = atoi( s );
-
+
if( idnum < 0 || idnum >= level.maxclients )
{
Com_Printf( "Bad client slot: %i\n", idnum );
@@ -417,13 +417,13 @@ gclient_t *ClientForString( const char *s )
}
cl = &level.clients[ idnum ];
-
+
if( cl->pers.connected == CON_DISCONNECTED )
{
G_Printf( "Client %i is not connected\n", idnum );
return NULL;
}
-
+
return cl;
}
@@ -458,7 +458,7 @@ void Svcmd_ForceTeam_f( void )
// find the player
trap_Argv( 1, str, sizeof( str ) );
cl = ClientForString( str );
-
+
if( !cl )
return;
@@ -521,7 +521,7 @@ qboolean ConsoleCommand( void )
if( Q_stricmp( cmd, "mapRotation" ) == 0 )
{
char *rotationName = ConcatArgs( 1 );
-
+
if( !G_StartMapRotation( rotationName, qfalse ) )
G_Printf( "Can't find map rotation %s\n", rotationName );
@@ -539,7 +539,7 @@ qboolean ConsoleCommand( void )
{
int i;
gentity_t *e;
-
+
for( i = 1, e = g_entities + i; i < level.num_entities; i++, e++ )
{
if( e->s.modelindex == BA_H_SPAWN )
@@ -548,12 +548,12 @@ qboolean ConsoleCommand( void )
return qtrue;
}
-
+
if( Q_stricmp( cmd, "humanWin" ) == 0 )
{
int i;
gentity_t *e;
-
+
for( i = 1, e = g_entities + i; i < level.num_entities; i++, e++ )
{
if( e->s.modelindex == BA_A_SPAWN )
@@ -562,7 +562,7 @@ qboolean ConsoleCommand( void )
return qtrue;
}
-
+
if( g_dedicated.integer )
{
if( Q_stricmp( cmd, "say" ) == 0 )
@@ -570,12 +570,12 @@ qboolean ConsoleCommand( void )
G_SendCommandFromServer( -1, va( "print \"server: %s\n\"", ConcatArgs( 1 ) ) );
return qtrue;
}
-
+
// everything else will also be printed as a say command
G_SendCommandFromServer( -1, va( "print \"server: %s\n\"", ConcatArgs( 0 ) ) );
return qtrue;
}
-
+
return qfalse;
}
diff --git a/src/game/g_syscalls.c b/src/game/g_syscalls.c
index 6a3f70c4..93035395 100644
--- a/src/game/g_syscalls.c
+++ b/src/game/g_syscalls.c
@@ -46,7 +46,7 @@ void trap_Error( const char *fmt )
int trap_Milliseconds( void )
{
- return syscall( G_MILLISECONDS );
+ return syscall( G_MILLISECONDS );
}
int trap_Argc( void )
{
diff --git a/src/game/g_target.c b/src/game/g_target.c
index f57f173e..216b2550 100644
--- a/src/game/g_target.c
+++ b/src/game/g_target.c
@@ -88,7 +88,7 @@ void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator )
G_TeamCommand( PTE_HUMANS, va( "cp \"%s\"", ent->message ) );
if( ent->spawnflags & 2 )
G_TeamCommand( PTE_ALIENS, va( "cp \"%s\"", ent->message ) );
-
+
return;
}
@@ -191,9 +191,9 @@ void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activa
if( !activator->client )
return;
-
+
dest = G_PickTarget( self->target );
-
+
if( !dest )
{
G_Printf( "Couldn't find teleporter destination\n" );
@@ -239,7 +239,7 @@ void target_relay_use( gentity_t *self, gentity_t *other, gentity_t *activator )
ent = G_PickTarget( self->target );
if( ent && ent->use )
ent->use( ent, self, activator );
-
+
return;
}
@@ -328,31 +328,31 @@ target_rumble_think
*/
void target_rumble_think( gentity_t *self )
{
- int i;
- gentity_t *ent;
-
- if( self->last_move_time < level.time )
- self->last_move_time = level.time + 0.5;
-
- for( i = 0, ent = g_entities + i; i < level.num_entities; i++, ent++ )
- {
- if( !ent->inuse )
- continue;
-
- if( !ent->client )
- continue;
-
- if( ent->client->ps.groundEntityNum == ENTITYNUM_NONE )
- continue;
-
- ent->client->ps.groundEntityNum = ENTITYNUM_NONE;
- ent->client->ps.velocity[ 0 ] += crandom( ) * 150;
- ent->client->ps.velocity[ 1 ] += crandom( ) * 150;
- ent->client->ps.velocity[ 2 ] = self->speed;
- }
-
- if( level.time < self->timestamp )
- self->nextthink = level.time + FRAMETIME;
+ int i;
+ gentity_t *ent;
+
+ if( self->last_move_time < level.time )
+ self->last_move_time = level.time + 0.5;
+
+ for( i = 0, ent = g_entities + i; i < level.num_entities; i++, ent++ )
+ {
+ if( !ent->inuse )
+ continue;
+
+ if( !ent->client )
+ continue;
+
+ if( ent->client->ps.groundEntityNum == ENTITYNUM_NONE )
+ continue;
+
+ ent->client->ps.groundEntityNum = ENTITYNUM_NONE;
+ ent->client->ps.velocity[ 0 ] += crandom( ) * 150;
+ ent->client->ps.velocity[ 1 ] += crandom( ) * 150;
+ ent->client->ps.velocity[ 2 ] = self->speed;
+ }
+
+ if( level.time < self->timestamp )
+ self->nextthink = level.time + FRAMETIME;
}
/*
@@ -362,10 +362,10 @@ target_rumble_use
*/
void target_rumble_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
- self->timestamp = level.time + ( self->count * FRAMETIME );
- self->nextthink = level.time + FRAMETIME;
- self->activator = activator;
- self->last_move_time = 0;
+ self->timestamp = level.time + ( self->count * FRAMETIME );
+ self->nextthink = level.time + FRAMETIME;
+ self->activator = activator;
+ self->last_move_time = 0;
}
/*
@@ -375,18 +375,18 @@ SP_target_rumble
*/
void SP_target_rumble( gentity_t *self )
{
- if( !self->targetname )
+ if( !self->targetname )
{
- G_Printf( S_COLOR_YELLOW "WARNING: untargeted %s at %s\n", self->classname,
+ G_Printf( S_COLOR_YELLOW "WARNING: untargeted %s at %s\n", self->classname,
vtos( self->s.origin ) );
}
- if( !self->count )
- self->count = 10;
+ if( !self->count )
+ self->count = 10;
- if( !self->speed )
- self->speed = 100;
+ if( !self->speed )
+ self->speed = 100;
- self->think = target_rumble_think;
- self->use = target_rumble_use;
+ self->think = target_rumble_think;
+ self->use = target_rumble_use;
}
diff --git a/src/game/g_team.c b/src/game/g_team.c
index f4e035b9..ffe28c39 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -24,7 +24,7 @@ void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... )
char *p;
va_start( argptr,fmt );
-
+
if( vsprintf( msg, fmt, argptr ) > sizeof( msg ) )
G_Error ( "PrintMsg overrun" );
@@ -112,10 +112,10 @@ qboolean Team_GetLocationMsg( gentity_t *ent, char *loc, int loclen )
{
if( best->count < 0 )
best->count = 0;
-
+
if( best->count > 7 )
best->count = 7;
-
+
Com_sprintf( loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE, best->count + '0', best->message );
}
else
@@ -162,7 +162,7 @@ void TeamplayInfoMessage( gentity_t *ent )
for( i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++ )
{
player = g_entities + level.sortedClients[ i ];
-
+
if( player->inuse && player->client->sess.sessionTeam ==
ent->client->sess.sessionTeam )
clients[ cnt++ ] = level.sortedClients[ i ];
@@ -178,12 +178,12 @@ void TeamplayInfoMessage( gentity_t *ent )
for( i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++)
{
player = g_entities + i;
-
+
if( player->inuse && player->client->sess.sessionTeam ==
ent->client->sess.sessionTeam )
{
h = player->client->ps.stats[ STAT_HEALTH ];
-
+
if( h < 0 )
h = 0;
@@ -192,12 +192,12 @@ void TeamplayInfoMessage( gentity_t *ent )
// level.sortedClients[i], player->client->pers.teamState.location, h, a,
i, player->client->pers.teamState.location, h, a,
player->client->ps.weapon, player->s.powerups );
-
+
j = strlen( entry );
-
+
if( stringlength + j > sizeof( string ) )
break;
-
+
strcpy( string + stringlength, entry );
stringlength += j;
cnt++;
@@ -227,7 +227,7 @@ void CheckTeamStatus( void )
{
loc = Team_GetLocation( ent );
-
+
if( loc )
ent->client->pers.teamState.location = loc->health;
else
diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c
index aff816dc..e928cc69 100644
--- a/src/game/g_trigger.c
+++ b/src/game/g_trigger.c
@@ -149,8 +149,6 @@ void trigger_push_touch( gentity_t *self, gentity_t *other, trace_t *trace )
{
if( !other->client )
return;
-
- BG_TouchJumpPad( &other->client->ps, &self->s );
}
@@ -172,7 +170,7 @@ void AimAtTarget( gentity_t *self )
VectorScale( origin, 0.5, origin );
ent = G_PickTarget( self->target );
-
+
if( !ent )
{
G_FreeEntity( self );
@@ -182,7 +180,7 @@ void AimAtTarget( gentity_t *self )
height = ent->s.origin[ 2 ] - origin[ 2 ];
gravity = g_gravity.value;
time = sqrt( height / ( 0.5 * gravity ) );
-
+
if( !time )
{
G_FreeEntity( self );
@@ -266,7 +264,7 @@ void SP_target_push( gentity_t *self )
self->think = AimAtTarget;
self->nextthink = level.time + FRAMETIME;
}
-
+
self->use = Use_target_push;
}
@@ -284,7 +282,7 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace
if( !other->client )
return;
-
+
if( other->client->ps.pm_type == PM_DEAD )
return;
@@ -295,7 +293,7 @@ void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace
dest = G_PickTarget( self->target );
-
+
if( !dest )
{
G_Printf( "Couldn't find teleporter destination\n" );
@@ -386,7 +384,7 @@ void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace )
dflags = DAMAGE_NO_PROTECTION;
else
dflags = 0;
-
+
G_Damage( other, self, self, NULL, NULL, self->damage, dflags, MOD_TRIGGER_HURT );
}
@@ -572,7 +570,7 @@ void trigger_buildable_trigger( gentity_t *self, gentity_t *activator )
}
}
}
-
+
if( self->wait > 0 )
{
self->think = multi_wait;
@@ -598,7 +596,7 @@ void trigger_buildable_touch( gentity_t *ent, gentity_t *other, trace_t *trace )
//only triggered by buildables
if( other->s.eType != ET_BUILDABLE )
return;
-
+
trigger_buildable_trigger( ent, other );
}
@@ -632,9 +630,9 @@ void SP_trigger_buildable( gentity_t *self )
self->random = self->wait - FRAMETIME;
G_Printf( S_COLOR_YELLOW "WARNING: trigger_buildable has random >= wait\n" );
}
-
+
G_SpawnString( "buildables", "", &buffer );
-
+
p = q = buffer;
while( *p != '\0' )
@@ -645,19 +643,19 @@ void SP_trigger_buildable( gentity_t *self )
if( *p == '\0' )
EOS = qtrue;
-
+
*p = '\0';
//strip leading whitespace
while( *q == ' ' )
q++;
-
+
self->bTriggers[ i ] = BG_FindBuildNumForName( q );
if( self->bTriggers[ i ] == BA_NONE )
G_Printf( S_COLOR_YELLOW "WARNING: unknown buildable %s in trigger_buildable\n", q );
else
i++;
-
+
if( !EOS )
{
p++;
@@ -668,7 +666,7 @@ void SP_trigger_buildable( gentity_t *self )
}
self->bTriggers[ i ] = BA_NONE;
-
+
self->touch = trigger_buildable_touch;
self->use = trigger_buildable_use;
@@ -689,10 +687,10 @@ void trigger_class_trigger( gentity_t *self, gentity_t *activator )
//sanity check
if( !activator->client )
return;
-
+
if( activator->client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS )
return;
-
+
self->activator = activator;
if( self->nextthink )
return; // can't retrigger until the wait is over
@@ -712,7 +710,7 @@ void trigger_class_trigger( gentity_t *self, gentity_t *activator )
}
}
}
-
+
if( self->wait > 0 )
{
self->think = multi_wait;
@@ -738,7 +736,7 @@ void trigger_class_touch( gentity_t *ent, gentity_t *other, trace_t *trace )
//only triggered by clients
if( !other->client )
return;
-
+
trigger_class_trigger( ent, other );
}
@@ -772,9 +770,9 @@ void SP_trigger_class( gentity_t *self )
self->random = self->wait - FRAMETIME;
G_Printf( S_COLOR_YELLOW "WARNING: trigger_class has random >= wait\n" );
}
-
+
G_SpawnString( "classes", "", &buffer );
-
+
p = q = buffer;
while( *p != '\0' )
@@ -785,19 +783,19 @@ void SP_trigger_class( gentity_t *self )
if( *p == '\0' )
EOS = qtrue;
-
+
*p = '\0';
//strip leading whitespace
while( *q == ' ' )
q++;
-
+
self->cTriggers[ i ] = BG_FindClassNumForName( q );
if( self->cTriggers[ i ] == PCL_NONE )
G_Printf( S_COLOR_YELLOW "WARNING: unknown class %s in trigger_class\n", q );
else
i++;
-
+
if( !EOS )
{
p++;
@@ -808,7 +806,7 @@ void SP_trigger_class( gentity_t *self )
}
self->cTriggers[ i ] = PCL_NONE;
-
+
self->touch = trigger_class_touch;
self->use = trigger_class_use;
@@ -832,7 +830,7 @@ void trigger_equipment_trigger( gentity_t *self, gentity_t *activator )
if( activator->client->ps.stats[ STAT_PTEAM ] != PTE_HUMANS )
return;
-
+
self->activator = activator;
if( self->nextthink )
return; // can't retrigger until the wait is over
@@ -851,7 +849,7 @@ void trigger_equipment_trigger( gentity_t *self, gentity_t *activator )
return;
}
}
-
+
for( i = 0; self->uTriggers[ i ] != UP_NONE; i++ )
{
if( BG_InventoryContainsUpgrade( self->uTriggers[ i ], activator->client->ps.stats ) )
@@ -861,7 +859,7 @@ void trigger_equipment_trigger( gentity_t *self, gentity_t *activator )
}
}
}
-
+
if( self->wait > 0 )
{
self->think = multi_wait;
@@ -887,7 +885,7 @@ void trigger_equipment_touch( gentity_t *ent, gentity_t *other, trace_t *trace )
//only triggered by clients
if( !other->client )
return;
-
+
trigger_equipment_trigger( ent, other );
}
@@ -921,9 +919,9 @@ void SP_trigger_equipment( gentity_t *self )
self->random = self->wait - FRAMETIME;
G_Printf( S_COLOR_YELLOW "WARNING: trigger_equipment has random >= wait\n" );
}
-
+
G_SpawnString( "equipment", "", &buffer );
-
+
p = q = buffer;
while( *p != '\0' )
@@ -934,23 +932,23 @@ void SP_trigger_equipment( gentity_t *self )
if( *p == '\0' )
EOS = qtrue;
-
+
*p = '\0';
//strip leading whitespace
while( *q == ' ' )
q++;
-
+
self->wTriggers[ i ] = BG_FindWeaponNumForName( q );
self->uTriggers[ j ] = BG_FindUpgradeNumForName( q );
-
+
if( self->wTriggers[ i ] == WP_NONE && self->uTriggers[ j ] == UP_NONE )
G_Printf( S_COLOR_YELLOW "WARNING: unknown equipment %s in trigger_class\n", q );
else if( self->wTriggers[ i ] != WP_NONE )
i++;
else if( self->uTriggers[ j ] != UP_NONE )
j++;
-
+
if( !EOS )
{
p++;
@@ -962,7 +960,7 @@ void SP_trigger_equipment( gentity_t *self )
self->wTriggers[ i ] = WP_NONE;
self->uTriggers[ j ] = UP_NONE;
-
+
self->touch = trigger_equipment_touch;
self->use = trigger_equipment_use;
@@ -981,7 +979,7 @@ void trigger_gravity_touch( gentity_t *ent, gentity_t *other, trace_t *trace )
//only triggered by clients
if( !other->client )
return;
-
+
other->client->ps.gravity = ent->triggerGravity;
}
@@ -1007,7 +1005,7 @@ SP_trigger_gravity
void SP_trigger_gravity( gentity_t *self )
{
G_SpawnInt( "gravity", "800", &self->triggerGravity );
-
+
self->touch = trigger_gravity_touch;
self->use = trigger_gravity_use;
@@ -1049,14 +1047,14 @@ void trigger_heal_touch( gentity_t *self, gentity_t *other, trace_t *trace )
else
self->timestamp = level.time + FRAMETIME;
- max = other->client->ps.stats[ STAT_MAX_HEALTH ];
-
+ max = other->client->ps.stats[ STAT_MAX_HEALTH ];
+
other->health += self->damage;
- if( other->health > max )
- other->health = max;
-
- other->client->ps.stats[ STAT_HEALTH ] = other->health;
+ if( other->health > max )
+ other->health = max;
+
+ other->client->ps.stats[ STAT_HEALTH ] = other->health;
}
/*
@@ -1067,7 +1065,7 @@ SP_trigger_heal
void SP_trigger_heal( gentity_t *self )
{
G_SpawnInt( "heal", "5", &self->damage );
-
+
self->touch = trigger_heal_touch;
self->use = trigger_heal_use;
@@ -1102,10 +1100,10 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace )
if( BG_FindUsesEnergyForWeapon( other->client->ps.weapon ) && self->spawnflags & 2 )
return;
-
+
if( !BG_FindUsesEnergyForWeapon( other->client->ps.weapon ) && self->spawnflags & 4 )
return;
-
+
if( self->spawnflags & 1 )
self->timestamp = level.time + 1000;
else
@@ -1127,7 +1125,7 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace )
}
else
ammo += self->damage;
-
+
BG_PackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups,
ammo, clips );
}
@@ -1140,7 +1138,7 @@ SP_trigger_ammo
void SP_trigger_ammo( gentity_t *self )
{
G_SpawnInt( "ammo", "1", &self->damage );
-
+
self->touch = trigger_ammo_touch;
InitTrigger( self );
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index a7d66fd5..fa4b5f23 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -43,7 +43,7 @@ void AddRemap( const char *oldShader, const char *newShader, float timeOffset )
return;
}
}
-
+
if( remapCount < MAX_SHADER_REMAPS )
{
strcpy( remappedShaders[ remapCount ].newShader,newShader );
@@ -58,9 +58,9 @@ const char *BuildShaderStateConfig( )
static char buff[ MAX_STRING_CHARS * 4 ];
char out[ ( MAX_QPATH * 2 ) + 5 ];
int i;
-
+
memset( buff, 0, MAX_STRING_CHARS );
-
+
for( i = 0; i < remapCount; i++ )
{
Com_sprintf( out, ( MAX_QPATH * 2 ) + 5, "%s=%s:%5.2f@", remappedShaders[ i ].oldShader,
@@ -103,7 +103,7 @@ int G_FindConfigstringIndex( char *name, int start, int max, qboolean create )
return i;
}
- if( !create )
+ if( !create )
return 0;
if( i == max )
@@ -187,10 +187,10 @@ gentity_t *G_Find( gentity_t *from, int fieldofs, const char *match )
if( !from->inuse )
continue;
s = *(char **)( (byte *)from + fieldofs );
-
+
if( !s )
continue;
-
+
if( !Q_stricmp( s, match ) )
return from;
}
@@ -223,12 +223,12 @@ gentity_t *G_PickTarget( char *targetname )
while( 1 )
{
ent = G_Find( ent, FOFS( targetname ), targetname );
-
+
if( !ent )
break;
-
+
choice[ num_choices++ ] = ent;
-
+
if( num_choices == MAXCHOICES )
break;
}
@@ -257,7 +257,7 @@ match (string)self.target and call their .use function
void G_UseTargets( gentity_t *ent, gentity_t *activator )
{
gentity_t *t;
-
+
if( !ent )
return;
@@ -281,7 +281,7 @@ void G_UseTargets( gentity_t *ent, gentity_t *activator )
if( t->use )
t->use( t, ent, activator );
}
-
+
if( !ent->inuse )
{
G_Printf( "entity was removed while using targets\n" );
@@ -365,7 +365,7 @@ void G_SetMovedir( vec3_t angles, vec3_t movedir )
VectorCopy( MOVEDIR_DOWN, movedir );
else
AngleVectors( angles, movedir, NULL, NULL );
-
+
VectorClear( angles );
}
@@ -373,7 +373,7 @@ void G_SetMovedir( vec3_t angles, vec3_t movedir )
float vectoyaw( const vec3_t vec )
{
float yaw;
-
+
if( vec[ YAW ] == 0 && vec[ PITCH ] == 0 )
{
yaw = 0;
@@ -425,13 +425,13 @@ gentity_t *G_Spawn( void )
e = NULL; // shut up warning
i = 0; // shut up warning
-
+
for( force = 0; force < 2; force++ )
{
// if we go through all entities and can't find one to free,
// override the normal minimum times before use
e = &g_entities[ MAX_CLIENTS ];
-
+
for( i = MAX_CLIENTS; i < level.num_entities; i++, e++ )
{
if( e->inuse )
@@ -446,24 +446,24 @@ gentity_t *G_Spawn( void )
G_InitGentity( e );
return e;
}
-
+
if( i != MAX_GENTITIES )
break;
}
-
+
if( i == ENTITYNUM_MAX_NORMAL )
{
for( i = 0; i < MAX_GENTITIES; i++ )
G_Printf( "%4i: %s\n", i, g_entities[ i ].classname );
-
+
G_Error( "G_Spawn: no free entities" );
}
-
+
// open up a new slot
level.num_entities++;
// let the server system know that there are more entities
- trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ),
+ trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ),
&level.clients[ 0 ].ps, sizeof( level.clients[ 0 ] ) );
G_InitGentity( e );
@@ -482,7 +482,7 @@ qboolean G_EntitiesFree( void )
gentity_t *e;
e = &g_entities[ MAX_CLIENTS ];
-
+
for( i = MAX_CLIENTS; i < level.num_entities; i++, e++ )
{
if( e->inuse )
@@ -491,7 +491,7 @@ qboolean G_EntitiesFree( void )
// slot available
return qtrue;
}
-
+
return qfalse;
}
@@ -579,14 +579,14 @@ void G_KillBox( gentity_t *ent )
for( i = 0; i < num; i++ )
{
hit = &g_entities[ touch[ i ] ];
-
+
if( !hit->client )
continue;
//TA: impossible to telefrag self
if( ent == hit )
continue;
-
+
// nail it
G_Damage( hit, ent, ent, NULL, NULL,
100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG );
@@ -805,7 +805,7 @@ static qboolean G_ReadyToDequeue( commandQueue_t *cq )
{
if( !cq )
return qfalse;
-
+
return cq->front && cq->nextCommandTime <= level.time;
}
@@ -828,7 +828,7 @@ void G_ProcessCommandQueues( void )
if( !G_ClientIsLagging( cl ) && G_ReadyToDequeue( cq ) )
{
const char *command = G_PopCommandQueue( cq );
-
+
if( command )
trap_SendServerCommand( i, command );
}
@@ -844,12 +844,12 @@ void G_InitCommandQueue( int clientNum )
{
int i;
commandQueue_t *cq = &queuedCommands[ clientNum ];
-
+
if( clientNum >= 0 && clientNum < MAX_CLIENTS )
{
cq->front = cq->back = NULL;
cq->nextCommandTime = 0;
-
+
for( i = 0; i < MAX_QUEUE_COMMANDS; i++ )
{
commandQueueElement_t *cqe = &cq->pool[ i ];
@@ -872,18 +872,18 @@ void G_SendCommandFromServer( int clientNum, const char *cmd )
if( clientNum < 0 )
cq = NULL;
-
+
if( strlen( cmd ) > 1022 )
{
G_LogPrintf( "G_SendCommandFromServer( %d, ... ) length exceeds 1022.\n", clientNum );
G_LogPrintf( "cmd [%s]\n", cmd );
return;
- }
-
+ }
+
if( cq )
{
gclient_t *cl = &level.clients[ clientNum ];
-
+
if( cq->nextCommandTime > level.time || G_ClientIsLagging( cl ) )
{
//can't send yet, so queue the command up
@@ -928,20 +928,20 @@ gentity_t *G_FindRadius( gentity_t *from, vec3_t org, float rad )
{
vec3_t eorg;
int j;
-
+
if( !from )
from = g_entities;
else
from++;
-
+
for( ; from < &g_entities[ level.num_entities ]; from++ )
{
if( !from->inuse )
continue;
-
+
for( j = 0; j < 3; j++ )
eorg[ j ] = org[ j ] - ( from->r.currentOrigin[ j ] + ( from->r.mins[ j ] + from->r.maxs[ j ] ) * 0.5 );
-
+
if( VectorLength( eorg ) > rad )
continue;
@@ -963,10 +963,10 @@ qboolean G_Visible( gentity_t *ent1, gentity_t *ent2 )
trace_t trace;
trap_Trace( &trace, ent1->s.pos.trBase, NULL, NULL, ent2->s.pos.trBase, ent1->s.number, MASK_SHOT );
-
+
if( trace.contents & CONTENTS_SOLID )
return qfalse;
-
+
return qtrue;
}
@@ -982,7 +982,7 @@ gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities )
int i;
float nd, d = 1000000.0f;
gentity_t *closestEnt = NULL;
-
+
for( i = 0; i < numEntities; i++ )
{
gentity_t *ent = entities[ i ];
@@ -1053,7 +1053,7 @@ int DebugLine( vec3_t start, vec3_t end, int color )
VectorSubtract( end, start, dir );
VectorNormalize( dir );
dot = DotProduct( dir, up );
-
+
if( dot > 0.99 || dot < -0.99 )
VectorSet( cross, 1, 0, 0 );
else
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index ed1b67cb..34174e4d 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -29,11 +29,11 @@ G_ForceWeaponChange
void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon )
{
int i;
-
+
if( ent )
{
ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH;
-
+
if( weapon == WP_NONE )
{
//switch to the first non blaster weapon
@@ -41,14 +41,14 @@ void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon )
{
if( i == WP_BLASTER )
continue;
-
+
if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) )
{
ent->client->ps.persistant[ PERS_NEWWEAPON ] = i;
break;
}
}
-
+
//only got the blaster to switch to
if( i == WP_NUM_WEAPONS )
ent->client->ps.persistant[ PERS_NEWWEAPON ] = WP_BLASTER;
@@ -75,25 +75,25 @@ void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo )
weaponType = BG_FindUsesEnergyForWeapon( i );
else
weaponType = !BG_FindUsesEnergyForWeapon( i );
-
+
if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) &&
weaponType && !BG_FindInfinteAmmoForWeapon( i ) &&
!BG_WeaponIsFull( i, ent->client->ps.stats,
ent->client->ps.ammo, ent->client->ps.powerups ) )
{
BG_FindAmmoForWeapon( i, &maxAmmo, &maxClips );
-
+
if( buyingEnergyAmmo )
{
G_AddEvent( ent, EV_RPTUSE_SOUND, 0 );
-
+
if( BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
}
BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups,
maxAmmo, maxClips );
-
+
restoredAmmo = qtrue;
}
}
@@ -250,28 +250,28 @@ SHOTGUN
// this should match CG_ShotgunPattern
void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent )
{
- int i;
- float r, u;
- vec3_t end;
- vec3_t forward, right, up;
- trace_t tr;
- gentity_t *traceEnt;
-
- // derive the right and up vectors from the forward vector, because
- // the client won't have any other information
- VectorNormalize2( origin2, forward );
- PerpendicularVector( right, forward );
- CrossProduct( forward, right, up );
-
- // generate the "random" spread pattern
- for( i = 0; i < SHOTGUN_PELLETS; i++ )
+ int i;
+ float r, u;
+ vec3_t end;
+ vec3_t forward, right, up;
+ trace_t tr;
+ gentity_t *traceEnt;
+
+ // derive the right and up vectors from the forward vector, because
+ // the client won't have any other information
+ VectorNormalize2( origin2, forward );
+ PerpendicularVector( right, forward );
+ CrossProduct( forward, right, up );
+
+ // generate the "random" spread pattern
+ for( i = 0; i < SHOTGUN_PELLETS; i++ )
{
- r = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
- u = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
- VectorMA( origin, 8192 * 16, forward, end );
- VectorMA( end, r, right, end );
- VectorMA( end, u, up, end );
-
+ r = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
+ u = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
+ VectorMA( origin, 8192 * 16, forward, end );
+ VectorMA( end, r, right, end );
+ VectorMA( end, u, up, end );
+
trap_Trace( &tr, origin, NULL, NULL, end, ent->s.number, MASK_SHOT );
traceEnt = &g_entities[ tr.entityNum ];
@@ -279,24 +279,24 @@ void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent )
if( !( tr.surfaceFlags & SURF_NOIMPACT ) )
{
if( traceEnt->takedamage )
- G_Damage( traceEnt, ent, ent, forward, tr.endpos, SHOTGUN_DMG, 0, MOD_SHOTGUN );
+ G_Damage( traceEnt, ent, ent, forward, tr.endpos, SHOTGUN_DMG, 0, MOD_SHOTGUN );
}
- }
+ }
}
void shotgunFire( gentity_t *ent )
{
- gentity_t *tent;
+ gentity_t *tent;
- // send shotgun blast
- tent = G_TempEntity( muzzle, EV_SHOTGUN );
- VectorScale( forward, 4096, tent->s.origin2 );
- SnapVector( tent->s.origin2 );
- tent->s.eventParm = rand() & 255; // seed for spread pattern
- tent->s.otherEntityNum = ent->s.number;
+ // send shotgun blast
+ tent = G_TempEntity( muzzle, EV_SHOTGUN );
+ VectorScale( forward, 4096, tent->s.origin2 );
+ SnapVector( tent->s.origin2 );
+ tent->s.eventParm = rand() & 255; // seed for spread pattern
+ tent->s.otherEntityNum = ent->s.number;
- ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent );
+ ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent );
}
/*
@@ -532,11 +532,11 @@ void painSawFire( gentity_t *ent )
if( traceEnt->takedamage )
{
vec3_t temp;
-
+
//hack to get the particle system to line up with the weapon
VectorCopy( tr.endpos, temp );
temp[ 2 ] -= 10.0f;
-
+
if( traceEnt->client )
{
tent = G_TempEntity( temp, EV_MISSILE_HIT );
@@ -544,7 +544,7 @@ void painSawFire( gentity_t *ent )
}
else
tent = G_TempEntity( temp, EV_MISSILE_MISS );
-
+
tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.weapon = ent->s.weapon;
tent->s.generic1 = ent->s.generic1; //weaponMode
@@ -575,7 +575,7 @@ void LCChargeFire( gentity_t *ent, qboolean secondary )
m = fire_luciferCannon( ent, muzzle, forward, LCANNON_SECONDARY_DAMAGE, LCANNON_SECONDARY_RADIUS );
else
m = fire_luciferCannon( ent, muzzle, forward, ent->client->ps.stats[ STAT_MISC ], LCANNON_RADIUS );
-
+
ent->client->ps.stats[ STAT_MISC ] = 0;
}
@@ -611,7 +611,7 @@ void teslaFire( gentity_t *ent )
//so the client side knows
ent->s.eFlags |= EF_FIRING;
-
+
if( traceEnt->takedamage )
{
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
@@ -625,10 +625,10 @@ void teslaFire( gentity_t *ent )
tent = G_TempEntity( tr.endpos, EV_TESLATRAIL );
VectorCopy( muzzle, tent->s.origin2 );
-
+
tent->s.generic1 = ent->s.number; //src
tent->s.clientNum = traceEnt->s.number; //dest
-
+
// move origin a bit to come closer to the drawn gun muzzle
VectorMA( tent->s.origin2, 28, up, tent->s.origin2 );
@@ -665,7 +665,7 @@ void cancelBuildFire( gentity_t *ent )
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
return;
}
-
+
//repair buildable
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
@@ -720,7 +720,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu )
G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum );
return;
}
-
+
if( G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) )
{
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && !G_isOvermind( ) )
@@ -737,7 +737,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu )
else
ent->client->ps.stats[ STAT_MISC ] +=
BG_FindBuildDelayForWeapon( ent->s.weapon );
-
+
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
// don't want it bigger than 32k
@@ -801,7 +801,7 @@ qboolean CheckVenomAttack( gentity_t *ent )
if( !traceEnt->takedamage )
return qfalse;
-
+
if( !traceEnt->client && !traceEnt->s.eType == ET_BUILDABLE )
return qfalse;
@@ -815,7 +815,7 @@ qboolean CheckVenomAttack( gentity_t *ent )
//hackery
damage *= 0.5f;
}
-
+
if( traceEnt->client )
{
if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
@@ -873,12 +873,12 @@ void CheckGrabAttack( gentity_t *ent )
if( !traceEnt->takedamage )
return;
-
+
if( traceEnt->client )
{
if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
return;
-
+
if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 )
return;
@@ -886,11 +886,11 @@ void CheckGrabAttack( gentity_t *ent )
{
AngleVectors( traceEnt->client->ps.viewangles, dir, NULL, NULL );
traceEnt->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );
-
+
//event for client side grab effect
G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
}
-
+
traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
if( ent->client->ps.weapon == WP_ALEVEL1 )
@@ -922,25 +922,25 @@ void poisonCloud( gentity_t *ent )
int i, num;
gentity_t *humanPlayer;
trace_t tr;
-
+
VectorAdd( ent->client->ps.origin, range, maxs );
VectorSubtract( ent->client->ps.origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
humanPlayer = &g_entities[ entityList[ i ] ];
-
+
if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
{
if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, humanPlayer->client->ps.stats ) )
continue;
-
+
if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, humanPlayer->client->ps.stats ) )
continue;
-
+
trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->s.origin, humanPlayer->s.number, MASK_SHOT );
-
+
//can't see target from here
if( tr.entityNum == ENTITYNUM_WORLD )
continue;
@@ -986,21 +986,21 @@ static gentity_t *G_FindNewZapTarget( gentity_t *ent )
VectorScale( range, 1.0f / M_ROOT3, range );
VectorAdd( ent->s.origin, range, maxs );
VectorSubtract( ent->s.origin, range, mins );
-
+
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{
enemy = &g_entities[ entityList[ i ] ];
-
+
if( ( ( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ||
( enemy->s.eType == ET_BUILDABLE &&
BG_FindTeamForBuildable( enemy->s.modelindex ) == BIT_HUMANS ) ) && enemy->health > 0 )
{
qboolean foundOldTarget = qfalse;
-
+
trap_Trace( &tr, muzzle, NULL, NULL, enemy->s.origin, ent->s.number, MASK_SHOT );
-
+
//can't see target from here
if( tr.entityNum == ENTITYNUM_WORLD )
continue;
@@ -1025,7 +1025,7 @@ static gentity_t *G_FindNewZapTarget( gentity_t *ent )
// enemy is already targetted
if( foundOldTarget )
continue;
-
+
return enemy;
}
}
@@ -1042,7 +1042,7 @@ static void G_UpdateZapEffect( zap_t *zap )
{
int j;
gentity_t *effect = zap->effectChannel;
-
+
effect->s.eType = ET_LEV2_ZAP_CHAIN;
effect->classname = "lev2zapchain";
G_SetOrigin( effect, zap->creator->s.origin );
@@ -1053,7 +1053,7 @@ static void G_UpdateZapEffect( zap_t *zap )
for( j = 0; j < zap->numTargets; j++ )
{
int number = zap->targets[ j ]->s.number;
-
+
switch( j )
{
case 0: effect->s.time = number; break;
@@ -1083,22 +1083,22 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target )
if( !zap->used )
{
zap->used = qtrue;
-
+
zap->timeToLive = LEVEL2_AREAZAP_TIME;
-
+
zap->creator = creator;
-
+
zap->targets[ 0 ] = target;
zap->numTargets = 1;
for( j = 1; j < MAX_ZAP_TARGETS && zap->targets[ j - 1 ]; j++ )
{
zap->targets[ j ] = G_FindNewZapTarget( zap->targets[ j - 1 ] );
-
+
if( zap->targets[ j ] )
zap->numTargets++;
}
-
+
zap->effectChannel = G_Spawn( );
G_UpdateZapEffect( zap );
@@ -1135,7 +1135,7 @@ void G_UpdateZaps( int msec )
source = zap->creator;
else
source = zap->targets[ j - 1 ];
-
+
if( target->health <= 0 || !target->inuse || //early out
VectorDistance( source->s.origin, target->s.origin ) > LEVEL2_AREAZAP_RANGE )
{
@@ -1145,7 +1145,6 @@ void G_UpdateZaps( int msec )
if( !target )
zap->numTargets = j;
}
-
}
if( zap->numTargets )
@@ -1154,26 +1153,30 @@ void G_UpdateZaps( int msec )
{
gentity_t *source;
gentity_t *target = zap->targets[ j ];
- float r = 1.0f / zap->numTargets;
- float damageFraction = 2 * r - 2 * j * r * r - r * r;
-
+ float r = 1.0f / zap->numTargets;
+ float damageFraction = 2 * r - 2 * j * r * r - r * r;
+ vec3_t forward;
+
if( j == 0 )
source = zap->creator;
else
source = zap->targets[ j - 1 ];
-
+
damage = ceil( ( (float)msec / LEVEL2_AREAZAP_TIME ) *
LEVEL2_AREAZAP_DMG * damageFraction );
+ VectorSubtract( target->s.origin, source->s.origin, forward );
+ VectorNormalize( forward );
+
//do the damage
if( damage )
- G_Damage( target, source, zap->creator, NULL, NULL,
+ G_Damage( target, source, zap->creator, forward, target->s.origin,
damage, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, MOD_LEVEL2_ZAP );
}
}
-
+
G_UpdateZapEffect( zap );
-
+
zap->timeToLive -= msec;
if( zap->timeToLive <= 0 || zap->numTargets == 0 || zap->creator->health <= 0 )
@@ -1208,7 +1211,7 @@ void areaZapFire( gentity_t *ent )
VectorMA( muzzle, LEVEL2_AREAZAP_RANGE, forward, end );
trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
-
+
if( tr.surfaceFlags & SURF_NOIMPACT )
return;
@@ -1264,12 +1267,12 @@ qboolean CheckPounceAttack( gentity_t *ent )
VectorMA( muzzle, LEVEL3_POUNCE_RANGE, forward, end );
- trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
+ trap_Trace( &tr, ent->s.origin, mins, maxs, end, ent->s.number, MASK_SHOT );
//miss
if( tr.fraction >= 1.0 )
return qfalse;
-
+
if( tr.surfaceFlags & SURF_NOIMPACT )
return qfalse;
@@ -1293,7 +1296,7 @@ qboolean CheckPounceAttack( gentity_t *ent )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_LEVEL3_POUNCE );
ent->client->allowedToPounce = qfalse;
-
+
return qtrue;
}
@@ -1325,16 +1328,16 @@ void ChargeAttack( gentity_t *ent, gentity_t *victim )
gentity_t *tent;
int damage;
vec3_t forward, normal;
-
+
if( level.time < victim->chargeRepeat )
return;
victim->chargeRepeat = level.time + LEVEL4_CHARGE_REPEAT;
-
+
VectorSubtract( victim->s.origin, ent->s.origin, forward );
VectorNormalize( forward );
VectorNegate( forward, normal );
-
+
if( victim->client )
{
tent = G_TempEntity( victim->s.origin, EV_MISSILE_HIT );
@@ -1346,7 +1349,7 @@ void ChargeAttack( gentity_t *ent, gentity_t *victim )
if( !victim->takedamage )
return;
-
+
damage = (int)( ( (float)ent->client->ps.stats[ STAT_MISC ] / (float)LEVEL4_CHARGE_TIME ) * LEVEL4_CHARGE_DMG );
G_Damage( victim, ent, ent, forward, victim->s.origin, damage, 0, MOD_LEVEL4_CHARGE );
@@ -1396,11 +1399,11 @@ void FireWeapon3( gentity_t *ent )
case WP_ALEVEL3_UPG:
bounceBallFire( ent );
break;
-
+
case WP_ABUILD2:
slowBlobFire( ent );
break;
-
+
default:
break;
}
@@ -1434,11 +1437,11 @@ void FireWeapon2( gentity_t *ent )
case WP_ALEVEL2_UPG:
areaZapFire( ent );
break;
-
+
case WP_LUCIFER_CANNON:
LCChargeFire( ent, qtrue );
break;
-
+
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
@@ -1523,7 +1526,7 @@ void FireWeapon( gentity_t *ent )
case WP_GRENADE:
throwGrenade( ent );
break;
-
+
case WP_LOCKBLOB_LAUNCHER:
lockBlobLauncherFire( ent );
break;
@@ -1536,7 +1539,7 @@ void FireWeapon( gentity_t *ent )
case WP_MGTURRET:
bulletFire( ent, MGTURRET_SPREAD, MGTURRET_DMG, MOD_MGTURRET );
break;
-
+
case WP_ABUILD:
case WP_ABUILD2:
buildFire( ent, MN_A_BUILD );
diff --git a/src/game/q_math.c b/src/game/q_math.c
index 2600459c..62c5a5a8 100644
--- a/src/game/q_math.c
+++ b/src/game/q_math.c
@@ -49,86 +49,86 @@ vec4_t g_color_table[8] =
vec3_t bytedirs[NUMVERTEXNORMALS] =
{
-{-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f},
-{-0.295242f, 0.000000f, 0.955423f}, {-0.309017f, 0.500000f, 0.809017f},
-{-0.162460f, 0.262866f, 0.951056f}, {0.000000f, 0.000000f, 1.000000f},
-{0.000000f, 0.850651f, 0.525731f}, {-0.147621f, 0.716567f, 0.681718f},
-{0.147621f, 0.716567f, 0.681718f}, {0.000000f, 0.525731f, 0.850651f},
-{0.309017f, 0.500000f, 0.809017f}, {0.525731f, 0.000000f, 0.850651f},
-{0.295242f, 0.000000f, 0.955423f}, {0.442863f, 0.238856f, 0.864188f},
-{0.162460f, 0.262866f, 0.951056f}, {-0.681718f, 0.147621f, 0.716567f},
-{-0.809017f, 0.309017f, 0.500000f},{-0.587785f, 0.425325f, 0.688191f},
-{-0.850651f, 0.525731f, 0.000000f},{-0.864188f, 0.442863f, 0.238856f},
-{-0.716567f, 0.681718f, 0.147621f},{-0.688191f, 0.587785f, 0.425325f},
-{-0.500000f, 0.809017f, 0.309017f}, {-0.238856f, 0.864188f, 0.442863f},
-{-0.425325f, 0.688191f, 0.587785f}, {-0.716567f, 0.681718f, -0.147621f},
-{-0.500000f, 0.809017f, -0.309017f}, {-0.525731f, 0.850651f, 0.000000f},
-{0.000000f, 0.850651f, -0.525731f}, {-0.238856f, 0.864188f, -0.442863f},
-{0.000000f, 0.955423f, -0.295242f}, {-0.262866f, 0.951056f, -0.162460f},
-{0.000000f, 1.000000f, 0.000000f}, {0.000000f, 0.955423f, 0.295242f},
-{-0.262866f, 0.951056f, 0.162460f}, {0.238856f, 0.864188f, 0.442863f},
-{0.262866f, 0.951056f, 0.162460f}, {0.500000f, 0.809017f, 0.309017f},
-{0.238856f, 0.864188f, -0.442863f},{0.262866f, 0.951056f, -0.162460f},
-{0.500000f, 0.809017f, -0.309017f},{0.850651f, 0.525731f, 0.000000f},
-{0.716567f, 0.681718f, 0.147621f}, {0.716567f, 0.681718f, -0.147621f},
-{0.525731f, 0.850651f, 0.000000f}, {0.425325f, 0.688191f, 0.587785f},
-{0.864188f, 0.442863f, 0.238856f}, {0.688191f, 0.587785f, 0.425325f},
-{0.809017f, 0.309017f, 0.500000f}, {0.681718f, 0.147621f, 0.716567f},
-{0.587785f, 0.425325f, 0.688191f}, {0.955423f, 0.295242f, 0.000000f},
-{1.000000f, 0.000000f, 0.000000f}, {0.951056f, 0.162460f, 0.262866f},
-{0.850651f, -0.525731f, 0.000000f},{0.955423f, -0.295242f, 0.000000f},
-{0.864188f, -0.442863f, 0.238856f}, {0.951056f, -0.162460f, 0.262866f},
-{0.809017f, -0.309017f, 0.500000f}, {0.681718f, -0.147621f, 0.716567f},
-{0.850651f, 0.000000f, 0.525731f}, {0.864188f, 0.442863f, -0.238856f},
-{0.809017f, 0.309017f, -0.500000f}, {0.951056f, 0.162460f, -0.262866f},
+{-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f},
+{-0.295242f, 0.000000f, 0.955423f}, {-0.309017f, 0.500000f, 0.809017f},
+{-0.162460f, 0.262866f, 0.951056f}, {0.000000f, 0.000000f, 1.000000f},
+{0.000000f, 0.850651f, 0.525731f}, {-0.147621f, 0.716567f, 0.681718f},
+{0.147621f, 0.716567f, 0.681718f}, {0.000000f, 0.525731f, 0.850651f},
+{0.309017f, 0.500000f, 0.809017f}, {0.525731f, 0.000000f, 0.850651f},
+{0.295242f, 0.000000f, 0.955423f}, {0.442863f, 0.238856f, 0.864188f},
+{0.162460f, 0.262866f, 0.951056f}, {-0.681718f, 0.147621f, 0.716567f},
+{-0.809017f, 0.309017f, 0.500000f},{-0.587785f, 0.425325f, 0.688191f},
+{-0.850651f, 0.525731f, 0.000000f},{-0.864188f, 0.442863f, 0.238856f},
+{-0.716567f, 0.681718f, 0.147621f},{-0.688191f, 0.587785f, 0.425325f},
+{-0.500000f, 0.809017f, 0.309017f}, {-0.238856f, 0.864188f, 0.442863f},
+{-0.425325f, 0.688191f, 0.587785f}, {-0.716567f, 0.681718f, -0.147621f},
+{-0.500000f, 0.809017f, -0.309017f}, {-0.525731f, 0.850651f, 0.000000f},
+{0.000000f, 0.850651f, -0.525731f}, {-0.238856f, 0.864188f, -0.442863f},
+{0.000000f, 0.955423f, -0.295242f}, {-0.262866f, 0.951056f, -0.162460f},
+{0.000000f, 1.000000f, 0.000000f}, {0.000000f, 0.955423f, 0.295242f},
+{-0.262866f, 0.951056f, 0.162460f}, {0.238856f, 0.864188f, 0.442863f},
+{0.262866f, 0.951056f, 0.162460f}, {0.500000f, 0.809017f, 0.309017f},
+{0.238856f, 0.864188f, -0.442863f},{0.262866f, 0.951056f, -0.162460f},
+{0.500000f, 0.809017f, -0.309017f},{0.850651f, 0.525731f, 0.000000f},
+{0.716567f, 0.681718f, 0.147621f}, {0.716567f, 0.681718f, -0.147621f},
+{0.525731f, 0.850651f, 0.000000f}, {0.425325f, 0.688191f, 0.587785f},
+{0.864188f, 0.442863f, 0.238856f}, {0.688191f, 0.587785f, 0.425325f},
+{0.809017f, 0.309017f, 0.500000f}, {0.681718f, 0.147621f, 0.716567f},
+{0.587785f, 0.425325f, 0.688191f}, {0.955423f, 0.295242f, 0.000000f},
+{1.000000f, 0.000000f, 0.000000f}, {0.951056f, 0.162460f, 0.262866f},
+{0.850651f, -0.525731f, 0.000000f},{0.955423f, -0.295242f, 0.000000f},
+{0.864188f, -0.442863f, 0.238856f}, {0.951056f, -0.162460f, 0.262866f},
+{0.809017f, -0.309017f, 0.500000f}, {0.681718f, -0.147621f, 0.716567f},
+{0.850651f, 0.000000f, 0.525731f}, {0.864188f, 0.442863f, -0.238856f},
+{0.809017f, 0.309017f, -0.500000f}, {0.951056f, 0.162460f, -0.262866f},
{0.525731f, 0.000000f, -0.850651f}, {0.681718f, 0.147621f, -0.716567f},
-{0.681718f, -0.147621f, -0.716567f},{0.850651f, 0.000000f, -0.525731f},
-{0.809017f, -0.309017f, -0.500000f}, {0.864188f, -0.442863f, -0.238856f},
-{0.951056f, -0.162460f, -0.262866f}, {0.147621f, 0.716567f, -0.681718f},
-{0.309017f, 0.500000f, -0.809017f}, {0.425325f, 0.688191f, -0.587785f},
-{0.442863f, 0.238856f, -0.864188f}, {0.587785f, 0.425325f, -0.688191f},
-{0.688191f, 0.587785f, -0.425325f}, {-0.147621f, 0.716567f, -0.681718f},
-{-0.309017f, 0.500000f, -0.809017f}, {0.000000f, 0.525731f, -0.850651f},
-{-0.525731f, 0.000000f, -0.850651f}, {-0.442863f, 0.238856f, -0.864188f},
-{-0.295242f, 0.000000f, -0.955423f}, {-0.162460f, 0.262866f, -0.951056f},
-{0.000000f, 0.000000f, -1.000000f}, {0.295242f, 0.000000f, -0.955423f},
-{0.162460f, 0.262866f, -0.951056f}, {-0.442863f, -0.238856f, -0.864188f},
-{-0.309017f, -0.500000f, -0.809017f}, {-0.162460f, -0.262866f, -0.951056f},
-{0.000000f, -0.850651f, -0.525731f}, {-0.147621f, -0.716567f, -0.681718f},
-{0.147621f, -0.716567f, -0.681718f}, {0.000000f, -0.525731f, -0.850651f},
-{0.309017f, -0.500000f, -0.809017f}, {0.442863f, -0.238856f, -0.864188f},
-{0.162460f, -0.262866f, -0.951056f}, {0.238856f, -0.864188f, -0.442863f},
-{0.500000f, -0.809017f, -0.309017f}, {0.425325f, -0.688191f, -0.587785f},
-{0.716567f, -0.681718f, -0.147621f}, {0.688191f, -0.587785f, -0.425325f},
-{0.587785f, -0.425325f, -0.688191f}, {0.000000f, -0.955423f, -0.295242f},
-{0.000000f, -1.000000f, 0.000000f}, {0.262866f, -0.951056f, -0.162460f},
-{0.000000f, -0.850651f, 0.525731f}, {0.000000f, -0.955423f, 0.295242f},
-{0.238856f, -0.864188f, 0.442863f}, {0.262866f, -0.951056f, 0.162460f},
-{0.500000f, -0.809017f, 0.309017f}, {0.716567f, -0.681718f, 0.147621f},
-{0.525731f, -0.850651f, 0.000000f}, {-0.238856f, -0.864188f, -0.442863f},
-{-0.500000f, -0.809017f, -0.309017f}, {-0.262866f, -0.951056f, -0.162460f},
-{-0.850651f, -0.525731f, 0.000000f}, {-0.716567f, -0.681718f, -0.147621f},
-{-0.716567f, -0.681718f, 0.147621f}, {-0.525731f, -0.850651f, 0.000000f},
-{-0.500000f, -0.809017f, 0.309017f}, {-0.238856f, -0.864188f, 0.442863f},
-{-0.262866f, -0.951056f, 0.162460f}, {-0.864188f, -0.442863f, 0.238856f},
-{-0.809017f, -0.309017f, 0.500000f}, {-0.688191f, -0.587785f, 0.425325f},
-{-0.681718f, -0.147621f, 0.716567f}, {-0.442863f, -0.238856f, 0.864188f},
-{-0.587785f, -0.425325f, 0.688191f}, {-0.309017f, -0.500000f, 0.809017f},
-{-0.147621f, -0.716567f, 0.681718f}, {-0.425325f, -0.688191f, 0.587785f},
-{-0.162460f, -0.262866f, 0.951056f}, {0.442863f, -0.238856f, 0.864188f},
-{0.162460f, -0.262866f, 0.951056f}, {0.309017f, -0.500000f, 0.809017f},
-{0.147621f, -0.716567f, 0.681718f}, {0.000000f, -0.525731f, 0.850651f},
-{0.425325f, -0.688191f, 0.587785f}, {0.587785f, -0.425325f, 0.688191f},
-{0.688191f, -0.587785f, 0.425325f}, {-0.955423f, 0.295242f, 0.000000f},
-{-0.951056f, 0.162460f, 0.262866f}, {-1.000000f, 0.000000f, 0.000000f},
-{-0.850651f, 0.000000f, 0.525731f}, {-0.955423f, -0.295242f, 0.000000f},
-{-0.951056f, -0.162460f, 0.262866f}, {-0.864188f, 0.442863f, -0.238856f},
-{-0.951056f, 0.162460f, -0.262866f}, {-0.809017f, 0.309017f, -0.500000f},
-{-0.864188f, -0.442863f, -0.238856f}, {-0.951056f, -0.162460f, -0.262866f},
-{-0.809017f, -0.309017f, -0.500000f}, {-0.681718f, 0.147621f, -0.716567f},
-{-0.681718f, -0.147621f, -0.716567f}, {-0.850651f, 0.000000f, -0.525731f},
-{-0.688191f, 0.587785f, -0.425325f}, {-0.587785f, 0.425325f, -0.688191f},
-{-0.425325f, 0.688191f, -0.587785f}, {-0.425325f, -0.688191f, -0.587785f},
+{0.681718f, -0.147621f, -0.716567f},{0.850651f, 0.000000f, -0.525731f},
+{0.809017f, -0.309017f, -0.500000f}, {0.864188f, -0.442863f, -0.238856f},
+{0.951056f, -0.162460f, -0.262866f}, {0.147621f, 0.716567f, -0.681718f},
+{0.309017f, 0.500000f, -0.809017f}, {0.425325f, 0.688191f, -0.587785f},
+{0.442863f, 0.238856f, -0.864188f}, {0.587785f, 0.425325f, -0.688191f},
+{0.688191f, 0.587785f, -0.425325f}, {-0.147621f, 0.716567f, -0.681718f},
+{-0.309017f, 0.500000f, -0.809017f}, {0.000000f, 0.525731f, -0.850651f},
+{-0.525731f, 0.000000f, -0.850651f}, {-0.442863f, 0.238856f, -0.864188f},
+{-0.295242f, 0.000000f, -0.955423f}, {-0.162460f, 0.262866f, -0.951056f},
+{0.000000f, 0.000000f, -1.000000f}, {0.295242f, 0.000000f, -0.955423f},
+{0.162460f, 0.262866f, -0.951056f}, {-0.442863f, -0.238856f, -0.864188f},
+{-0.309017f, -0.500000f, -0.809017f}, {-0.162460f, -0.262866f, -0.951056f},
+{0.000000f, -0.850651f, -0.525731f}, {-0.147621f, -0.716567f, -0.681718f},
+{0.147621f, -0.716567f, -0.681718f}, {0.000000f, -0.525731f, -0.850651f},
+{0.309017f, -0.500000f, -0.809017f}, {0.442863f, -0.238856f, -0.864188f},
+{0.162460f, -0.262866f, -0.951056f}, {0.238856f, -0.864188f, -0.442863f},
+{0.500000f, -0.809017f, -0.309017f}, {0.425325f, -0.688191f, -0.587785f},
+{0.716567f, -0.681718f, -0.147621f}, {0.688191f, -0.587785f, -0.425325f},
+{0.587785f, -0.425325f, -0.688191f}, {0.000000f, -0.955423f, -0.295242f},
+{0.000000f, -1.000000f, 0.000000f}, {0.262866f, -0.951056f, -0.162460f},
+{0.000000f, -0.850651f, 0.525731f}, {0.000000f, -0.955423f, 0.295242f},
+{0.238856f, -0.864188f, 0.442863f}, {0.262866f, -0.951056f, 0.162460f},
+{0.500000f, -0.809017f, 0.309017f}, {0.716567f, -0.681718f, 0.147621f},
+{0.525731f, -0.850651f, 0.000000f}, {-0.238856f, -0.864188f, -0.442863f},
+{-0.500000f, -0.809017f, -0.309017f}, {-0.262866f, -0.951056f, -0.162460f},
+{-0.850651f, -0.525731f, 0.000000f}, {-0.716567f, -0.681718f, -0.147621f},
+{-0.716567f, -0.681718f, 0.147621f}, {-0.525731f, -0.850651f, 0.000000f},
+{-0.500000f, -0.809017f, 0.309017f}, {-0.238856f, -0.864188f, 0.442863f},
+{-0.262866f, -0.951056f, 0.162460f}, {-0.864188f, -0.442863f, 0.238856f},
+{-0.809017f, -0.309017f, 0.500000f}, {-0.688191f, -0.587785f, 0.425325f},
+{-0.681718f, -0.147621f, 0.716567f}, {-0.442863f, -0.238856f, 0.864188f},
+{-0.587785f, -0.425325f, 0.688191f}, {-0.309017f, -0.500000f, 0.809017f},
+{-0.147621f, -0.716567f, 0.681718f}, {-0.425325f, -0.688191f, 0.587785f},
+{-0.162460f, -0.262866f, 0.951056f}, {0.442863f, -0.238856f, 0.864188f},
+{0.162460f, -0.262866f, 0.951056f}, {0.309017f, -0.500000f, 0.809017f},
+{0.147621f, -0.716567f, 0.681718f}, {0.000000f, -0.525731f, 0.850651f},
+{0.425325f, -0.688191f, 0.587785f}, {0.587785f, -0.425325f, 0.688191f},
+{0.688191f, -0.587785f, 0.425325f}, {-0.955423f, 0.295242f, 0.000000f},
+{-0.951056f, 0.162460f, 0.262866f}, {-1.000000f, 0.000000f, 0.000000f},
+{-0.850651f, 0.000000f, 0.525731f}, {-0.955423f, -0.295242f, 0.000000f},
+{-0.951056f, -0.162460f, 0.262866f}, {-0.864188f, 0.442863f, -0.238856f},
+{-0.951056f, 0.162460f, -0.262866f}, {-0.809017f, 0.309017f, -0.500000f},
+{-0.864188f, -0.442863f, -0.238856f}, {-0.951056f, -0.162460f, -0.262866f},
+{-0.809017f, -0.309017f, -0.500000f}, {-0.681718f, 0.147621f, -0.716567f},
+{-0.681718f, -0.147621f, -0.716567f}, {-0.850651f, 0.000000f, -0.525731f},
+{-0.688191f, 0.587785f, -0.425325f}, {-0.587785f, 0.425325f, -0.688191f},
+{-0.425325f, 0.688191f, -0.587785f}, {-0.425325f, -0.688191f, -0.587785f},
{-0.587785f, -0.425325f, -0.688191f}, {-0.688191f, -0.587785f, -0.425325f}
};
@@ -150,58 +150,58 @@ float Q_crandom( int *seed ) {
#ifdef __LCC__
int VectorCompare( const vec3_t v1, const vec3_t v2 ) {
- if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
- return 0;
- }
- return 1;
+ if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
+ return 0;
+ }
+ return 1;
}
vec_t VectorLength( const vec3_t v )
{
- return (vec_t)sqrt( v[ 0 ] * v[ 0 ] + v[ 1 ] * v[ 1 ] + v[ 2 ] * v[ 2 ] );
+ return (vec_t)sqrt( v[ 0 ] * v[ 0 ] + v[ 1 ] * v[ 1 ] + v[ 2 ] * v[ 2 ] );
}
vec_t VectorLengthSquared( const vec3_t v ) {
- return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+ return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
}
vec_t Distance( const vec3_t p1, const vec3_t p2 ) {
- vec3_t v;
+ vec3_t v;
- VectorSubtract (p2, p1, v);
- return VectorLength( v );
+ VectorSubtract (p2, p1, v);
+ return VectorLength( v );
}
vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) {
- vec3_t v;
+ vec3_t v;
- VectorSubtract (p2, p1, v);
- return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
+ VectorSubtract (p2, p1, v);
+ return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
}
// fast vector normalize routine that does not check to make sure
// that length != 0, nor does it return length, uses rsqrt approximation
void VectorNormalizeFast( vec3_t v )
{
- float ilength;
+ float ilength;
- ilength = Q_rsqrt( DotProduct( v, v ) );
+ ilength = Q_rsqrt( DotProduct( v, v ) );
- v[0] *= ilength;
- v[1] *= ilength;
- v[2] *= ilength;
+ v[0] *= ilength;
+ v[1] *= ilength;
+ v[2] *= ilength;
}
void VectorInverse( vec3_t v ){
- v[0] = -v[0];
- v[1] = -v[1];
- v[2] = -v[2];
+ v[0] = -v[0];
+ v[1] = -v[1];
+ v[2] = -v[2];
}
void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) {
- cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
- cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
- cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
+ cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
+ cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
+ cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
}
#endif
@@ -239,11 +239,11 @@ int DirToByte( vec3_t dir )
bestd = 0;
best = 0;
-
+
for( i = 0; i < NUMVERTEXNORMALS; i++ )
{
d = DotProduct( dir, bytedirs[ i ] );
-
+
if( d > bestd )
{
bestd = d;
@@ -261,7 +261,7 @@ void ByteToDir( int b, vec3_t dir )
VectorCopy( vec3_origin, dir );
return;
}
-
+
VectorCopy( bytedirs[ b ], dir);
}
@@ -401,7 +401,7 @@ void RotateAroundDirection( vec3_t axis[ 3 ], vec_t angle )
angle = DEG2RAD( angle );
- // create an arbitrary axis[1]
+ // create an arbitrary axis[1]
PerpendicularVector( axis[ 1 ], axis[ 0 ] );
// cross to get axis[2]
@@ -551,7 +551,7 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
assert( Q_fabs(inv_denom) != 0.0f ); // bk010122 - zero vectors get here
#endif
inv_denom = 1.0f / inv_denom;
-
+
d = DotProduct( normal, p ) * inv_denom;
n[0] = normal[0] * inv_denom;
@@ -619,7 +619,7 @@ float Q_rsqrt( float number )
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
-
+
return y;
}
#endif
@@ -1302,14 +1302,14 @@ void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
forward[ 1 ] = cp * sy;
forward[ 2 ] = -sp;
}
-
+
if( right )
{
right[ 0 ] = ( -1 * sr * sp * cy + -1 * cr * -sy );
right[ 1 ] = ( -1 * sr * sp * sy + -1 * cr * cy );
right[ 2 ] = -1 * sr * cp;
}
-
+
if( up )
{
up[ 0 ] = ( cr * sp * cy + -sr * -sy );
@@ -1367,7 +1367,7 @@ float pointToLineDistance( const vec3_t p0, const vec3_t p1, const vec3_t p2 )
VectorSubtract( p2, p1, v );
VectorSubtract( p1, p0, w );
-
+
CrossProduct( w, v, y );
c1 = VectorLength( y );
c2 = VectorLength( v );
@@ -1389,16 +1389,16 @@ Used to find an "up" vector for drawing a sprite so that it always faces the vie
*/
void GetPerpendicularViewVector( const vec3_t point, const vec3_t p1, const vec3_t p2, vec3_t up )
{
- vec3_t v1, v2;
+ vec3_t v1, v2;
- VectorSubtract( point, p1, v1 );
- VectorNormalize( v1 );
+ VectorSubtract( point, p1, v1 );
+ VectorNormalize( v1 );
- VectorSubtract( point, p2, v2 );
- VectorNormalize( v2 );
+ VectorSubtract( point, p2, v2 );
+ VectorNormalize( v2 );
- CrossProduct( v1, v2, up );
- VectorNormalize( up );
+ CrossProduct( v1, v2, up );
+ VectorNormalize( up );
}
/*
@@ -1408,21 +1408,21 @@ ProjectPointOntoVector
*/
void ProjectPointOntoVector( vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj )
{
- vec3_t pVec, vec;
+ vec3_t pVec, vec;
- VectorSubtract( point, vStart, pVec );
- VectorSubtract( vEnd, vStart, vec );
- VectorNormalize( vec );
- // project onto the directional vector for this segment
- VectorMA( vStart, DotProduct( pVec, vec ), vec, vProj );
+ VectorSubtract( point, vStart, pVec );
+ VectorSubtract( vEnd, vStart, vec );
+ VectorNormalize( vec );
+ // project onto the directional vector for this segment
+ VectorMA( vStart, DotProduct( pVec, vec ), vec, vProj );
}
float VectorDistance(vec3_t v1, vec3_t v2)
{
- vec3_t dir;
+ vec3_t dir;
- VectorSubtract(v2, v1, dir);
- return VectorLength(dir);
+ VectorSubtract(v2, v1, dir);
+ return VectorLength(dir);
}
// done.
diff --git a/src/game/q_shared.c b/src/game/q_shared.c
index bd133ab9..6133c89a 100644
--- a/src/game/q_shared.c
+++ b/src/game/q_shared.c
@@ -327,10 +327,10 @@ int COM_Compress( char *data_p )
}
else if( c == '/' && in[ 1 ] == '*' )
{
- while( *in && ( *in != '*' || in[ 1 ] != '/' ) )
+ while( *in && ( *in != '*' || in[ 1 ] != '/' ) )
in++;
-
- if( *in )
+
+ if( *in )
in += 2;
// record when we hit a newline
}
@@ -355,23 +355,23 @@ int COM_Compress( char *data_p )
newline = qfalse;
whitespace = qfalse;
}
-
+
if( whitespace )
{
*out++ = ' ';
whitespace = qfalse;
}
-
+
// copy quoted strings unmolested
if( c == '"' )
{
*out++ = c;
in++;
-
+
while( 1 )
{
c = *in;
-
+
if( c && c != '"' )
{
*out++ = c;
@@ -380,7 +380,7 @@ int COM_Compress( char *data_p )
else
break;
}
-
+
if( c == '"' )
{
*out++ = c;
@@ -899,10 +899,10 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...)
va_start( argptr, fmt );
len = vsprintf( bigbuffer, fmt, argptr );
va_end( argptr );
-
+
if( len >= sizeof( bigbuffer ) )
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
-
+
if( len >= size )
Com_Printf( "Com_sprintf: overflow of %i in %i\n", len, size );
@@ -973,10 +973,10 @@ char *Info_ValueForKey( const char *s, const char *key )
Com_Error( ERR_DROP, "Info_ValueForKey: oversize infostring" );
valueindex ^= 1;
-
+
if( *s == '\\' )
s++;
-
+
while( 1 )
{
o = pkey;
@@ -984,10 +984,10 @@ char *Info_ValueForKey( const char *s, const char *key )
{
if( !*s )
return "";
-
+
*o++ = *s++;
}
-
+
*o = 0;
s++;
@@ -995,7 +995,7 @@ char *Info_ValueForKey( const char *s, const char *key )
while( *s != '\\' && *s )
*o++ = *s++;
-
+
*o = 0;
if( !Q_stricmp( key, pkey ) )
@@ -1176,7 +1176,7 @@ qboolean Info_Validate( const char *s )
{
if( strchr( s, '\"' ) )
return qfalse;
-
+
if( strchr( s, ';' ) )
return qfalse;
diff --git a/src/game/q_shared.h b/src/game/q_shared.h
index 69496267..e9c09c48 100644
--- a/src/game/q_shared.h
+++ b/src/game/q_shared.h
@@ -136,7 +136,7 @@ float FloatSwap (const float *f);
#endif
#endif
-#define ID_INLINE __inline
+#define ID_INLINE __inline
static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
#define LittleShort
@@ -157,7 +157,7 @@ static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); }
#define __cdecl
#define __declspec(x)
#define stricmp strcasecmp
-#define ID_INLINE inline
+#define ID_INLINE inline
#ifdef __ppc__
#define CPUSTRING "MacOSX-ppc"
@@ -174,21 +174,21 @@ static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); }
static inline unsigned int __lwbrx(register void *addr, register int offset) {
register unsigned int word;
-
+
asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "b" (offset));
return word;
}
static inline unsigned short __lhbrx(register void *addr, register int offset) {
register unsigned short halfword;
-
+
asm("lhbrx %0,%2,%1" : "=r" (halfword) : "r" (addr), "b" (offset));
return halfword;
}
static inline float __fctiw(register float f) {
register float fi;
-
+
asm("fctiw %0,%1" : "=f" (fi) : "f" (f));
return fi;
@@ -209,7 +209,7 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); }
#include <MacTypes.h>
#define MAC_STATIC
-#define ID_INLINE inline
+#define ID_INLINE inline
#define CPUSTRING "MacOS-PPC"
@@ -236,7 +236,7 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); }
#define stricmp strcasecmp
#define MAC_STATIC // bk: FIXME
-#define ID_INLINE inline
+#define ID_INLINE inline
#ifdef __i386__
#define CPUSTRING "linux-i386"
@@ -280,7 +280,7 @@ inline static float LittleFloat (const float *l) { return FloatSwap(l); }
#define stricmp strcasecmp
#define MAC_STATIC
-#define ID_INLINE inline
+#define ID_INLINE inline
#ifdef __i386__
#define CPUSTRING "freebsd-i386"
@@ -565,7 +565,7 @@ extern vec3_t axisDefault[3];
static inline float Q_rsqrt( float number ) {
float x = 0.5f * number;
float y;
-#ifdef __GNUC__
+#ifdef __GNUC__
asm("frsqrte %0,%1" : "=f" (y) : "f" (number));
#else
y = __frsqrte( number );
@@ -573,10 +573,10 @@ static inline float Q_rsqrt( float number ) {
return y * (1.5f - (x * y * y));
}
-#ifdef __GNUC__
+#ifdef __GNUC__
static inline float Q_fabs(float x) {
float abs_x;
-
+
asm("fabs %0,%1" : "=f" (abs_x) : "f" (x));
return abs_x;
}
@@ -658,7 +658,7 @@ void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs );
static ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) {
if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
return 0;
- }
+ }
return 1;
}
@@ -719,7 +719,7 @@ vec_t VectorLengthSquared( const vec3_t v );
vec_t Distance( const vec3_t p1, const vec3_t p2 );
vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 );
-
+
void VectorNormalizeFast( vec3_t v );
void VectorInverse( vec3_t v );
@@ -1125,7 +1125,7 @@ typedef struct {
#define MAX_STATS 16
#define MAX_PERSISTANT 16
#define MAX_POWERUPS 16
-#define MAX_WEAPONS 16
+#define MAX_WEAPONS 16
#define MAX_PS_EVENTS 2
@@ -1245,7 +1245,7 @@ typedef struct usercmd_s {
int serverTime;
int angles[3];
int buttons;
- byte weapon; // weapon
+ byte weapon; // weapon
signed char forwardmove, rightmove, upmove;
} usercmd_t;
@@ -1326,7 +1326,7 @@ typedef struct entityState_s {
typedef enum {
CA_UNINITIALIZED,
CA_DISCONNECTED, // not talking to a server
- CA_AUTHORIZING, // not used any more, was checking cd key
+ CA_AUTHORIZING, // not used any more, was checking cd key
CA_CONNECTING, // sending request packets to the server
CA_CHALLENGING, // sending challenge packets to the server
CA_CONNECTED, // netchan_t established, getting gamestate
@@ -1336,7 +1336,7 @@ typedef enum {
CA_CINEMATIC // playing a cinematic or a static pic, not connected to a server
} connstate_t;
-// font support
+// font support
#define GLYPH_START 0
#define GLYPH_END 255
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index e1f30ed9..ddee71de 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -10,7 +10,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
+
/*
* ALIEN weapons
@@ -19,7 +19,7 @@
* _DMG - amount of damage the weapon does
*
* ALIEN_WDMG_MODIFIER - overall damage modifier for coarse tuning
- *
+ *
*/
#define ALIEN_WDMG_MODIFIER 1.0f
@@ -108,7 +108,7 @@
* _REGEN - health per second regained
*
* ALIEN_HLTH_MODIFIER - overall health modifier for coarse tuning
- *
+ *
*/
#define ALIEN_HLTH_MODIFIER 1.0f
@@ -190,13 +190,13 @@
*
* CREEP_BASESIZE - the maximum distance a buildable can be from an egg/overmind
* ALIEN_BHLTH_MODIFIER - overall health modifier for coarse tuning
- *
+ *
*/
#define ALIEN_BHLTH_MODIFIER 1.0f
#define ABHM(h) ((int)((float)h*ALIEN_BHLTH_MODIFIER))
-#define CREEP_BASESIZE 700
+#define CREEP_BASESIZE 700
#define CREEP_TIMEOUT 1000
#define CREEP_MODIFIER 0.5f
#define CREEP_ARMOUR_MODIFIER 0.75f
@@ -289,7 +289,7 @@
* ALIEN misc
*
* ALIENSENSE_RANGE - the distance alien sense is useful for
- *
+ *
*/
#define ALIENSENSE_RANGE 1000.0f
@@ -310,7 +310,7 @@
* _PRICE - amount in credits weapon costs
*
* HUMAN_WDMG_MODIFIER - overall damage modifier for coarse tuning
- *
+ *
*/
#define HUMAN_WDMG_MODIFIER 1.0f
@@ -448,12 +448,12 @@
* _BP - build points required for this buildable
* _BT - build time required for this buildable
* _SPLASHDAMGE - the amount of damage caused by this buildable when it blows up
- * _SPLASHRADIUS - the radius around which it does this damage
+ * _SPLASHRADIUS - the radius around which it does this damage
*
* REACTOR_BASESIZE - the maximum distance a buildable can be from an reactor
* REPEATER_BASESIZE - the maximum distance a buildable can be from a repeater
* HUMAN_BHLTH_MODIFIER - overall health modifier for coarse tuning
- *
+ *
*/
#define HUMAN_BHLTH_MODIFIER 1.0f
@@ -567,5 +567,5 @@
#define DEFAULT_ALIEN_BUILDPOINTS "100"
#define DEFAULT_HUMAN_BUILDPOINTS "100"
-#define DAMAGE_FRACTION_FOR_KILL 0.5f //how much damage players (versus structures) need to
+#define DAMAGE_FRACTION_FOR_KILL 0.5f //how much damage players (versus structures) need to
//do to increment the stage kill counters