diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_event.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 7 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 40 | ||||
-rw-r--r-- | src/game/g_weapon.c | 12 |
4 files changed, 25 insertions, 36 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 1a28c2a8..b3c05a66 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -959,7 +959,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_TESLATRAIL: DEBUGNAME("EV_TESLATRAIL"); cent->currentState.weapon = WP_TESLAGEN; - CG_TeslaTrail( es->origin2, es->pos.trBase ); + CG_TeslaTrail( es->origin2, es->pos.trBase, es->generic1, es->clientNum ); break; case EV_BULLET_HIT_WALL: diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 184c3830..c836040a 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -291,6 +291,11 @@ typedef struct localEntity_s { qboolean overdraw; qboolean realLight; int sortKey; + + //TA: lightning bolt endpoint entities + int srcENum, destENum; + int vOffset; + int maxRange; } localEntity_t; //====================================================================== @@ -1472,7 +1477,7 @@ void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean fles void CG_LasGunHit( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum ); void CG_RailTrail( vec3_t start, vec3_t end ); -void CG_TeslaTrail( vec3_t start, vec3_t end ); +void CG_TeslaTrail( vec3_t start, vec3_t end, int srcENum, int destENum ); void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi ); void CG_AddViewWeapon (playerState_t *ps); void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 0c24001a..8909285b 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -283,43 +283,11 @@ void CG_RailTrail( vec3_t start, vec3_t end ) CG_TeslaTrail ========================== */ -void CG_TeslaTrail( vec3_t start, vec3_t end ) +void CG_TeslaTrail( vec3_t start, vec3_t end, int srcENum, int destENum ) { localEntity_t *le; refEntity_t *re; - -/* start[ 2 ] += 12; //nudge up a bit so the bolt comes from the sphere - - //add a bunch of bolt segments - le = CG_AllocLocalEntity(); - re = &le->refEntity; - - le->leType = LE_FADE_RGB; - le->startTime = cg.time; - le->endTime = cg.time + cg_teslaTrailTime.value; - le->lifeRate = 1.0 / ( le->endTime - le->startTime ); - - re->shaderTime = cg.time / 1000.0f; - re->reType = RT_RAIL_CORE; - re->customShader = cgs.media.lightningShader; - - VectorCopy( start, re->origin ); - VectorCopy( end, re->oldorigin ); - - re->shaderRGBA[0] = 255; - re->shaderRGBA[1] = 255; - re->shaderRGBA[2] = 255; - re->shaderRGBA[3] = 255; - - le->color[0] = 1.0f; - le->color[1] = 1.0f; - le->color[2] = 1.0f; - le->color[3] = 1.0f; - - AxisClear( re->axis );*/ - start[ 2 ] += 12; //nudge up a bit so the bolt comes from the sphere - //add a bunch of bolt segments le = CG_AllocLocalEntity(); re = &le->refEntity; @@ -328,6 +296,12 @@ void CG_TeslaTrail( vec3_t start, vec3_t end ) le->startTime = cg.time; le->endTime = cg.time + cg_teslaTrailTime.value; le->lifeRate = 1.0 / ( le->endTime - le->startTime ); + re->customShader = cgs.media.lightningShader; + + le->srcENum = srcENum; + le->destENum = destENum; + le->vOffset = 28; + le->maxRange = BG_FindRangeForBuildable( BA_H_DEF3 ); VectorCopy( start, re->origin ); VectorCopy( end, re->oldorigin ); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index a9021350..85acdf64 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -381,8 +381,12 @@ void teslaFire( gentity_t *ent ) tent = G_TempEntity( tr.endpos, EV_TESLATRAIL ); VectorCopy( muzzle, tent->s.origin2 ); + + tent->s.generic1 = ent->s.number; //src + tent->s.clientNum = traceEnt->s.number; //dest + // move origin a bit to come closer to the drawn gun muzzle - VectorMA( tent->s.origin2, 16, up, tent->s.origin2 ); + VectorMA( tent->s.origin2, 28, up, tent->s.origin2 ); // no explosion at end if SURF_NOIMPACT, but still make the trail if( tr.surfaceFlags & SURF_NOIMPACT ) @@ -770,6 +774,9 @@ void areaZapFire( gentity_t *ent ) tent = G_TempEntity( enemy->s.pos.trBase, EV_TESLATRAIL ); VectorCopy( muzzle, tent->s.origin2 ); + + tent->s.generic1 = ent->s.number; //src + tent->s.clientNum = enemy->s.number; //dest } } @@ -808,6 +815,9 @@ void directZapFire( gentity_t *ent ) VectorCopy( muzzle, tent->s.origin2 ); + tent->s.generic1 = ent->s.number; //src + tent->s.clientNum = -1; //dest + // no explosion at end if SURF_NOIMPACT, but still make the trail if( tr.surfaceFlags & SURF_NOIMPACT ) tent->s.eventParm = 255; // don't make the explosion at the end |