]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_screen.c
minor tweak to the forcing of color 255 to black
[xonotic/darkplaces.git] / gl_screen.c
index a7a03d4fc5813fff1ce416381101c33e1e2c8aba..717a04fde41716e18ee81f39017f205512a1b472 100644 (file)
@@ -88,7 +88,7 @@ cvar_t                scr_showram = {"showram","1"};
 cvar_t         scr_showturtle = {"showturtle","0"};
 cvar_t         scr_showpause = {"showpause","1"};
 cvar_t         scr_printspeed = {"scr_printspeed","8"};
-cvar_t         gl_triplebuffer = {"gl_triplebuffer", "1", true };
+cvar_t         showfps = {"showfps", "0", true};
 
 extern cvar_t  crosshair;
 
@@ -103,11 +103,9 @@ int                        scr_fullupdate;
 int                    clearconsole;
 int                    clearnotify;
 
-int                    sb_lines;
+extern int                     sb_lines;
 
-viddef_t       vid;                            // global video state
-
-vrect_t                scr_vrect;
+extern viddef_t        vid;                            // global video state
 
 qboolean       scr_disabled_for_loading;
 qboolean       scr_drawloading;
@@ -339,8 +337,6 @@ static void SCR_CalcRefdef (void)
 
        r_refdef.fov_x = scr_fov.value;
        r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
-
-       scr_vrect = r_refdef.vrect;
 }
 
 
@@ -389,7 +385,7 @@ void SCR_Init (void)
        Cvar_RegisterVariable (&scr_showpause);
        Cvar_RegisterVariable (&scr_centertime);
        Cvar_RegisterVariable (&scr_printspeed);
-       Cvar_RegisterVariable (&gl_triplebuffer);
+       Cvar_RegisterVariable (&showfps);
 
 //
 // register our commands
@@ -420,7 +416,7 @@ void SCR_DrawRam (void)
        if (!r_cache_thrash)
                return;
 
-       Draw_Pic (scr_vrect.x+32, scr_vrect.y, scr_ram);
+       Draw_Pic (32, 0, scr_ram);
 }
 
 /*
@@ -445,7 +441,7 @@ void SCR_DrawTurtle (void)
        if (count < 3)
                return;
 
-       Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
+       Draw_Pic (0, 0, scr_turtle);
 }
 
 /*
@@ -460,7 +456,7 @@ void SCR_DrawNet (void)
        if (cls.demoplayback)
                return;
 
-       Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net);
+       Draw_Pic (64, 0, scr_net);
 }
 
 /*
@@ -545,18 +541,6 @@ void SCR_SetUpToDrawConsole (void)
                if (scr_conlines < scr_con_current)
                        scr_con_current = scr_conlines;
        }
-
-       /*
-       if (clearconsole++ < vid.numpages)
-       {
-               Sbar_Changed ();
-       }
-       else if (clearnotify++ < vid.numpages)
-       {
-       }
-       else
-               con_notifylines = 0;
-       */
 }
        
 /*
@@ -864,8 +848,7 @@ void GL_Finish();
 int c_nodes;
 void SCR_UpdateScreen (void)
 {
-       static float    oldscr_viewsize;
-       double  time1, time2;
+       double  time1 = 0, time2;
 
        if (r_speeds.value)
        {
@@ -878,8 +861,6 @@ void SCR_UpdateScreen (void)
        if (!gl_arrays)
                gl_vertexarrays.value = 0;
 
-       vid.numpages = 2 + gl_triplebuffer.value;
-
        scr_copytop = 0;
        scr_copyeverything = 0;
 
@@ -954,7 +935,7 @@ void SCR_UpdateScreen (void)
        else
        {
                if (crosshair.value)
-                       Draw_Character (scr_vrect.x + scr_vrect.width/2, scr_vrect.y + scr_vrect.height/2, '+');
+                       Draw_Character (r_refdef.vrect.x + r_refdef.vrect.width/2, r_refdef.vrect.y + r_refdef.vrect.height/2, '+');
                
                SCR_DrawRam ();
                SCR_DrawNet ();
@@ -967,6 +948,19 @@ void SCR_UpdateScreen (void)
                M_Draw ();
        }
 
+       if (showfps.value)
+       {
+               static double currtime;
+               double newtime;
+               char temp[32];
+               int calc;
+               newtime = Sys_FloatTime();
+               calc = (int) (100.0 / (newtime - currtime));
+               sprintf(temp, "% 4i.%02i fps", calc / 100, calc % 100);
+               currtime = newtime;
+               Draw_String(vid.width - (12*8), 0, temp, 9999);
+       }
+
        V_UpdatePalette ();
 
        GL_BrightenScreen();
@@ -976,7 +970,7 @@ void SCR_UpdateScreen (void)
        if (r_speeds.value)
        {
                time2 = Sys_FloatTime ();
-               Con_Printf ("%3i ms  %4i wpoly %4i epoly %4i BSPnodes\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys, c_nodes); 
+               Con_Printf ("%3i ms  %4i wpoly %4i epoly %4i transpoly %4i BSPnodes\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys, currenttranspoly, c_nodes); 
        }
        GL_EndRendering ();
 }