mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-16 16:41:30 +00:00
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:
parent
ae290926c4
commit
37eb211c0a
2 changed files with 27 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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 ();
|
||||
|
|
Loading…
Reference in a new issue