show flag count on HUD (WIP)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6748 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
sireus
2012-01-30 12:54:18 +00:00
parent 5d43fb36bd
commit 4a6b67de1f
3 changed files with 23 additions and 5 deletions
+1
View File
@@ -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);
+9 -4
View File
@@ -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
+13 -1
View File
@@ -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);
COMMAND(winners, ARG_NONE);