summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 12:47:32 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:14 +0000
commit741ddb89552f73f13e6adba4503742bcc0065a61 (patch)
treeb6a659c5f087e58a59d938d9b909e04a6cda3e4a /src/cgame
parentc4fe8300adef0b3d63152c419f9411f14eb41831 (diff)
* Replace BG_(Un)PackZapTargets with more generic and less muddled BG_(Un)PackEntityNumbers
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_ents.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 8f872f31..eed57686 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -809,25 +809,29 @@ static void CG_Lev2ZapChain( centity_t *cent )
{
int i;
entityState_t *es;
- centity_t *source = NULL, *target = NULL, *attacker = NULL;
- int targets[ LEVEL2_AREAZAP_MAX_TARGETS ], creator;
+ centity_t *source = NULL, *target = NULL;
+ int entityNums[ LEVEL2_AREAZAP_MAX_TARGETS + 1 ];
+ int count;
es = &cent->currentState;
- BG_UnpackZapTargets( es, &creator, targets, LEVEL2_AREAZAP_MAX_TARGETS + 1 );
- attacker = &cg_entities[ creator ];
+ count = BG_UnpackEntityNumbers( es, entityNums, LEVEL2_AREAZAP_MAX_TARGETS + 1 );
- for( i = 0; i < LEVEL2_AREAZAP_MAX_TARGETS; i++ )
+ for( i = 1; i < count; i++ )
{
- if( i == 0 )
- source = attacker;
+ if( i == 1 )
+ {
+ // First entity is the attacker
+ source = &cg_entities[ entityNums[ 0 ] ];
+ }
else
- source = &cg_entities[ targets[ 0 ] ];
+ {
+ // Subsequent zaps come from the first target
+ source = &cg_entities[ entityNums[ 1 ] ];
+ }
- if( targets[ i ] == ENTITYNUM_NONE )
- continue;
+ target = &cg_entities[ entityNums[ i ] ];
- target = &cg_entities[ targets[ i ] ];
if( !CG_IsTrailSystemValid( &cent->level2ZapTS[ i ] ) )
cent->level2ZapTS[ i ] = CG_SpawnNewTrailSystem( cgs.media.level2ZapTS );