From 5678a7bb3498f20123523f008df947a39eb44ccc Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 3 Apr 2015 00:33:39 +0200 Subject: Implement damage blobs. --- src/game/g_active.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/game/g_active.c') diff --git a/src/game/g_active.c b/src/game/g_active.c index 6021a65..90c47c4 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -2236,6 +2236,45 @@ void ClientThink( int clientNum ) void G_RunClient( gentity_t *ent ) { + 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; + } + // Run a client think when there are no commands for a time if( !g_synchronousClients.integer && ( g_friendlyFreeze.integer < 100 || -- cgit From 0d5460522ba3651da1ed5630f7f8a784c5eb6514 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 3 Apr 2015 03:50:41 +0200 Subject: Initial implementation of health bars. --- src/game/g_active.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/game/g_active.c') diff --git a/src/game/g_active.c b/src/game/g_active.c index 90c47c4..2eede6b 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -2236,6 +2236,7 @@ void ClientThink( int clientNum ) void G_RunClient( gentity_t *ent ) { + // send all buffered damage blobs if( ent->client->bufferedBlobCount ) { int i; @@ -2275,6 +2276,9 @@ void G_RunClient( gentity_t *ent ) 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 || -- cgit