X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmiscfunctions.qc;h=8b674e7826c2ccd6529e46a703d55ee00a21a2ae;hb=e6eb6e7fc36a3a243c5171b8cc3db88e823514d4;hp=cdd55f8a4c5d7c6d9a719c07210f45f9b49fa9b6;hpb=82cd62c58f76985bf88024ed088ede76674f253c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index cdd55f8a4..8b674e782 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -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,39 @@ 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; +} + +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; - + e = CSQCModel_server2csqc(pl + 1); if(e) return e.csqcmodel_isdead; - + return FALSE; } @@ -601,7 +631,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); } }