r3925 - in trunk/data/qcsrc: client server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Jul 26 12:30:50 EDT 2008
Author: div0
Date: 2008-07-26 12:30:49 -0400 (Sat, 26 Jul 2008)
New Revision: 3925
Modified:
trunk/data/qcsrc/client/sbar.qc
trunk/data/qcsrc/server/scores.qc
Log:
add team scores display; csqc .team is NOT svqc .team, that sucks! (csqc .team is always svqc .team minus one)
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2008-07-26 16:05:05 UTC (rev 3924)
+++ trunk/data/qcsrc/client/sbar.qc 2008-07-26 16:30:49 UTC (rev 3925)
@@ -237,6 +237,11 @@
float Sbar_CompareTeamScores(entity left, entity right)
{
float vl, vr;
+
+ if(left.team == COLOR_SPECTATOR)
+ return 1;
+ if(right.team == COLOR_SPECTATOR)
+ return 0;
vl = left.teamscores[ts_primary];
vr = right.teamscores[ts_primary];
@@ -257,13 +262,11 @@
void Sbar_UpdateTeamPos(entity Team)
{
- for(other = Team.sort_next; other && Sbar_ComparePlayerScores(Team, other); other = Team.sort_next)
+ for(other = Team.sort_next; other && Sbar_CompareTeamScores(Team, other); other = Team.sort_next)
{
- if(other.team == COLOR_SPECTATOR)
- break;
SORT_SWAP(Team, other);
}
- for(other = Team.sort_prev; other != teams && Sbar_ComparePlayerScores(other, Team); other = Team.sort_prev)
+ for(other = Team.sort_prev; other != teams && Sbar_CompareTeamScores(other, Team); other = Team.sort_prev)
{
SORT_SWAP(other, Team);
}
@@ -700,11 +703,19 @@
rgb = GetTeamRGB(tm.team);
- pos_x = xmin - 4*24;
- // TODO: Print primary and secondary scores!
-
pos_x = xmin;
+ Sbar_DrawXNum(
+ pos - '6.5 0 0' * sbar_fontsize_y,
+ tm.(teamscores[ts_primary]),
+ 4, sbar_fontsize_y * 1.5, rgb, 1, DRAWFLAG_NORMAL);
+
+ if(ts_primary != ts_secondary)
+ Sbar_DrawXNum(
+ pos - '4.5 0 0' * sbar_fontsize_y + '0 1.5 0' * sbar_fontsize_y,
+ tm.(teamscores[ts_secondary]),
+ 4, sbar_fontsize_y * 1, rgb, 1, DRAWFLAG_NORMAL);
+
specs = tm.team_size;
if(specs < 2)
Modified: trunk/data/qcsrc/server/scores.qc
===================================================================
--- trunk/data/qcsrc/server/scores.qc 2008-07-26 16:05:05 UTC (rev 3924)
+++ trunk/data/qcsrc/server/scores.qc 2008-07-26 16:30:49 UTC (rev 3925)
@@ -46,7 +46,7 @@
float i;
WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, self.team - 1);
for(i = 0; i < MAX_TEAMSCORE; ++i)
WriteShort(MSG_ENTITY, self.teamscores[i]);
@@ -63,7 +63,7 @@
ts.Version = 1; // immediately send, so csqc knows about the team
ts.team = t;
Net_LinkEntity(ts);
- teamscorekeepers[t] = ts;
+ teamscorekeepers[t - 1] = ts;
++teamscores_entities_count;
}
@@ -71,7 +71,9 @@
{
entity s;
if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
- s = teamscorekeepers[t];
+ if(t <= 0 || t >= 16)
+ error("Adding score to invalid team!");
+ s = teamscorekeepers[t - 1];
if(!s)
error("Adding score to unknown team!");
if(score)
More information about the nexuiz-commits
mailing list