]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added setcolor builtin
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Oct 2000 01:34:09 +0000 (01:34 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Oct 2000 01:34:09 +0000 (01:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@71 d7cf8633-e32d-0410-b094-e92efae38249

pr_cmds.c

index 960309ce9900561ecc02fb51a3976d9bbded79da..91e435b5eb930fb47e5f3122ab71ade3da532a79 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1956,6 +1956,38 @@ void PF_copyentity (void)
        memcpy(out, in, pr_edict_size);
 }
 
+/*
+=================
+PF_setcolor
+
+sets the color of a client and broadcasts the update to all connected clients
+
+setcolor(clientent, value)
+=================
+*/
+void PF_setcolor (void)
+{
+       client_t        *client;
+       int                     entnum, i;
+       
+       entnum = G_EDICTNUM(OFS_PARM0);
+       i = G_FLOAT(OFS_PARM1);
+       
+       if (entnum < 1 || entnum > svs.maxclients)
+       {
+               Con_Printf ("tried to setcolor a non-client\n");
+               return;
+       }
+               
+       client = &svs.clients[entnum-1];
+       client->colors = i;
+       client->edict->v.team = (i & 15) + 1;
+               
+       MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
+       MSG_WriteByte (&sv.reliable_datagram, entnum - 1);
+       MSG_WriteByte (&sv.reliable_datagram, i);
+}
+
 void PF_Fixme (void)
 {
        PR_RunError ("unimplemented builtin"); // LordHavoc: was misspelled (bulitin)
@@ -2080,7 +2112,8 @@ PF_checkextension,        // #99
 aa // #200
 aa // #300
 aa // #400
-PF_copyentity          // #400 LordHavoc: builtin range (4xx)
+PF_copyentity,         // #400 LordHavoc: builtin range (4xx)
+PF_setcolor,           // #401
 };
 
 builtin_t *pr_builtins = pr_builtin;