diff options
author | mtiusane <mtiusane@users.noreply.github.com> | 2015-04-03 19:24:01 +0300 |
---|---|---|
committer | mtiusane <mtiusane@users.noreply.github.com> | 2015-04-03 19:24:01 +0300 |
commit | d22b446abfa0d98d7b69511d6c4bbe555d2cb7bf (patch) | |
tree | 89d08c55bbd6ee8bcb035fa6226c6de9793d572d /src/game/g_combat.c | |
parent | 216fc980dd8221198e491745a0eaa029c37f74d3 (diff) | |
parent | 7f984114f2e19b0579e1d55e3c1a8925a88c35d0 (diff) |
Merge pull request #24 from mtiusane/damage-feedback
Damage feedback
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r-- | src/game/g_combat.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index eb7f48e..1a54981 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1115,7 +1115,6 @@ void G_InitDamageLocations( void ) } } - /* ============ T_Damage @@ -1447,6 +1446,55 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, G_CombatStats_HitMOD( attacker, targ, mod, take ); + + if( attacker && attacker->client && take && attacker != targ ) + { + g_damageBlob_t *blob; + int flags = 0; + + if( attacker->client->bufferedBlobCount == MAX_BUFFERED_BLOBS ) + return; + + if( OnSameTeam( attacker, targ ) || + ( targ->s.eType == ET_BUILDABLE && + attacker->client->pers.teamSelection == targ->buildableTeam ) ) + flags |= DAMAGE_BLOB_FRIENDLY; + + if( targ->s.eType == ET_BUILDABLE ) + flags |= DAMAGE_BLOB_BUILDABLE; + + if( dflags & DAMAGE_RADIUS ) + { + vec3_t mins = {0}, maxs = {0}; + + flags |= DAMAGE_BLOB_SPLASH; + + switch( targ->s.eType ) + { + case ET_BUILDABLE: + BG_BuildableBoundingBox( targ->s.modelindex, mins, maxs ); + break; + + case ET_PLAYER: + BG_ClassBoundingBox( targ->client->ps.stats[ STAT_CLASS ], mins, maxs, NULL, NULL, NULL ); + break; + } + + VectorAdd( mins, maxs, point ); + VectorScale( point, 0.5f, point ); + VectorAdd( point, targ->s.origin, point ); + } + else if( inflictor->s.eType == ET_MISSILE ) + VectorCopy( inflictor->r.currentOrigin, point ); + + blob = attacker->client->blobBuffer + + ( attacker->client->bufferedBlobCount++ ); + + VectorCopy( point, blob->origin ); + blob->value = take; + blob->flags = flags; + } + if( targ->health <= 0 ) { if( client ) |