]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/miscfunctions.qc
Merge branch 'samual/weapons' into Mario/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / miscfunctions.qc
index cdd55f8a4c5d7c6d9a719c07210f45f9b49fa9b6..fbdbc45f3a3c25a0c5f4f650c7cba9cfe2349b53 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();
 }
 
@@ -111,7 +116,7 @@ entity GetTeam(float Team, float add)
        num = (Team == NUM_SPECTATOR) ? 16 : Team;
        if(teamslots[num])
                return teamslots[num];
-       if not(add)
+       if (!add)
                return world;
        tm = spawn();
        tm.team = Team;
@@ -385,7 +390,7 @@ float PolyDrawModelSurface(entity e, float i_s)
        vector tri;
        string tex;
        tex = getsurfacetexture(e, i_s);
-       if not(tex)
+       if (!tex)
                return 0; // this is beyond the last one
        n_t = getsurfacenumtriangles(e, i_s);
        for(i_t = 0; i_t < n_t; ++i_t)
@@ -573,14 +578,25 @@ vector getplayerorigin(float pl)
        return GETPLAYERORIGIN_ERROR;
 }
 
+float getplayeralpha(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl + 1);
+       if(e)
+               return e.alpha;
+
+       return 1;
+}
+
 float getplayerisdead(float pl)
 {
        entity e;
-       
+
        e = CSQCModel_server2csqc(pl + 1);
        if(e)
                return e.csqcmodel_isdead;
-       
+
        return FALSE;
 }
 
@@ -601,7 +617,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);
        }
 }