Paste Description for sauerbratenscorehud2
sauerbraten score hud patch
- sauerbratenscorehud2
- Monday, January 29th, 2007 at 1:44:31pm MST
- --- fps.cpp 20 Nov 2006 16:54:02 -0000 1.113
- +++ fps.cpp 29 Jan 2007 20:43:44 -0000
- @@ -492,22 +492,103 @@
- void drawicon(float tx, float ty, int x, int y)
- {
- + float w = 8.0f;
- + int sx = 120, sy = 120;
- +
- settexture("data/items.png");
- +
- + if (tx >= 384)
- + {
- + glEnable(GL_BLEND);
- + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- + glColor4f(1.0,1.0,1.0,0.5);
- + w/=2.0;
- + sx*=1.6;
- + }
- +
- glBegin(GL_QUADS);
- - tx /= 384;
- + tx /= 512;
- ty /= 128;
- - int s = 120;
- - glTexCoord2f(tx, ty); glVertex2i(x, y);
- - glTexCoord2f(tx+1/6.0f, ty); glVertex2i(x+s, y);
- - glTexCoord2f(tx+1/6.0f, ty+1/2.0f); glVertex2i(x+s, y+s);
- - glTexCoord2f(tx, ty+1/2.0f); glVertex2i(x, y+s);
- + glTexCoord2f(tx, ty); glVertex2i(x, y);
- + glTexCoord2f(tx+1/w, ty); glVertex2i(x+sx, y);
- + glTexCoord2f(tx+1/w, ty+1/2.0f); glVertex2i(x+sx, y+sy);
- + glTexCoord2f(tx, ty+1/2.0f); glVertex2i(x, y+sy);
- glEnd();
- +
- + glDisable(GL_BLEND);
- };
- void gameplayhud(int w, int h)
- {
- + short hs = -32768;
- + short x = w*1800/h;
- +
- + if(!m_teammode)
- + {
- + loopv(players) if(players[i])
- + if ((players[i] != player1) && (players[i]->frags > hs))
- + hs = players[i]->frags;
- + }
- + else
- + {
- + if(m_capture)
- + {
- + loopv(cpc.scores) if(cpc.scores[i].total)
- + if ((!isteam(cpc.scores[i].team, player1->team)) && (cpc.scores[i].total > hs))
- + hs = cpc.scores[i].total;
- + }
- + else
- + {
- + loopi(numdynents())
- + {
- + int score = 0;
- + fpsent *o = (fpsent *)iterdynents(i);
- +
- + if(o && o->type!=ENT_AI && o->frags && (!isteam(o->team, player1->team)))
- + {
- + score = o->frags;
- +
- + loopi(numdynents())
- + {
- + fpsent *oa = (fpsent *)iterdynents(i);
- +
- + if(oa && oa->type!=ENT_AI && oa->frags && (oa != o) && (isteam(o->team, oa->team)))
- + score += oa->frags;
- + }
- +
- + if (score > hs)
- + hs = score;
- + };
- + }
- + };
- + }
- +
- glLoadIdentity();
- + glOrtho(0, x, 1800, 0, -1, 1);
- +
- + glColor3f(1.0,1.0,1.0);
- +
- + if (hs > -32768)
- + {
- + drawicon(384, hs > player1->frags ? 64 : 0, x-418, 1650);
- + drawicon(384, hs > player1->frags ? 0 : 64, x-225, 1650);
- + }
- +
- + drawicon(192, 0, 20, 1650);
- + if(player1->state!=CS_DEAD)
- + {
- + if(player1->armour) drawicon((float)(player1->armourtype*64), 0, 620, 1650);
- + int g = player1->gunselect;
- + int r = 64;
- + if(g==GUN_PISTOL) { g = 4; r = 0; };
- + drawicon((float)(g*64), (float)r, 1220, 1650);
- + };
- + if(m_capture) cpc.capturehud(w, h);
- +
- + glLoadIdentity();
- glOrtho(0, w*900/h, 900, 0, -1, 1);
- + glEnable(GL_BLEND);
- +
- if(player1->state==CS_SPECTATOR)
- {
- draw_text("SPECTATOR", 10, 827);
- @@ -520,21 +601,43 @@
- draw_textf("%d", 690, 822, player1->ammo[player1->gunselect]);
- };
- - glLoadIdentity();
- - glOrtho(0, w*1800/h, 1800, 0, -1, 1);
- -
- - glDisable(GL_BLEND);
- -
- - drawicon(192, 0, 20, 1650);
- - if(player1->state!=CS_DEAD)
- - {
- - if(player1->armour) drawicon((float)(player1->armourtype*64), 0, 620, 1650);
- - int g = player1->gunselect;
- - int r = 64;
- - if(g==GUN_PISTOL) { g = 4; r = 0; };
- - drawicon((float)(g*64), (float)r, 1220, 1650);
- - };
- - if(m_capture) cpc.capturehud(w, h);
- + if (hs > -32768)
- + {
- + string frags;
- + int pf = m_teammode ? 0 : player1->frags;
- +
- + if (m_teammode)
- + {
- + if(m_capture)
- + pf = cpc.findscore(player1->team).total;
- + else
- + {
- + loopi(numdynents())
- + {
- + fpsent *o = (fpsent *)iterdynents(i);
- +
- + if(o && o->type!=ENT_AI && o->frags && (isteam(o->team, player1->team)))
- + {
- + pf = o->frags;
- +
- + loopi(numdynents())
- + {
- + fpsent *oa = (fpsent *)iterdynents(i);
- +
- + if(oa && oa->type!=ENT_AI && oa->frags && (oa != o) && (isteam(o->team, oa->team)))
- + pf += oa->frags;
- + }
- + };
- + }
- +
- + }
- + }
- +
- + s_sprintf(frags)("%d", pf);
- + draw_text(frags, (hs > pf ? (x-42)/2 : (x-234)/2) - text_width(frags), 822);
- + s_sprintf(frags)("%d", hs);
- + draw_text(frags, (hs > pf ? (x-234)/2 : (x-42)/2) - text_width(frags), 822);
- + }
- };
- void newmap(int size)
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.