summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsa Kravets <norfenstein@gmail.com>2011-08-18 23:46:32 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:13 +0000
commit7ddf23608386296480032e53044d3f17ab34a5a6 (patch)
tree05d39b414544fce8a078b2ff0341f990644e86b8
parentd432478aad0b3f0e9254762fc41471212c315652 (diff)
* Change the distance of zap chains from 200->150, and make zap chain damage attenuate over distance
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_weapon.c21
-rw-r--r--src/game/tremulous.h2
3 files changed, 16 insertions, 8 deletions
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 824c7f68..e027b415 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -936,6 +936,7 @@ typedef struct zap_s
gentity_t *creator;
gentity_t *targets[ LEVEL2_AREAZAP_MAX_TARGETS ];
int numTargets;
+ float distances[ LEVEL2_AREAZAP_MAX_TARGETS ];
int timeToLive;
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index c59f30ab..4db751ab 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -1038,13 +1038,14 @@ static void G_FindZapChainTargets( zap_t *zap )
{
gentity_t *ent = zap->targets[ 0 ]; // the source
int entityList[ MAX_GENTITIES ];
- vec3_t range = { LEVEL2_AREAZAP_RANGE,
- LEVEL2_AREAZAP_RANGE,
- LEVEL2_AREAZAP_RANGE };
+ vec3_t range = { LEVEL2_AREAZAP_CHAIN_RANGE,
+ LEVEL2_AREAZAP_CHAIN_RANGE,
+ LEVEL2_AREAZAP_CHAIN_RANGE };
vec3_t mins, maxs;
int i, num;
gentity_t *enemy;
trace_t tr;
+ float distance;
VectorAdd( ent->s.origin, range, maxs );
VectorSubtract( ent->s.origin, range, mins );
@@ -1058,12 +1059,14 @@ static void G_FindZapChainTargets( zap_t *zap )
if( enemy == ent || ( enemy->client && enemy->client->noclip ) )
continue;
+ distance = Distance( ent->s.origin, enemy->s.origin );
+
if( ( ( enemy->client &&
enemy->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) ||
( enemy->s.eType == ET_BUILDABLE &&
BG_Buildable( enemy->s.modelindex )->team == TEAM_HUMANS ) ) &&
enemy->health > 0 && // only chain to living targets
- Distance( ent->s.origin, enemy->s.origin ) <= LEVEL2_AREAZAP_RANGE )
+ distance <= LEVEL2_AREAZAP_CHAIN_RANGE )
{
// world-LOS check: trace against the world, ignoring other BODY entities
trap_Trace( &tr, ent->s.origin, NULL, NULL,
@@ -1071,8 +1074,9 @@ static void G_FindZapChainTargets( zap_t *zap )
if( tr.entityNum == ENTITYNUM_NONE )
{
- zap->targets[ zap->numTargets++ ] = enemy;
- if( zap->numTargets >= LEVEL2_AREAZAP_MAX_TARGETS )
+ zap->targets[ zap->numTargets ] = enemy;
+ zap->distances[ zap->numTargets ] = distance;
+ if( ++zap->numTargets >= LEVEL2_AREAZAP_MAX_TARGETS )
return;
}
}
@@ -1136,8 +1140,9 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target )
for( i = 1; i < zap->numTargets; i++ )
{
- G_Damage( zap->targets[ i ], target, zap->creator, forward,
- target->s.origin, LEVEL2_AREAZAP_DMG,
+ G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin,
+ LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] /
+ LEVEL2_AREAZAP_CHAIN_RANGE ), LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1,
DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE,
MOD_LEVEL2_ZAP );
}
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index f81c3562..4c0adf2f 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -84,6 +84,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define LEVEL2_CLAW_U_K_SCALE 1.0f
#define LEVEL2_AREAZAP_DMG ADM(60)
#define LEVEL2_AREAZAP_RANGE 200.0f
+#define LEVEL2_AREAZAP_CHAIN_RANGE 150.0f
+#define LEVEL2_AREAZAP_CHAIN_FALLOFF 8.0f
#define LEVEL2_AREAZAP_WIDTH 15.0f
#define LEVEL2_AREAZAP_REPEAT 1500
#define LEVEL2_AREAZAP_TIME 1000