summaryrefslogtreecommitdiff
path: root/src/game/g_weapon.c
diff options
context:
space:
mode:
authorAsa Kravets <norfenstein@gmail.com>2011-04-04 23:34:28 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:03 +0000
commit99436a23e7f2ca74401f90b79c865280c5086ff1 (patch)
treed6e2e826f0266075c05a838410b1a4246b0b328b /src/game/g_weapon.c
parenta8bd455bbcc8c5e582ce0526a8b5453052c26610 (diff)
* Change trample to not lose all charge on hitting a structure, and keep track of structures to only allow one hit each (thanks Lakitu7)
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r--src/game/g_weapon.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index a6566d72..1c227ffd 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -1366,6 +1366,7 @@ G_ChargeAttack
void G_ChargeAttack( gentity_t *ent, gentity_t *victim )
{
int damage;
+ int i;
vec3_t forward, normal;
if( ent->client->ps.stats[ STAT_MISC ] <= 0 ||
@@ -1376,10 +1377,26 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim )
VectorSubtract( victim->s.origin, ent->s.origin, forward );
VectorNormalize( forward );
VectorNegate( forward, normal );
-
+
if( !victim->takedamage )
return;
+ // For buildables, track the last MAX_TRAMPLE_BUILDABLES_TRACKED buildables
+ // hit, and do not do damage if the current buildable is in that list
+ // in order to prevent dancing over stuff to kill it very quickly
+ if( !victim->client )
+ {
+ for( i = 0; i < MAX_TRAMPLE_BUILDABLES_TRACKED; i++ )
+ {
+ if( ent->client->trampleBuildablesHit[ i ] == victim - g_entities )
+ return;
+ }
+
+ ent->client->trampleBuildablesHit[
+ ent->client->trampleBuildablesHitPos++ % MAX_TRAMPLE_BUILDABLES_TRACKED ] =
+ victim - g_entities;
+ }
+
WideBloodSpurt( ent, victim, NULL );
damage = LEVEL4_TRAMPLE_DMG * ent->client->ps.stats[ STAT_MISC ] /
@@ -1389,9 +1406,6 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim )
DAMAGE_NO_LOCDAMAGE, MOD_LEVEL4_TRAMPLE );
ent->client->ps.weaponTime += LEVEL4_TRAMPLE_REPEAT;
-
- if( !victim->client )
- ent->client->ps.stats[ STAT_MISC ] = 0;
}
/*