Add the clock to scoreboard and change clockdisplay

Commit shows time in format mm:ss in scoreboard, instead of
"X minutes remaining" info.
It also enables the clock default on the HUD and adds "clockcount"
variable which let to choose between counting forward or backward
in the clocks.

DOCREF clockdisplay clockcount
This commit is contained in:
aurhat
2014-12-06 17:53:29 +01:00
parent 990f6e9c8b
commit 8e6fbd9d7b
3 changed files with 16 additions and 8 deletions
+1 -1
View File
@@ -992,7 +992,7 @@ void timeupdate(int milliscur, int millismax)
hudoutf("1 minute left!");
if(identexists("onLastMin")) execute("onLastMin");
}
else if(clockdisplay==0) conoutf(_("time remaining: %d minutes"), minutesremaining);
else if(!clockdisplay) conoutf(_("time remaining: %d minutes"), minutesremaining);
else clientlogf(_("time remaining: %d minutes"), minutesremaining);
}
}
+6 -5
View File
@@ -800,10 +800,12 @@ string enginestateinfo = "";
void CSgetEngineState() { result(enginestateinfo); }
COMMANDN(getEngineState, CSgetEngineState, "");
VARP(clockdisplay,0,0,2);
VARP(clockdisplay,0,1,1);
VARP(clockcount,0,0,1);
VARP(dbgpos,0,0,1);
VARP(showtargetname,0,1,1);
VARP(showspeed, 0, 0, 1);
string gtime;
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater)
{
@@ -970,13 +972,12 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
if(unsavededits) draw_text("U", VIRTW*2 - text_width("U") - FONTH, VIRTH*2 - 5*FONTH/2);
}
}
if(!intermission && clockdisplay!=0 && lastgametimeupdate!=0)
if(!intermission && lastgametimeupdate!=0)
{
string gtime;
int cssec = (gametimecurrent+(lastmillis-lastgametimeupdate))/1000;
int gtsec = cssec%60;
int gtmin = cssec/60;
if(clockdisplay==1)
if(!clockcount)
{
int gtmax = gametimemaximum/60000;
gtmin = gtmax - gtmin;
@@ -987,7 +988,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
}
}
formatstring(gtime)("%02d:%02d", gtmin, gtsec);
draw_text(gtime, (VIRTW-225-10)*2 - (text_width(gtime)/2 + FONTH/2), 20);
if(clockdisplay) draw_text(gtime, (VIRTW-225-10)*2 - (text_width(gtime)/2 + FONTH/2), 20);
}
if(hidevote < 2 && multiplayer(false))
+9 -2
View File
@@ -355,7 +355,9 @@ void renderscores(void *menu, bool init)
formatstring(modeline)("\"%s\" on map %s", modestr(gamemode, modeacronyms > 0), fldrprefix ? getclientmap()+strlen("maps/") : getclientmap());
}
extern int minutesremaining;
extern int minutesremaining, clockcount;
extern string gtime;
if((gamemode>1 || (gamemode==0 && (multiplayer(false) || watchingdemo))) && minutesremaining >= 0)
{
if(!minutesremaining)
@@ -380,7 +382,12 @@ void renderscores(void *menu, bool init)
else concatformatstring(modeline, ", \f1%s wins!", scores[0]->name);
}
}
else concatformatstring(modeline, ", %d %s remaining", minutesremaining, minutesremaining==1 ? "minute" : "minutes");
else
{
concatformatstring(modeline, ", %s", gtime);
if(!clockcount) concatformatstring(modeline, " remaining");
else concatformatstring(modeline, " / %d:00", gametimemaximum/60000);
}
}
if(multiplayer(false))