pophudmatrix();
}
+ VARP(speedometer, 0, 1, 1);
+ FVARP(speedometerx, 0.0, 0.5, 1.0);
+ FVARP(speedometery, 0.0, 0.6, 1.0);
+ FVARP(speedometerscale, 0.1, 0.5, 2.0);
+ VARP(speedometercolor, 0, 1, 1);
+ FVARP(speedometeralpha, 0.0, 0.5, 1.0);
+
+ //~void drawspeedometer(fpsent *d, int w, int h) {
+ //~int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + 1.0f);
+ //~speedforreal = (speedforreal == 1) ? 0 : speedforreal;
+ //~vec colour = vec(255, 255, 255);
+ //~float realw = 0;
+ //~float realh = 0;
+ //~if (speedometercolor) {
+ //~if (speedforreal==0) colour = vec(60, 60, 60);
+ //~else if (speedforreal>0 && speedforreal<=60) colour = vec(240, 30, 30);
+ //~else if (speedforreal>60 && speedforreal<=120) colour = vec(180, 90, 60);
+ //~else if (speedforreal>120 && speedforreal<=180) colour = vec(180, 180, 30);
+ //~else if (speedforreal>180 && speedforreal<=240) colour = vec(90, 180, 60);
+ //~else colour = vec(30, 240, 30);
+ //~}
+
+ //~defformatstring(speedstring, "%d", speedforreal);
+ //~text_boundsf(speedstring, realw, realh);
+ //~vec2 offset = vec2(speedometerx, speedometery).mul(vec2(w, h).div(speedometerscale));
+ //~offset.x -= realw/2.0f;
+ //~offset.y -= realh/2.0f;
+
+ //~pushhudmatrix();
+ //~hudmatrix.scale(speedometerscale, speedometerscale, 1);
+ //~flushhudmatrix();
+
+ //~draw_text(speedstring, int(offset.x), int(offset.y), colour.x, colour.y, colour.z, speedometeralpha);
+
+ //~pophudmatrix();
+ //~}
+
VARP(healthcolors, 0, 1, 1);
void drawhudicons(fpsent *d)
{
- int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + /*speedmodifier*/ + 1.0f);
-
pushhudmatrix();
hudmatrix.scale(2, 2, 1);
flushhudmatrix();
-
defformatstring(health, "%d", d->state==CS_DEAD ? 0 : d->health);
bvec healthcolor = bvec::hexcolor(healthcolors && !m_insta ? (d->state==CS_DEAD ? 0x808080 : (d->health<=25 ? 0xFF0000 : (d->health<=50 ? 0xFF8000 : (d->health<=100 ? 0xFFFFFF : 0x40C0FF)))) : 0xFFFFFF);
draw_text(health, (HICON_X + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, healthcolor.r, healthcolor.g, healthcolor.b);
{
if(d->armour) draw_textf("%d", (HICON_X + HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->armour);
draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->ammo[d->gunselect]);
- //~draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2+800, HICON_TEXTY/2, (int) (100.0f+speedmodifier));
- draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2+400, HICON_TEXTY/2, speedforreal);
}
-
pophudmatrix();
if(d->state != CS_DEAD && d->maxhealth > 100)
if(ammobar) drawammobar(w, h, d);
}
+
if(!m_edit)
{
- if(gameclock) drawgameclock(w, h);
- if(hudscore) drawhudscore(w, h);
+ if(gameclock) drawgameclock(w, h);
+ if(hudscore) drawhudscore(w, h);
+ //~if(speedometer) drawspeedometer(d, w, h);
+ }
+
+ /// Speedometer.
+
+ int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + 1.0f);
+ speedforreal = (speedforreal == 1) ? 0 : speedforreal;
+ vec colour = vec(255, 255, 255);
+ float realw = 0;
+ float realh = 0;
+ if (speedometercolor) {
+ if (speedforreal==0) colour = vec(60, 60, 60);
+ else if (speedforreal>0 && speedforreal<=60) colour = vec(240, 30, 30);
+ else if (speedforreal>60 && speedforreal<=120) colour = vec(180, 90, 60);
+ else if (speedforreal>120 && speedforreal<=180) colour = vec(180, 180, 30);
+ else if (speedforreal>180 && speedforreal<=240) colour = vec(90, 180, 60);
+ else colour = vec(30, 240, 30);
}
+ defformatstring(speedstring, "%d", speedforreal);
+ text_boundsf(speedstring, realw, realh);
+ vec2 offset = vec2(speedometerx, speedometery).mul(vec2(w, h).div(speedometerscale));
+ offset.x -= realw/2.0f;
+ offset.y -= realh/2.0f;
+
+ pushhudmatrix();
+ hudmatrix.scale(speedometerscale, speedometerscale, 1);
+ flushhudmatrix();
+
+ draw_text(speedstring, int(offset.x), int(offset.y), colour.x, colour.y, colour.z, (int)(speedometeralpha*255.0f));
+
+ pophudmatrix();
+
/// Frag message.
- if(hudfragmillis+fragmessageduration > lastmillis)
+ if((hudfragmillis+fragmessageduration > lastmillis) && (lastmillis>fragmessageduration))
{
vec2 center = vec2(0.5*w, 0.2*h);
float width = 0, height = 0;