Misty's clock hack. show_clock 1 displays a clock on the screen for those that

need to know the current time while playing.
This commit is contained in:
Bill Currie 2000-12-04 03:46:04 +00:00
parent ae290926c4
commit 37eb211c0a
2 changed files with 27 additions and 0 deletions

View file

@ -182,6 +182,7 @@ byte *host_colormap;
cvar_t *host_speeds; // set for running times
cvar_t *show_fps; // set for running times
cvar_t *show_time;
cvar_t *developer;
int fps_count;
@ -1252,6 +1253,9 @@ void CL_Init_Cvars (void)
show_fps = Cvar_Get("show_fps", "0", CVAR_NONE,
"display realtime frames per second");
// Misty: I like to be able to see the time when I play
show_time = Cvar_Get("show_time", "0", CVAR_NONE,
"display time in 24 hr:min format");
host_speeds = Cvar_Get("host_speeds", "0", CVAR_NONE,
"display host processing times");
developer = Cvar_Get("developer", "0", CVAR_NONE,

View file

@ -472,6 +472,28 @@ void SCR_DrawFPS (void)
Draw_String8 (x, y, st);
}
/* Misty: I like to see the time */
void SCR_DrawTime (void)
{
extern cvar_t *show_time;
int x, y;
char st[80];
char local_time[120];
time_t systime;
if (!show_time->int_val)
return;
/* actually find the time and set systime to it*/
time(&systime);
/* now set local_time to 24 hour time using hours:minutes format */
strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime));
/* now actually print it to the screen directly below where show_fps is */
sprintf(st, "%s", local_time);
x = vid.width - strlen(st) * 8 - 8;
y = vid.height - sb_lines - 0;
Draw_String8 (x, y, st);
}
/*
==============
@ -1071,6 +1093,7 @@ SCR_UpdateScreen (void)
SCR_DrawNet ();
SCR_DrawFPS ();
SCR_DrawTime ();
SCR_DrawTurtle ();
SCR_DrawPause ();
SCR_CheckDrawCenterString ();