They consume way less vertical space so you could stack them on top of each other if you want space for the map. Additionally, they are more visual. Now if you run into a wall you get a square turning from green to read instead of just some line with an attached number moving which should reduce brain lag
Is there a way to predict exactly how tall a font will be? There is some weird code for the title, I just copied this for the value, but it's far from exact.
I think the best would be to re- add the old gauges and make them configurable via something like RUBBER_GAUGE_TYPE.
Code: Select all
--- src/tron/gHud.cpp.old 2006-02-03 15:43:41.000000000 -0600
+++ src/tron/gHud.cpp 2006-02-03 17:46:38.000000000 -0600
@@ -62,7 +62,7 @@
#ifndef DEDICATED
-void GLmeter_subby(float value,float max, float locx, float locy, float size, const char * t,bool displayvalue = true, bool reverse = false, REAL r=.5, REAL g=.5, REAL b=1)
+void GLmeter_subby(float value,float max, float locx, float locy, float size, const char * t,bool displayvalue = true, bool reverse = false, REAL r=.5, REAL g=.5, REAL b=1, bool highbetter = false)
{
tString title( t );
@@ -72,9 +72,8 @@
char string[50];
value>max?value=max:1;
value<0?value=0:1;
- x= (reverse?-1:1) * cos(M_PI*value/max);
- y= sin(M_PI*value/max);
- if(y<size*.24) displayvalue = false; // dont display text when at minimum
+ int factor=(reverse?-1:1);
+ x= factor * (value/max*2. - 1.);
/* Draws an ugly background on the gauge
BeginQuads();
@@ -92,10 +91,30 @@
RenderEnd();*/
+ //render the box
+ BeginQuads();
+ Color(r,g, b,0.3);
+ Vertex(-size+locx, size*0.3+locy,0);
+ Vertex(-size+locx,locy,0);
+ Vertex( size+locx,locy,0);
+ Vertex( size+locx, size*0.3+locy,0);
+ RenderEnd();
+ //fill
+ BeginQuads();
+ if(highbetter)
+ Color((x>0?1.-x:1.),(x<0.?x+1.:1.),0.,.5);
+ else
+ Color((x<0.?x+1.:1.),(x>0?1.-x:1.),0.,.5);
+ Vertex(-size+locx, size*0.3+locy,0);
+ Vertex(-size+locx, locy,0);
+ Vertex(size*x+locx,locy,0);
+ Vertex(size*x+locx,size*0.3+locy,0);
+ RenderEnd();
+ //render the line
BeginLines();
Color(r,g, b);
- Vertex(-.1*x*size+locx,.1*y*size+locy,0);
- Vertex(-x*size+locx,y*size+locy,0);
+ Vertex(size*x+locx,locy,0);
+ Vertex(size*x+locx, size*0.3+locy,0);
RenderEnd();
@@ -105,8 +124,8 @@
max_t << "0xcccccc" << (reverse?0:max);
if(displayvalue){
- rTextField speed_t(-x*1.45*size+locx,y*1.35*size+locy,.1*size,.2*size);
- sprintf(string,"%.1f",value);
+ int length = sprintf(string,"%.1f",value);
+ rTextField speed_t(locx-((.15*size*(length-1.5))/2.0),locy+size*.28,.12*size,.24*size);
speed_t << "0xccffff" << (string);
}
int length = title.Len();
@@ -125,7 +144,7 @@
}
-static int alivepeople, thetopscore, hudfpscount;
+static int alivepeople, alivemates, thetopscore, hudfpscount;
static void tank_display_hud( ePlayerNetID* me ){
static int fps = 60;
@@ -166,11 +185,16 @@
//Calculation, enemies (people not on me's team) alive
if (dohudcrap) {
alivepeople=0;
+ alivemates=0;
if (me){
for(unsigned short int i=0;i<max;i++){
ePlayerNetID *p=se_PlayerNetIDs(i);
- if (p->Object() && p->Object()->Alive() && (p->CurrentTeam() != me->CurrentTeam())){
- alivepeople++;
+ if (p->Object() && p->Object()->Alive()){
+ if (p->CurrentTeam() != me->CurrentTeam()){
+ alivepeople++;
+ }else{
+ alivemates++;
+ }
}
}
}
@@ -327,12 +351,12 @@
GLmeter_subby(h->Speed(),maxmeterspeed,subby_SpeedGaugeLocX,subby_SpeedGaugeLocY,subby_SpeedGaugeSize,"Speed"); // easy to use configurable meters
if(subby_ShowRubberMeter)
{
- GLmeter_subby(h->GetRubber(),sg_rubberCycle,subby_RubberGaugeLocX,subby_RubberGaugeLocY,subby_RubberGaugeSize," Rubber Used");
+ GLmeter_subby(h->GetRubber(),sg_rubberCycle,subby_RubberGaugeLocX,subby_RubberGaugeLocY,subby_RubberGaugeSize," Rubber", true, true, .5, .5, 1., true);
if ( gCycle::RubberMalusActive() )
GLmeter_subby(100/(1+h->GetRubberMalus()),100,subby_RubberGaugeLocX,subby_RubberGaugeLocY,subby_RubberGaugeSize,"",true, false, 1,.5,.5);
}
if(subby_ShowBrakeMeter)
- GLmeter_subby(h->GetBrakingReservoir(), 1.0,subby_BrakeGaugeLocX,subby_BrakeGaugeLocY,subby_BrakeGaugeSize, " Brakes");
+ GLmeter_subby(h->GetBrakingReservoir(), 1.0,subby_BrakeGaugeLocX,subby_BrakeGaugeLocY,subby_BrakeGaugeSize, " Brakes", true, false, .5, .5, 1., true);
// bool displayfastest = true;// put into global, set via menusytem... subby to do.make sr_DISPLAYFASTESTout
@@ -376,7 +400,7 @@
if(subby_ShowAliveEnemies){
tString message;
- message << "Enemies Alive: " << alivepeople ;
+ message << "Players Alive: " << alivepeople << "/" << alivemates;
int length = message.Len();
float size = subby_AliveEnemiesSize;
rTextField enemies_alive(subby_AliveEnemiesLocX-((.15*size*(length-1.5))/2.0),subby_AliveEnemiesLocY,.15*size,.3*size);