diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-04-03 00:57:30 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-04-03 00:57:30 +0200 |
commit | fe532a0393166815f0cee89e46c917ad22ccb542 (patch) | |
tree | 98ce0eeb0499d110f82e868ab19f26b1a893c31c /src/game | |
parent | 5678a7bb3498f20123523f008df947a39eb44ccc (diff) |
Fix damage blobs appearing in wrong places or not appearing at all.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_combat.c | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 9758dc0..099b5e9 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -1115,43 +1115,6 @@ void G_InitDamageLocations( void ) } } - -/* -============ -G_SpawnDamageBlob -============ -*/ - -void G_SpawnDamageBlob( - gentity_t *ent, gentity_t *target, int mod, - int damage, vec3_t point, qboolean indirect ) -{ - g_damageBlob_t *blob; - int flags = 0; - - if( !ent || !ent->client || !target || ent == target ) - return; - - if( ent->client->bufferedBlobCount == MAX_BUFFERED_BLOBS ) - return; - - if( OnSameTeam( ent, target ) || - ( target->s.eType == ET_BUILDABLE && - ent->client->pers.teamSelection == target->buildableTeam ) ) - flags |= DAMAGE_BLOB_FRIENDLY; - - if( target->s.eType == ET_BUILDABLE ) - flags |= DAMAGE_BLOB_BUILDABLE; - - if( indirect ) - flags |= DAMAGE_BLOB_SPLASH; - - blob = ent->client->blobBuffer + (ent->client->bufferedBlobCount++); - VectorCopy( point, blob->origin ); - blob->value = damage; - blob->flags = flags; -} - /* ============ T_Damage @@ -1482,7 +1445,55 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } G_CombatStats_HitMOD( attacker, targ, mod, take ); - G_SpawnDamageBlob( attacker, targ, mod, take, point, ( dflags & DAMAGE_RADIUS ) ); + + + 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 = damage; + blob->flags = flags; + } if( targ->health <= 0 ) { |