The GL version of the clock rewrite -- also some whitespace

This commit is contained in:
Jeff Teunissen 2000-12-28 07:49:42 +00:00
parent 37304217c1
commit 893a8ba827

View file

@ -491,11 +491,9 @@ SCR_DrawFPS (void)
lastframetime = t; lastframetime = t;
} }
snprintf (st, sizeof (st), "%3d FPS", lastfps); snprintf (st, sizeof (st), "%3d FPS", lastfps);
/*
Misty: New trick! (for me) the ? makes this work like a if then else - // FIXME! This is evil. -- Deek
IE: if cl_hudswap->int_val is not null, do first case, else (else is a // calculate the location of the clock
: here) do second case. Deek taught me this trick
*/
if (show_time->int_val <= 0) { if (show_time->int_val <= 0) {
i = 8; i = 8;
} else if (show_time->int_val == 1) { } else if (show_time->int_val == 1) {
@ -503,36 +501,45 @@ SCR_DrawFPS (void)
} else { } else {
i = 80; i = 80;
} }
x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + i) : i; x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + i) : i;
y = vid.height - sb_lines - 8; y = vid.height - sb_lines - 8;
Draw_String8 (x, y, st); Draw_String8 (x, y, st);
} }
/* Misty: I like to see the time */
/*
SCR_DrawTime
Draw a clock on the screen
Written by Misty, rewritten by Deek.
*/
void void
SCR_DrawTime (void) SCR_DrawTime (void)
{ {
int x, y; int x, y;
char st[80]; char st[80];
char local_time[120];
time_t systime; time_t utc = 0;
struct tm *local = NULL;
char *timefmt = NULL;
// any cvar that can take multiple settings must be able to handle abuse. // any cvar that can take multiple settings must be able to handle abuse.
if (show_time->int_val <= 0) if (show_time->int_val <= 0)
return; return;
/* actually find the time and set systime to it */ // Get local time
time (&systime); utc = time (NULL);
local = localtime (&utc);
if (show_time->int_val == 1) { // International format if (show_time->int_val == 1) { // Use international format
strftime (local_time, sizeof (local_time), "%H:%M", localtime (&systime)); timefmt = "%k:%M";
} else if (show_time->int_val >= 2) { // AM/PM display } else if (show_time->int_val >= 2) { // US AM/PM display
strftime (local_time, sizeof (local_time), "%I:%M %P", localtime (&systime)); timefmt = "%l:%M %P";
} }
strftime (st, sizeof (st), timefmt, local);
// Print it next to the fps meter // Print it at far left/right of screen
snprintf (st, sizeof (st), "%s", local_time);
x = cl_hudswap->int_val ? (vid.width - ((strlen (st) * 8) + 8)) : 8; x = cl_hudswap->int_val ? (vid.width - ((strlen (st) * 8) + 8)) : 8;
y = vid.height - (sb_lines + 8); y = vid.height - (sb_lines + 8);
Draw_String8 (x, y, st); Draw_String8 (x, y, st);
@ -898,12 +905,13 @@ SCR_TileClear (void)
} }
} }
int oldviewsize = 0; extern void R_ForceLightUpdate (void);
extern void R_ForceLightUpdate ();
qboolean lighthalf;
unsigned char lighthalf_v[3];
extern cvar_t *gl_lightmode, *brightness;
int oldviewsize = 0;
unsigned char lighthalf_v[3];
qboolean lighthalf;
extern cvar_t *gl_lightmode;
extern cvar_t *brightness;
/* /*
SCR_UpdateScreen SCR_UpdateScreen