]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host_cmd.c
lighthalf related transpoly cleanup
[xonotic/darkplaces.git] / host_cmd.c
index 5f0ab5fb2a0d428bab9eb7fc6593faae3b76a0e7..c08e92125405bcbb31a682cc5b70a47858a8d28f 100644 (file)
@@ -26,6 +26,8 @@ int   current_skill;
 
 void Mod_Print (void);
 
+dfunction_t *ED_FindFunction (char *name);
+
 /*
 ==================
 Host_Quit_f
@@ -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