minor cleanup

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@616 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2012-01-20 17:11:24 +00:00
parent 0912ffd8a6
commit abb004f5d4
2 changed files with 19 additions and 17 deletions

View file

@ -414,37 +414,39 @@ SCR_DrawFPS -- johnfitz
*/ */
void SCR_DrawFPS (void) void SCR_DrawFPS (void)
{ {
static double oldtime = 0, fps = 0; static double oldtime = 0;
static int oldframecount = 0; static double lastfps = 0;
double time; static int oldframecount = 0;
char str[12]; double elapsed_time;
int x, y, frames; int frames;
time = realtime - oldtime; elapsed_time = realtime - oldtime;
frames = r_framecount - oldframecount; frames = r_framecount - oldframecount;
if (time < 0 || frames < 0) if (elapsed_time < 0 || frames < 0)
{ {
oldtime = realtime; oldtime = realtime;
oldframecount = r_framecount; oldframecount = r_framecount;
return; return;
} }
// update value every 3/4 second
if (time > 0.75) //update value every 3/4 second if (elapsed_time > 0.75)
{ {
fps = frames / time; lastfps = frames / elapsed_time;
oldtime = realtime; oldtime = realtime;
oldframecount = r_framecount; oldframecount = r_framecount;
} }
if (scr_showfps.value) //draw it if (scr_showfps.value)
{ {
sprintf (str, "%4.0f fps", fps); char st[16];
x = 320 - (strlen(str)<<3); int x, y;
sprintf (st, "%4.0f fps", lastfps);
x = 320 - (strlen(st)<<3);
y = 200 - 8; y = 200 - 8;
if (scr_clock.value) y -= 8; //make room for clock if (scr_clock.value) y -= 8; //make room for clock
GL_SetCanvas (CANVAS_BOTTOMRIGHT); GL_SetCanvas (CANVAS_BOTTOMRIGHT);
Draw_String (x, y, str); Draw_String (x, y, st);
scr_tileclear_updates = 0; scr_tileclear_updates = 0;
} }
@ -968,7 +970,7 @@ void SCR_UpdateScreen (void)
if (block_drawing) if (block_drawing)
return; return;
vid.numpages = 2 + (gl_triplebuffer.value ? 1 : 0); //johnfitz -- in case gl_triplebuffer is not 0 or 1 vid.numpages = (gl_triplebuffer.value) ? 3 : 2;
if (scr_disabled_for_loading) if (scr_disabled_for_loading)
{ {

View file

@ -692,11 +692,11 @@ static void GL_CheckExtensions (void)
//get max value either way, so the menu and stuff know it //get max value either way, so the menu and stuff know it
glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy); glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy);
if (gl_max_anisotropy < 1) if (gl_max_anisotropy < 2)
{ {
gl_anisotropy_able = false; gl_anisotropy_able = false;
gl_max_anisotropy = 1; gl_max_anisotropy = 1;
Con_Warning ("anisotropic filtering broken\n"); Con_Warning ("anisotropic filtering broken: disabled\n");
} }
} }
else else