diff options
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/game/g_active.c | 10 | ||||
-rw-r--r-- | src/game/g_client.c | 6 | ||||
-rw-r--r-- | src/game/g_local.h | 3 | ||||
-rw-r--r-- | src/game/g_weapon.c | 12 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 5 |
7 files changed, 25 insertions, 14 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 9bdcb3b9..97606f10 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1515,6 +1515,7 @@ extern vmCvar_t cg_painBlendZoom; extern vmCvar_t cg_stickySpec; extern vmCvar_t cg_alwaysSprint; +extern vmCvar_t cg_unlagged; extern vmCvar_t cg_debugVoices; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 8f2996f2..da38ebae 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -196,6 +196,7 @@ vmCvar_t cg_painBlendZoom; vmCvar_t cg_stickySpec; vmCvar_t cg_alwaysSprint; +vmCvar_t cg_unlagged; vmCvar_t cg_debugVoices; @@ -285,6 +286,7 @@ static cvarTable_t cvarTable[ ] = { &cg_wwToggle, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_stickySpec, "cg_stickySpec", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_alwaysSprint, "cg_alwaysSprint", "0", CVAR_ARCHIVE|CVAR_USERINFO }, + { &cg_unlagged, "cg_unlagged", "1", CVAR_ARCHIVE|CVAR_USERINFO }, { &cg_depthSortParticles, "cg_depthSortParticles", "1", CVAR_ARCHIVE }, { &cg_bounceParticles, "cg_bounceParticles", "0", CVAR_ARCHIVE }, { &cg_consoleLatency, "cg_consoleLatency", "3000", CVAR_ARCHIVE }, 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++ ) { diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 68fd619a..84408371 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -1039,12 +1039,7 @@ typedef struct { #define MAX_STATS 16 #define MAX_PERSISTANT 16 #define MAX_MISC 16 -<<<<<<< #define MAX_WEAPONS 16 -||||||| -======= -#define MAX_WEAPONS 16 ->>>>>>> #define MAX_PS_EVENTS 2 |