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_active.c | |
parent | 216fc980dd8221198e491745a0eaa029c37f74d3 (diff) | |
parent | 7f984114f2e19b0579e1d55e3c1a8925a88c35d0 (diff) |
Merge pull request #24 from mtiusane/damage-feedback
Damage feedback
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r-- | src/game/g_active.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 || |