]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/miscfunctions.qc
Merge branch 'master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / miscfunctions.qc
index 2c2fc56df0983219934ebbdd062dda2ca767fc6e..1abf39e4fdc493d228faac919d18efdeeda0e602 100644 (file)
@@ -1,5 +1,6 @@
 entity players;
 entity teams;
+var float team_count; // real teams
 
 void AuditLists()
 {
@@ -81,6 +82,8 @@ float RegisterTeam(entity Team)
        if(teams.sort_next)
                teams.sort_next.sort_prev = Team;
        teams.sort_next = Team;
+       if(Team.team && Team.team != NUM_SPECTATOR)
+               ++team_count;
        AuditLists();
        return true;
 }
@@ -101,6 +104,8 @@ void RemoveTeam(entity Team)
        parent.sort_next = Team.sort_next;
        if(Team.sort_next)
                Team.sort_next.sort_prev = parent;
+       if(Team.team && Team.team != NUM_SPECTATOR)
+               --team_count;
        AuditLists();
 }
 
@@ -573,6 +578,45 @@ vector getplayerorigin(float pl)
        return GETPLAYERORIGIN_ERROR;
 }
 
+vector getcsqcplayercolor(float pl)
+{
+       entity e;
+       
+       e = CSQCModel_server2csqc(pl);
+       if(e)
+       {
+               if(e.colormap > 0)
+                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE);
+       }
+       
+       return '1 1 1';
+}
+
+float getplayeralpha(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl + 1);
+       if(e)
+               return e.alpha;
+
+       return 1;
+}
+
+vector getcsqcplayercolor(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl);
+       if(e)
+       {
+               if(e.colormap > 0)
+                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE);
+       }
+
+       return '1 1 1';
+}
+
 float getplayerisdead(float pl)
 {
        entity e;
@@ -601,7 +645,7 @@ void URI_Get_Callback(float id, float status, string data)
        }
        else
        {
-               print(sprintf("Received HTTP request data for an invalid id %d.\n", id));
+               printf("Received HTTP request data for an invalid id %d.\n", id);
        }
 }