Misty's hudswap/fps/time patch to put the fps/time on the opposite side of the

screen to the hud.
This commit is contained in:
Bill Currie 2000-12-05 04:21:47 +00:00
parent 19a1e03f5d
commit 481fe0b9ed
2 changed files with 33 additions and 26 deletions

View file

@ -465,11 +465,15 @@ void SCR_DrawFPS (void)
fps_count = 0; fps_count = 0;
lastframetime = t; lastframetime = t;
} }
/* Misty: I really do need to read about sprintf a bit. This thing keeps chewing on my foot! */
sprintf(st, "%3d FPS", lastfps); sprintf(st, "%-3d FPS", lastfps);
x = vid.width - strlen(st) * 8 - 8; /* Misty: New trick! (for me) the ? makes this work like a if then else - IE: if
cl_hudswap->int_val is not null, do first case, else (else is a : here) do second case.
Deek taught me this trick */
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);
} }
/* Misty: I like to see the time */ /* Misty: I like to see the time */
@ -490,7 +494,7 @@ void SCR_DrawTime (void)
strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime)); strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime));
/* now actually print it to the screen directly below where show_fps is */ /* now actually print it to the screen directly below where show_fps is */
sprintf(st, "%s", local_time); sprintf(st, "%s", local_time);
x = vid.width - strlen(st) * 8 - 8; x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + 8) : 8;
y = vid.height - sb_lines - 16; y = vid.height - sb_lines - 16;
Draw_String8 (x, y, st); Draw_String8 (x, y, st);
} }

View file

@ -504,35 +504,38 @@ void SCR_DrawFPS (void)
fps_count = 0; fps_count = 0;
lastframetime = t; lastframetime = t;
} }
/* Misty: I really do need to read about sprintf a bit. This thing keeps chewing on my foot! */
sprintf(st, "%3d FPS", lastfps); sprintf(st, "%-3d FPS", lastfps);
x = vid.width - strlen(st) * 8 - 8; /* Misty: New trick! (for me) the ? makes this work like a if then else - IE: if
cl_hudswap->int_val is not null, do first case, else (else is a : here) do second case.
Deek taught me this trick */
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);
} }
/* Misty: I like to see the time */ /* Misty: I like to see the time */
void SCR_DrawTime (void) void SCR_DrawTime (void)
{ {
extern cvar_t *show_time; extern cvar_t *show_time;
int x, y; int x, y;
char st[80]; char st[80];
char local_time[120]; char local_time[120];
time_t systime; time_t systime;
if (!show_time->int_val) if (!show_time->int_val)
return; return;
/* actually find the time and set systime to it*/ /* actually find the time and set systime to it*/
time(&systime); time(&systime);
/* now set local_time to 24 hour time using hours:minutes format */ /* now set local_time to 24 hour time using hours:minutes format */
strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime)); strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime));
/* now actually print it to the screen directly below where show_fps is /* now actually print it to the screen directly below where show_fps is */
*/ sprintf(st, "%s", local_time);
sprintf(st, "%s", local_time); x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + 8) : 8;
x = vid.width - strlen(st) * 8 - 8; y = vid.height - sb_lines - 16;
y = vid.height - sb_lines - 16; Draw_String8 (x, y, st);
Draw_String8 (x, y, st);
} }
/* /*