From 56216608bcd41c5e281335c8a6caed5fcc419190 Mon Sep 17 00:00:00 2001 From: q3rally Date: Sun, 1 May 2011 08:21:44 +0000 Subject: [PATCH] Added debris from EntityPlusMod. --- engine/code/cgame/cg_event.c | 4 +- engine/code/game/g_weapon.c | 194 ----------------------------------- 2 files changed, 1 insertion(+), 197 deletions(-) diff --git a/engine/code/cgame/cg_event.c b/engine/code/cgame/cg_event.c index d52047f1..3b29173b 100644 --- a/engine/code/cgame/cg_event.c +++ b/engine/code/cgame/cg_event.c @@ -1030,9 +1030,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { trap_S_StartSound (NULL, es->number, CHAN_AUTO, cgs.media.hgrenb2aSound ); } break; - case EV_LIGHTNINGARC: - CG_LightningArc( position, es->origin2 ); - break; + #ifdef MISSIONPACK case EV_PROXIMITY_MINE_STICK: diff --git a/engine/code/game/g_weapon.c b/engine/code/game/g_weapon.c index 44b8106f..c07e35b2 100644 --- a/engine/code/game/g_weapon.c +++ b/engine/code/game/g_weapon.c @@ -914,200 +914,6 @@ void Weapon_HookThink (gentity_t *ent) // END -//================================================ -// Chain Lightning Fire -//================================================ - -static gentity_t *chain_targets[MAX_CLIENTS]; - -void ChainLightning_Fire( gentity_t *ent, gentity_t *target ) - - { - int i, j, damage, currentTargetTotal; - qboolean isChainTarget; - vec3_t dir; - gentity_t *tent, *oldtarget; - float tent_dist, targetlength; - trace_t tr, targettr; - - damage = 8 * s_quadFactor; - currentTargetTotal = 1; - chain_targets[0] = target; - - while (1) { - oldtarget = target; - target = NULL; - - for (i = 0; i < MAX_CLIENTS; i++) { - - tent = &g_entities[i]; - isChainTarget = qfalse; - - // is the entity in use? - if ( !tent->inuse ) - continue; - - // is the entity the attacker? - if ( tent == ent ) - continue; - - // is the entity the current primary target? - for ( j = 0; j < currentTargetTotal; j++) { - if (tent == chain_targets[j]) { - isChainTarget = qtrue; - break; - } - } - - if (isChainTarget) - continue; - - // is the entity too far for a stabdard lightning beam to reach? - VectorSubtract(oldtarget->r.currentOrigin, tent->r.currentOrigin, dir); - tent_dist = VectorLength(dir); - if ( tent_dist > LIGHTNING_RANGE ) - continue; - - // does a valid trace occur between our primary target and the new target? - trap_Trace( &tr, oldtarget->r.currentOrigin, NULL, NULL, tent->r.currentOrigin, ENTITYNUM_NONE, MASK_SHOT ); - if ( tent != &g_entities[tr.entityNum] ) - continue; - - // all checks pass, we have a new target - target = tent; - targettr = tr; - targetlength = tent_dist; - - } - - if (!target) - break; - - if (!target->takedamage) - break; - - chain_targets[currentTargetTotal++] = target; - - // Use tent to create the temporary lightning event entity - tent = G_TempEntity( targettr.endpos, EV_MISSILE_HIT ); - tent->s.otherEntityNum = target->s.number; - tent->s.eventParm = DirToByte( targettr.plane.normal ); - tent->s.weapon = WP_LIGHTNING; - - // Deal out the damage - G_Damage( target, ent, ent, dir, targettr.endpos, damage, DAMAGE_WEAPON, MOD_LIGHTNING ); - - // Signal for the lightning event - tent = G_TempEntity( oldtarget->r.currentOrigin, EV_LIGHTNINGARC ); - - // Set the destination of the arc for the client event to pickup - VectorCopy( target->r.currentOrigin, tent->s.origin2 ); - - } - -} - -/* -====================================================================== - -CHAIN LIGHTNING GUN - -====================================================================== -*/ - -void Weapon_Chain_LightningFire( gentity_t *ent ) { - trace_t tr; - vec3_t end; -#ifdef MISSIONPACK - vec3_t impactpoint, bouncedir; -#endif - gentity_t *traceEnt, *tent; - int damage, i, passent; - - damage = 8 * s_quadFactor; - - passent = ent->s.number; - for (i = 0; i < 10; i++) { - VectorMA( muzzle, LIGHTNING_RANGE, forward, end ); - - trap_Trace( &tr, muzzle, NULL, NULL, end, passent, MASK_SHOT ); - -#ifdef MISSIONPACK - // if not the first trace (the lightning bounced of an invulnerability sphere) - if (i) { - // add bounced off lightning bolt temp entity - // the first lightning bolt is a cgame only visual - // - tent = G_TempEntity( muzzle, EV_LIGHTNINGBOLT ); - VectorCopy( tr.endpos, end ); - SnapVector( end ); - VectorCopy( end, tent->s.origin2 ); - } -#endif - if ( tr.entityNum == ENTITYNUM_NONE ) { - return; - } - -// STONELANCE -// traceEnt = &g_entities[ tr.entityNum ]; - if (g_entities[ tr.entityNum ].flags & FL_EXTRA_BBOX) - traceEnt = &g_entities[ g_entities[ tr.entityNum ].r.ownerNum ]; - else - traceEnt = &g_entities[ tr.entityNum ]; -// END - - - if ( traceEnt->takedamage) { -#ifdef MISSIONPACK - if ( traceEnt->client && traceEnt->client->invulnerabilityTime > level.time ) { - if (G_InvulnerabilityEffect( traceEnt, forward, tr.endpos, impactpoint, bouncedir )) { - G_BounceProjectile( muzzle, impactpoint, bouncedir, end ); - VectorCopy( impactpoint, muzzle ); - VectorSubtract( end, impactpoint, forward ); - VectorNormalize(forward); - // the player can hit him/herself with the bounced lightning - passent = ENTITYNUM_NONE; - } - else { - VectorCopy( tr.endpos, muzzle ); - passent = traceEnt->s.number; - } - continue; - } - else { - G_Damage( traceEnt, ent, ent, forward, tr.endpos, -// STONELANCE -// damage, 0, MOD_LIGHTNING); - damage, DAMAGE_WEAPON, MOD_LIGHTNING); - ChainLightning_Fire( ent, traceEnt ); -// END - } -#else - G_Damage( traceEnt, ent, ent, forward, tr.endpos, -// STONELANCE -// damage, 0, MOD_LIGHTNING); - damage, DAMAGE_WEAPON, MOD_LIGHTNING); - ChainLightning_Fire( ent, traceEnt ); -// END -#endif - } - - if ( traceEnt->takedamage && traceEnt->client ) { - tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); - tent->s.otherEntityNum = traceEnt->s.number; - tent->s.eventParm = DirToByte( tr.plane.normal ); - tent->s.weapon = ent->s.weapon; - if( LogAccuracyHit( traceEnt, ent ) ) { - ent->client->accuracy_hits++; - } - } else if ( !( tr.surfaceFlags & SURF_NOIMPACT ) ) { - tent = G_TempEntity( tr.endpos, EV_MISSILE_MISS ); - tent->s.eventParm = DirToByte( tr.plane.normal ); - } - - break; - } -} /* ======================================================================