diff --git a/source/src/protos.h b/source/src/protos.h index 86053d93..f6f2ba11 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -448,6 +448,7 @@ extern void showscores(int on); extern void renderscores(void *menu, bool init); extern const char *asciiscores(bool destjpg = false); extern void consolescores(); +extern void teamflagscores(int &team1, int &team2); // world extern void setupworld(int factor); diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index feb6a22a..bdd628b2 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -44,7 +44,7 @@ void drawctficon(float x, float y, float s, int col, int row, float ts, int alph if(!ctftex) ctftex = textureload("packages/misc/ctficons.png", 3); if(!htftex) htftex = textureload("packages/misc/htficons.png", 3); if(!ktftex) ktftex = textureload("packages/misc/ktficons.png", 3); - turn_on_transparency(alpha); + glColor4ub(255, 255, 255, alpha); if(m_htf) { if(htftex) drawicon(htftex, x, y, s, col, row, ts); @@ -57,7 +57,6 @@ void drawctficon(float x, float y, float s, int col, int row, float ts, int alph { if(ctftex) drawicon(ctftex, x, y, s, col, row, ts); } - glDisable(GL_BLEND); } void drawvoteicon(float x, float y, int col, int row, bool noblend) @@ -514,7 +513,7 @@ void drawradar_vicinity(playerent *p, int w, int h) float d2s = radarheight/2.0f; glColor3f(1.0f, 1.0f, 1.0f); glPushMatrix(); - vec centerpos(VIRTW-halfviewsize-72, halfviewsize+64, 0); + vec centerpos(VIRTW-halfviewsize-72, halfviewsize+64, 0); glTranslatef(centerpos.x, centerpos.y, 0); glRotatef(-camera1->yaw, 0, 0, 1); glTranslatef(-halfviewsize, -halfviewsize, 0); @@ -971,11 +970,17 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glLoadIdentity(); glOrtho(0, VIRTW, VIRTH, 0, -1, 1); glColor4f(1.0f, 1.0f, 1.0f, 0.2f); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); + turn_on_transparency(255); + int flagscores[2]; + teamflagscores(flagscores[0], flagscores[1]); loopi(2) // flag state { drawctficon(i*120+VIRTW/4.0f*3.0f, 1650, 120, i, 0, 1/4.0f, flaginfos[i].state == CTFF_INBASE ? 255 : 100); + defformatstring(count)("%d", flagscores[i]); + int cw, ch; + text_bounds(count, cw, ch); + draw_textf(count, i*120+VIRTW/4.0f*3.0f+60-cw/2, 1590); } // big flag-stolen icon diff --git a/source/src/scoreboard.cpp b/source/src/scoreboard.cpp index 4c571916..f2b7da0f 100644 --- a/source/src/scoreboard.cpp +++ b/source/src/scoreboard.cpp @@ -59,6 +59,18 @@ struct teamscore } }; +void teamflagscores(int &team1, int &team2) +{ + teamscore teamscores[2] = { teamscore(TEAM_CLA), teamscore(TEAM_RVSF) }; + loopv(players) if(players[i] && players[i]->team != TEAM_SPECT) + { + teamscores[team_base(players[i]->team)].addplayer(players[i]); + } + if(!watchingdemo) teamscores[team_base(player1->team)].addplayer(player1); + team1 = teamscores[0].flagscore; + team2 = teamscores[1].flagscore; +} + static int teamscorecmp(const teamscore *x, const teamscore *y) { if(x->flagscore > y->flagscore) return -1; @@ -533,4 +545,4 @@ void winners() result(winners); } -COMMAND(winners, ARG_NONE); \ No newline at end of file +COMMAND(winners, ARG_NONE);