]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
ripped out vertex array function lookup, require OpenGL 1.2.x instead.
[xonotic/darkplaces.git] / host_cmd.c
index d2411048a8f5e11d0e68b64bb2eefe9783bd6bcc..44701986a659c7a5fd94e23d82dcf8e345c5ea07 100644 (file)
@@ -26,6 +26,8 @@ int   current_skill;
 
 void Mod_Print (void);
 
+dfunction_t *ED_FindFunction (char *name);
+
 /*
 ==================
 Host_Quit_f
@@ -793,7 +795,7 @@ void Host_Tell_f(void)
        client_t *save;
        int             j;
        char    *p;
-       char    text[64];
+       char    text[1024]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
 
        if (cmd_source == src_command)
        {
@@ -848,6 +850,8 @@ void Host_Color_f(void)
 {
        int             top, bottom;
        int             playercolor;
+       dfunction_t *f;
+       func_t  SV_ChangeTeam;
        
        if (Cmd_Argc() == 1)
        {
@@ -883,13 +887,25 @@ void Host_Color_f(void)
                return;
        }
 
-       host_client->colors = playercolor;
-       host_client->edict->v.team = bottom + 1;
+       // void(float color) SV_ChangeTeam;
+       if ((f = ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - pr_functions)))
+       {
+               Con_DPrintf("Calling SV_ChangeTeam\n");
+               pr_global_struct->time = sv.time;
+               pr_globals[0] = playercolor;
+               pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
+               PR_ExecuteProgram (SV_ChangeTeam);
+       }
+       else
+       {
+               host_client->colors = playercolor;
+               host_client->edict->v.team = bottom + 1;
 
-// send notification to all clients
-       MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
-       MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
-       MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
+               // send notification to all clients
+               MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
+               MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
+               MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
+       }
 }
 
 /*
@@ -979,8 +995,6 @@ void Host_PreSpawn_f (void)
        host_client->sendsignon = true;
 }
 
-dfunction_t *ED_FindFunction (char *name);
-
 /*
 ==================
 Host_Spawn_f
@@ -1006,6 +1020,10 @@ void Host_Spawn_f (void)
                return;
        }
 
+       // LordHavoc: moved this above the QC calls at FrikaC's request
+// send all current names, colors, and frag counts
+       SZ_Clear (&host_client->message);
+
 // run the entrance script
        if (sv.loadgame)
        {       // loaded games are fully inited allready
@@ -1052,9 +1070,6 @@ void Host_Spawn_f (void)
        }
 
 
-// send all current names, colors, and frag counts
-       SZ_Clear (&host_client->message);
-
 // send time of update
        MSG_WriteByte (&host_client->message, svc_time);
        MSG_WriteFloat (&host_client->message, sv.time);
@@ -1454,15 +1469,15 @@ void Host_Viewframe_f (void)
 
 void PrintFrameName (model_t *m, int frame)
 {
-       aliashdr_t                      *hdr;
-       maliasframedesc_t       *pframedesc;
+       maliashdr_t     *mheader;
+       maliasframe_t   *frameinfo;
 
-       hdr = (aliashdr_t *)Mod_Extradata (m);
-       if (!hdr)
+       mheader = (maliashdr_t *)Mod_Extradata (m);
+       if (!mheader)
                return;
-       pframedesc = &hdr->frames[frame];
+       frameinfo = &((maliasframe_t *)(mheader->framedata + (int) mheader))[frame];
        
-       Con_Printf ("frame %i: %s\n", frame, pframedesc->name);
+       Con_Printf ("frame %i: %s\n", frame, frameinfo->name);
 }
 
 /*