summaryrefslogtreecommitdiff
path: root/src/cgame/cg_ents.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame/cg_ents.c')
-rw-r--r--src/cgame/cg_ents.c104
1 files changed, 30 insertions, 74 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 17f1a7d3..c6597b6b 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -216,6 +216,8 @@ Add continuous entity effects, like local entity emission and lighting
*/
static void CG_EntityEffects( centity_t *cent )
{
+ int i;
+
// update sound origins
CG_SetEntitySoundPosition( cent );
@@ -251,7 +253,7 @@ static void CG_EntityEffects( centity_t *cent )
if( CG_IsTrailSystemValid( &cent->muzzleTS ) )
{
- //FIXME hack to prevent tesla trails reaching too far
+ //FIXME hack to prevent tesla trails reaching too far
if( cent->currentState.eType == ET_BUILDABLE )
{
vec3_t front, back;
@@ -266,6 +268,33 @@ static void CG_EntityEffects( centity_t *cent )
if( cg.time > cent->muzzleTSDeathTime && CG_IsTrailSystemValid( &cent->muzzleTS ) )
CG_DestroyTrailSystem( &cent->muzzleTS );
}
+
+
+ if( cent->currentState.eType == ET_PLAYER )
+ {
+ centity_t *pcent = cent;;
+
+ // predicted entity doesn't have local cgame vars
+ if( cent == &cg.predictedPlayerEntity )
+ pcent = &cg_entities[ cg.clientNum ];
+
+ for( i = 0; i <= 2; i++ )
+ {
+ if( CG_IsTrailSystemValid( &pcent->level2ZapTS[ i ] ) )
+ {
+ vec3_t front, back;
+
+ CG_AttachmentPoint( &pcent->level2ZapTS[ i ]->frontAttachment, front );
+ CG_AttachmentPoint( &pcent->level2ZapTS[ i ]->backAttachment, back );
+
+ if( cg.time - pcent->level2ZapTime > 100 ||
+ Distance( front, back ) > LEVEL2_AREAZAP_CUTOFF )
+ {
+ CG_DestroyTrailSystem( &pcent->level2ZapTS[ i ] );
+ }
+ }
+ }
+ }
}
@@ -780,61 +809,6 @@ static void CG_LightFlare( centity_t *cent )
/*
=========================
-CG_Lev2ZapChain
-=========================
-*/
-static void CG_Lev2ZapChain( centity_t *cent )
-{
- int i;
- entityState_t *es;
- centity_t *source = NULL, *target = NULL;
-
- es = &cent->currentState;
-
- for( i = 0; i <= 2; i++ )
- {
- switch( i )
- {
- case 0:
- if( es->time <= 0 )
- continue;
-
- source = &cg_entities[ es->misc ];
- target = &cg_entities[ es->time ];
- break;
-
- case 1:
- if( es->time2 <= 0 )
- continue;
-
- source = &cg_entities[ es->time ];
- target = &cg_entities[ es->time2 ];
- break;
-
- case 2:
- if( es->constantLight <= 0 )
- continue;
-
- source = &cg_entities[ es->time2 ];
- target = &cg_entities[ es->constantLight ];
- break;
- }
-
- if( !CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
- cent->level2ZapTS[ i ] = CG_SpawnNewTrailSystem( cgs.media.level2ZapTS );
-
- if( CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
- {
- CG_SetAttachmentCent( &cent->level2ZapTS[ i ]->frontAttachment, source );
- CG_SetAttachmentCent( &cent->level2ZapTS[ i ]->backAttachment, target );
- CG_AttachToCent( &cent->level2ZapTS[ i ]->frontAttachment );
- CG_AttachToCent( &cent->level2ZapTS[ i ]->backAttachment );
- }
- }
-}
-
-/*
-=========================
CG_AdjustPositionForMover
Also called by client movement prediction code
@@ -1029,22 +1003,8 @@ CG_CEntityPVSLeave
*/
static void CG_CEntityPVSLeave( centity_t *cent )
{
- int i;
- entityState_t *es = &cent->currentState;
-
if( cg_debugPVS.integer )
CG_Printf( "Entity %d left PVS\n", cent->currentState.number );
-
- switch( es->eType )
- {
- case ET_LEV2_ZAP_CHAIN:
- for( i = 0; i <= 2; i++ )
- {
- if( CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
- CG_DestroyTrailSystem( &cent->level2ZapTS[ i ] );
- }
- break;
- }
}
@@ -1128,10 +1088,6 @@ static void CG_AddCEntity( centity_t *cent )
case ET_LIGHTFLARE:
CG_LightFlare( cent );
break;
-
- case ET_LEV2_ZAP_CHAIN:
- CG_Lev2ZapChain( cent );
- break;
}
}