summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-04-03 00:57:30 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-04-03 00:57:30 +0200
commitfe532a0393166815f0cee89e46c917ad22ccb542 (patch)
tree98ce0eeb0499d110f82e868ab19f26b1a893c31c /src
parent5678a7bb3498f20123523f008df947a39eb44ccc (diff)
Fix damage blobs appearing in wrong places or not appearing at all.
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_draw.c13
-rw-r--r--src/cgame/cg_servercmds.c2
-rw-r--r--src/game/g_combat.c87
3 files changed, 54 insertions, 48 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 30e6001..7ca427f 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -3937,26 +3937,23 @@ static void CG_DrawDamageBlobs( void )
Com_sprintf( str, sizeof( str ), "%d", blob->value );
-
-#define Vector3Set( v, x, y, z ) ((v)[0]=(x),(v)[1]=(y),(v)[2]=(z))
-
if( blob->flags & DAMAGE_BLOB_FRIENDLY )
- Vector3Set( color, 1, 0, 0 );
+ VectorSet( color, 1, 0, 0 );
else
{
if( blob->flags & DAMAGE_BLOB_BUILDABLE )
{
if( blob->flags & DAMAGE_BLOB_SPLASH )
- Vector3Set( color, 1, 0.5, 0 );
+ VectorSet( color, 1, 0.5, 0 );
else
- Vector3Set( color, 0.7, 0.7, 0.7 );
+ VectorSet( color, 0.7, 0.7, 0.7 );
}
else
{
if( blob->flags & DAMAGE_BLOB_SPLASH )
- Vector3Set( color, 1, 1, 0 );
+ VectorSet( color, 1, 1, 0 );
else
- Vector3Set( color, 1, 1, 1 );
+ VectorSet( color, 1, 1, 1 );
}
}
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 891c3e0..d8a9323 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -1350,8 +1350,6 @@ static void CG_DamageBlob_f( void )
flags = atoi( CG_Argv( i + 4 ) );
CG_SpawnDamageBlob( origin, value, flags );
-
- i += 5;
}
}
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 )
{