diff options
author | Mikko Tiusanen <ams@daug.net> | 2015-04-03 19:24:09 +0300 |
---|---|---|
committer | Mikko Tiusanen <ams@daug.net> | 2015-04-03 19:24:09 +0300 |
commit | de1bb3421d464023570b96082809d79ca3ca6264 (patch) | |
tree | 0211e822a755475262ecf8a2a1dc39468ee95384 /src/game | |
parent | 7af0f802b62a34b9a613328dcd7fe157999b77b2 (diff) | |
parent | d22b446abfa0d98d7b69511d6c4bbe555d2cb7bf (diff) |
Merge branch 'master' of github.com:mtiusane/new-edge
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_public.h | 4 | ||||
-rw-r--r-- | src/game/g_active.c | 43 | ||||
-rw-r--r-- | src/game/g_combat.c | 50 | ||||
-rw-r--r-- | src/game/g_local.h | 11 | ||||
-rw-r--r-- | src/game/g_weapon.c | 2 |
5 files changed, 108 insertions, 2 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index f96fd66..fa93839 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1244,3 +1244,7 @@ typedef struct } dummyCmd_t; int cmdcmp( const void *a, const void *b ); +// damage blob flags +#define DAMAGE_BLOB_FRIENDLY 1 +#define DAMAGE_BLOB_BUILDABLE 2 +#define DAMAGE_BLOB_SPLASH 4 diff --git a/src/game/g_active.c b/src/game/g_active.c index 6021a65..2eede6b 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -2236,6 +2236,49 @@ void ClientThink( int clientNum ) void G_RunClient( gentity_t *ent ) { + // send all buffered damage blobs + if( ent->client->bufferedBlobCount ) + { + int i; + g_damageBlob_t *blob; + char *p, buffer[ 1024 ]; + + strcpy( buffer, "dblob" ); + p = buffer + 5; + + for( i = 0; i < ent->client->bufferedBlobCount; i++ ) + { + char smallbuf[ 64 ]; + int len; + + blob = ent->client->blobBuffer + i; + + Com_sprintf( smallbuf, sizeof( smallbuf ), " %.0f %.0f %.0f %d %d", + blob->origin[ 0 ], blob->origin[ 1 ], blob->origin[ 2 ], + blob->value, blob->flags ); + + len = strlen( smallbuf ); + + if( p - buffer + len + 1 > sizeof( buffer ) ) + { + trap_SendServerCommand( ent - g_entities, buffer ); + strcpy( buffer, "dblob" ); + p = buffer + 5; + } + + strcpy( p, smallbuf ); + p += len; + } + + if( p > buffer + 6 ) + trap_SendServerCommand( ent - g_entities, buffer ); + + ent->client->bufferedBlobCount = 0; + } + + // update the public health field + ent->s.otherEntityNum2 = MAX( 0, ent->client->ps.stats[ STAT_HEALTH ] ); + // Run a client think when there are no commands for a time if( !g_synchronousClients.integer && ( g_friendlyFreeze.integer < 100 || 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 ) diff --git a/src/game/g_local.h b/src/game/g_local.h index 30a61b0..cbf98bd 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -403,6 +403,14 @@ typedef struct unlagged_s { qboolean used; } unlagged_t; +#define MAX_BUFFERED_BLOBS 20 +typedef struct +{ + vec3_t origin; + int value; + int flags; +} g_damageBlob_t; + #define MAX_TRAMPLE_BUILDABLES_TRACKED 20 // this structure is cleared on each ClientSpawn(), // except for 'client->pers' and 'client->sess' @@ -511,6 +519,9 @@ struct gclient_s int notrackEndTime; // Time when the current no track period ends int blobs; + + g_damageBlob_t blobBuffer[ MAX_BUFFERED_BLOBS ]; + int bufferedBlobCount; }; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 0b5599a..d1f7694 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -1473,7 +1473,7 @@ static void G_CreateNewZap( gentity_t *creator, gentity_t *target ) { if( !zap->targets[ i ]->client || zap->targets[ i ]->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS ) - G_Damage( zap->targets[ i ], target, zap->creator, forward, target->s.origin, + G_Damage( zap->targets[ i ], target, zap->creator, forward, zap->targets[ i ]->s.origin, LEVEL2_AREAZAP_DMG * ( 1 - pow( (zap->distances[ i ] / LEVEL2_AREAZAP_CHAIN_RANGE ), LEVEL2_AREAZAP_CHAIN_FALLOFF ) ) + 1, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_LOCDAMAGE, |