summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 12:40:20 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:08 +0000
commitb7ada862f67907dd012528ba9fecc4b7e4d7281f (patch)
tree9c404b6370b9758d5db1207c3e3314ca38ddc3e2 /src/cgame
parent8669691825a019653614f16573f0b5aad329df2e (diff)
* make zap display targets beyond 3 and general zap cleanup
* Remove version determining code from makefile since it has to walk 300 revisions every compile and produces incorrect results anyway
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_ents.c44
-rw-r--r--src/cgame/cg_local.h2
2 files changed, 15 insertions, 31 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 1cdcfde7..f2c4d8a0 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -809,41 +809,25 @@ static void CG_Lev2ZapChain( centity_t *cent )
{
int i;
entityState_t *es;
- centity_t *source = NULL, *target = NULL;
+ centity_t *source = NULL, *target = NULL, *attacker = NULL;
+ int targets[ LEVEL2_AREAZAP_MAX_TARGETS + 1 ];
es = &cent->currentState;
- //FIXME: find a better way to send zap targets
- 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;
+ BG_UnpackZapTargets( es, targets, LEVEL2_AREAZAP_MAX_TARGETS + 1 );
+ attacker = &cg_entities[ targets[ 0 ] ];
- case 2:
- if( es->constantLight <= 0 )
- continue;
-
- source = &cg_entities[ es->time ];
- target = &cg_entities[ es->constantLight ];
- break;
+ for( i = 1; i < LEVEL2_AREAZAP_MAX_TARGETS + 1; i++ )
+ {
+ if( i == 1 )
+ source = attacker;
+ else
+ source = &cg_entities[ targets[ 1 ] ];
- }
+ if( targets[ i ] == ENTITYNUM_NONE )
+ continue;
+ target = &cg_entities[ targets[ i ] ];
if( !CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
cent->level2ZapTS[ i ] = CG_SpawnNewTrailSystem( cgs.media.level2ZapTS );
@@ -1061,7 +1045,7 @@ static void CG_CEntityPVSLeave( centity_t *cent )
switch( es->eType )
{
case ET_LEV2_ZAP_CHAIN:
- for( i = 0; i <= 2; i++ )
+ for( i = 0; i <= LEVEL2_AREAZAP_MAX_TARGETS; i++ )
{
if( CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
CG_DestroyTrailSystem( &cent->level2ZapTS[ i ] );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 89e86935..be2d8cbd 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -674,7 +674,7 @@ typedef struct centity_s
particleSystem_t *entityPS;
qboolean entityPSMissing;
- trailSystem_t *level2ZapTS[ 3 ];
+ trailSystem_t *level2ZapTS[ LEVEL2_AREAZAP_MAX_TARGETS ];
int level2ZapTime;
trailSystem_t *muzzleTS; //used for the tesla and reactor