mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-21 19:41:36 +00:00
Added debris from EntityPlusMod.
This commit is contained in:
parent
f49a14a818
commit
56216608bc
2 changed files with 1 additions and 197 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================================================================
|
||||
|
|
Loading…
Reference in a new issue