summaryrefslogtreecommitdiff
path: root/src/game/g_active.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-04-04 16:20:17 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-04-04 16:20:17 +0200
commit8c6ad4c73c816dbe412e6fac0ad1c0d2837492cc (patch)
tree007c383de5770f9b9649571142e34a7c95b9675b /src/game/g_active.c
parent752d1bbed1f59eb45b3c89cbddc1430d817b1102 (diff)
Let spectators see damage blobs of the spectated player.
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r--src/game/g_active.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 2eede6b..7148af0 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -2213,6 +2213,39 @@ void ClientThink_real( gentity_t *ent )
/*
==================
+G_SendPublicServerCommand
+
+Send a server command to a player and everyone following them.
+==================
+*/
+void G_SendPublicServerCommand( int clientNum, const char *cmd )
+{
+ int i;
+ gclient_t *client;
+
+ for( i = 0; i < level.maxclients ; i++ )
+ {
+ client = level.clients + i;
+
+ if( client->pers.connected != CON_CONNECTED )
+ continue;
+
+ if( client->ps.clientNum == clientNum )
+ goto send;
+
+ if( client->sess.spectatorState == SPECTATOR_NOT )
+ continue;
+
+ if( client->sess.spectatorClient != clientNum )
+ continue;
+
+ send:
+ trap_SendServerCommand( client->ps.clientNum, cmd );
+ }
+}
+
+/*
+==================
ClientThink
A new command has arrived from the client
@@ -2261,7 +2294,7 @@ void G_RunClient( gentity_t *ent )
if( p - buffer + len + 1 > sizeof( buffer ) )
{
- trap_SendServerCommand( ent - g_entities, buffer );
+ G_SendPublicServerCommand( ent - g_entities, buffer );
strcpy( buffer, "dblob" );
p = buffer + 5;
}
@@ -2271,7 +2304,7 @@ void G_RunClient( gentity_t *ent )
}
if( p > buffer + 6 )
- trap_SendServerCommand( ent - g_entities, buffer );
+ G_SendPublicServerCommand( ent - g_entities, buffer );
ent->client->bufferedBlobCount = 0;
}