diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_active.c | 9 | ||||
-rw-r--r-- | src/game/g_local.h | 5 | ||||
-rw-r--r-- | src/game/g_weapon.c | 22 |
3 files changed, 31 insertions, 5 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index a7cd08c0..6a149f90 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1602,6 +1602,15 @@ void ClientThink_real( gentity_t *ent ) } break; + case WP_ALEVEL4: + // If not currently in a trample, reset the trample bookkeeping data + if( !( client->ps.pm_flags & PMF_CHARGE ) && client->trampleBuildablesHitPos ) + { + ent->client->trampleBuildablesHitPos = 0; + memset( ent->client->trampleBuildablesHit, 0, sizeof( ent->client->trampleBuildablesHit ) ); + } + break; + case WP_HBUILD: CheckCkitRepair( ent ); break; diff --git a/src/game/g_local.h b/src/game/g_local.h index a420d39e..9132d69e 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -353,6 +353,7 @@ typedef struct unlagged_s { qboolean used; } unlagged_t; +#define MAX_TRAMPLE_BUILDABLES_TRACKED 20 // this structure is cleared on each ClientSpawn(), // except for 'client->pers' and 'client->sess' struct gclient_s @@ -434,11 +435,13 @@ struct gclient_s unlagged_t unlaggedBackup; unlagged_t unlaggedCalc; int unlaggedTime; - + float voiceEnthusiasm; char lastVoiceCmd[ MAX_VOICE_CMD_LEN ]; int lcannonStartTime; + int trampleBuildablesHitPos; + int trampleBuildablesHit[ MAX_TRAMPLE_BUILDABLES_TRACKED ]; int lastCrushTime; // Tyrant crush }; 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; } /* |