summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 11:57:30 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:32 +0000
commitac1c165d0b8ac4cde29c798413054f246e4ba5ae (patch)
treefb33f1e1ffa294345adc4ee3e11ae397c5bfd69b /src/game
parent967f52dd997c56c11269ff8b86e95e23f620acb4 (diff)
* add cg_unlagged to allow clients to disable backward reconcilliation for their own attacks only
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_active.c10
-rw-r--r--src/game/g_client.c6
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_weapon.c12
4 files changed, 22 insertions, 9 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index a8888b50..84bdd7d9 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1162,7 +1162,7 @@ void G_UnlaggedOff( void )
==============
*/
-void G_UnlaggedOn( vec3_t muzzle, float range )
+void G_UnlaggedOn( gentity_t *attacker, vec3_t muzzle, float range )
{
int i = 0;
gentity_t *ent;
@@ -1171,6 +1171,9 @@ void G_UnlaggedOn( vec3_t muzzle, float range )
if( !g_unlagged.integer )
return;
+ if( !attacker->client->useUnlagged )
+ return;
+
for( i = 0; i < level.maxclients; i++ )
{
ent = &g_entities[ i ];
@@ -1239,6 +1242,9 @@ static void G_UnlaggedDetectCollisions( gentity_t *ent )
if( !g_unlagged.integer )
return;
+ if( !ent->client->useUnlagged )
+ return;
+
calc = &ent->client->unlaggedCalc;
// if the client isn't moving, this is not necessary
@@ -1253,7 +1259,7 @@ static void G_UnlaggedDetectCollisions( gentity_t *ent )
r2 = Distance( calc->origin, calc->maxs );
range += ( r1 > r2 ) ? r1 : r2;
- G_UnlaggedOn( ent->client->oldOrigin, range );
+ G_UnlaggedOn( ent, ent->client->oldOrigin, range );
trap_Trace(&tr, ent->client->oldOrigin, ent->r.mins, ent->r.maxs,
ent->client->ps.origin, ent->s.number, MASK_PLAYERSOLID );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 731cedc6..726e8b54 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1114,6 +1114,12 @@ void ClientUserinfoChanged( int clientNum )
client->pers.teamInfo = qtrue;
else
client->pers.teamInfo = qfalse;
+
+ s = Info_ValueForKey( userinfo, "cg_unlagged" );
+ if( !s[0] || atoi( s ) != 0 )
+ client->useUnlagged = qtrue;
+ else
+ client->useUnlagged = qfalse;
// colors
strcpy( c1, Info_ValueForKey( userinfo, "color1" ) );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index d7bb0a6f..087e9395 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -433,6 +433,7 @@ struct gclient_s
unlagged_t unlaggedBackup;
unlagged_t unlaggedCalc;
int unlaggedTime;
+ qboolean useUnlagged;
float voiceEnthusiasm;
char lastVoiceCmd[ MAX_VOICE_CMD_LEN ];
@@ -949,7 +950,7 @@ void ClientCommand( int clientNum );
void G_UnlaggedStore( void );
void G_UnlaggedClear( gentity_t *ent );
void G_UnlaggedCalc( int time, gentity_t *skipEnt );
-void G_UnlaggedOn( vec3_t muzzle, float range );
+void G_UnlaggedOn( gentity_t *attacker, vec3_t muzzle, float range );
void G_UnlaggedOff( void );
void ClientThink( int clientNum );
void ClientEndFrame( gentity_t *ent );
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 47ad4765..bf547dbb 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -156,7 +156,7 @@ static void G_WideTrace( trace_t *tr, gentity_t *ent, float range,
// Set aiming directions
VectorMA( muzzle, range, forward, end );
- G_UnlaggedOn( muzzle, range );
+ G_UnlaggedOn( ent, muzzle, range );
//prefer the target in the crosshairs
trap_Trace( tr, muzzle, NULL, NULL, end, ent->s.number, CONTENTS_BODY );
@@ -346,7 +346,7 @@ void bulletFire( gentity_t *ent, float spread, int damage, int mod )
// don't use unlagged if this is not a client (e.g. turret)
if( ent->client )
{
- G_UnlaggedOn( muzzle, 8192 * 16 );
+ G_UnlaggedOn( ent, muzzle, 8192 * 16 );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
G_UnlaggedOff( );
}
@@ -437,7 +437,7 @@ void shotgunFire( gentity_t *ent )
SnapVector( tent->s.origin2 );
tent->s.eventParm = rand() & 255; // seed for spread pattern
tent->s.otherEntityNum = ent->s.number;
- G_UnlaggedOn( muzzle, SHOTGUN_RANGE );
+ G_UnlaggedOn( ent, muzzle, SHOTGUN_RANGE );
ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent );
G_UnlaggedOff();
}
@@ -459,7 +459,7 @@ void massDriverFire( gentity_t *ent )
VectorMA( muzzle, 8192 * 16, forward, end );
- G_UnlaggedOn( muzzle, 8192 * 16 );
+ G_UnlaggedOn( ent, muzzle, 8192 * 16 );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
G_UnlaggedOff( );
@@ -622,7 +622,7 @@ void lasGunFire( gentity_t *ent )
VectorMA( muzzle, 8192 * 16, forward, end );
- G_UnlaggedOn( muzzle, 8192 * 16 );
+ G_UnlaggedOn( ent, muzzle, 8192 * 16 );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
G_UnlaggedOff( );
@@ -1030,7 +1030,7 @@ void poisonCloud( gentity_t *ent )
VectorAdd( ent->client->ps.origin, range, maxs );
VectorSubtract( ent->client->ps.origin, range, mins );
- G_UnlaggedOn( ent->client->ps.origin, LEVEL1_PCLOUD_RANGE );
+ G_UnlaggedOn( ent, ent->client->ps.origin, LEVEL1_PCLOUD_RANGE );
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
for( i = 0; i < num; i++ )
{