]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_cmds.c
rewrite of map texture loading (mainly to do with HL textures and wads)
[xonotic/darkplaces.git] / pr_cmds.c
index 73d15ef68d06435817f3d781311af73ad455a4a8..e9c3effd649dd5fe565ad19e91860221c1ac6803 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -80,6 +80,7 @@ QSG_SCALE \
 QSG_SKYBOX \
 QSG_TRACETOSS \
 QSG_VIEWMODEL \
+QSG_COPYENT \
 ";
 
 qboolean checkextension(char *name)
@@ -91,12 +92,14 @@ qboolean checkextension(char *name)
        {
                while (*e == ' ')
                        e++;
-               if (!*e || (e[len] == ' ' && !strncasecmp(e, name, len)))
-                       return TRUE;
+               if (!*e)
+                       break;
+               if (!strncasecmp(e, name, len))
+                       return true;
                while (*e && *e != ' ')
                        e++;
        }
-       return FALSE;
+       return false;
 }
 
 /*
@@ -613,7 +616,7 @@ void PF_ambientsound (void)
 
        MSG_WriteByte (&sv.signon,svc_spawnstaticsound);
        for (i=0 ; i<3 ; i++)
-               MSG_WriteCoord(&sv.signon, pos[i]);
+               MSG_WriteFloatCoord(&sv.signon, pos[i]);
 
        MSG_WriteByte (&sv.signon, soundnum);
 
@@ -1671,7 +1674,7 @@ void PF_WriteAngle (void)
 
 void PF_WriteCoord (void)
 {
-       MSG_WriteCoord (WriteDest(), G_FLOAT(OFS_PARM1));
+       MSG_WriteFloatCoord (WriteDest(), G_FLOAT(OFS_PARM1));
 }
 
 void PF_WriteString (void)
@@ -1705,7 +1708,7 @@ void PF_makestatic (void)
        MSG_WriteByte (&sv.signon, ent->v.skin);
        for (i=0 ; i<3 ; i++)
        {
-               MSG_WriteCoord(&sv.signon, ent->v.origin[i]);
+               MSG_WriteFloatCoord(&sv.signon, ent->v.origin[i]);
                MSG_WriteAngle(&sv.signon, ent->v.angles[i]);
        }
 
@@ -1936,6 +1939,55 @@ void PF_pow (void)
        G_FLOAT(OFS_RETURN) = pow(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
 }
 
+/*
+=================
+PF_copyentity
+
+copies data from one entity to another
+
+copyentity(src, dst)
+=================
+*/
+void PF_copyentity (void)
+{
+       edict_t *in, *out;
+       in = G_EDICT(OFS_PARM0);
+       out = G_EDICT(OFS_PARM1);
+       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)
@@ -2054,7 +2106,14 @@ PF_max,                          // #95
 PF_bound,                      // #96
 PF_pow,                                // #97
 PF_FindFloat,          // #98
-PF_checkextension      // #99
+PF_checkextension,     // #99
+#define a PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme, PF_Fixme,
+#define aa a a a a a a a a a a
+aa // #200
+aa // #300
+aa // #400
+PF_copyentity,         // #400 LordHavoc: builtin range (4xx)
+PF_setcolor,           // #401
 };
 
 builtin_t *pr_builtins = pr_builtin;