]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_screen.c
fixed chase_active (TraceLine no longer returns '0 0 0' when there was no impact)
[xonotic/darkplaces.git] / gl_screen.c
index bc1197d6845fb1ed20d3da0d075823a347e354b2..43923c65ebd5e8a5338601505cfdb3506bf3816a 100644 (file)
@@ -88,7 +88,6 @@ 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         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;
 cvar_t         showfps = {"showfps", "0", true};
 
 extern cvar_t  crosshair;
@@ -108,8 +107,6 @@ extern int                     sb_lines;
 
 extern viddef_t        vid;                            // global video state
 
 
 extern viddef_t        vid;                            // global video state
 
-vrect_t                scr_vrect;
-
 qboolean       scr_disabled_for_loading;
 qboolean       scr_drawloading;
 float          scr_disabled_time;
 qboolean       scr_disabled_for_loading;
 qboolean       scr_drawloading;
 float          scr_disabled_time;
@@ -340,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);
 
        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;
 }
 
 
 }
 
 
@@ -390,7 +385,6 @@ void SCR_Init (void)
        Cvar_RegisterVariable (&scr_showpause);
        Cvar_RegisterVariable (&scr_centertime);
        Cvar_RegisterVariable (&scr_printspeed);
        Cvar_RegisterVariable (&scr_showpause);
        Cvar_RegisterVariable (&scr_centertime);
        Cvar_RegisterVariable (&scr_printspeed);
-       Cvar_RegisterVariable (&gl_triplebuffer);
        Cvar_RegisterVariable (&showfps);
 
 //
        Cvar_RegisterVariable (&showfps);
 
 //
@@ -422,7 +416,7 @@ void SCR_DrawRam (void)
        if (!r_cache_thrash)
                return;
 
        if (!r_cache_thrash)
                return;
 
-       Draw_Pic (scr_vrect.x+32, scr_vrect.y, scr_ram);
+       Draw_Pic (32, 0, scr_ram);
 }
 
 /*
 }
 
 /*
@@ -447,7 +441,7 @@ void SCR_DrawTurtle (void)
        if (count < 3)
                return;
 
        if (count < 3)
                return;
 
-       Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
+       Draw_Pic (0, 0, scr_turtle);
 }
 
 /*
 }
 
 /*
@@ -462,7 +456,7 @@ void SCR_DrawNet (void)
        if (cls.demoplayback)
                return;
 
        if (cls.demoplayback)
                return;
 
-       Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net);
+       Draw_Pic (64, 0, scr_net);
 }
 
 /*
 }
 
 /*
@@ -547,18 +541,6 @@ void SCR_SetUpToDrawConsole (void)
                if (scr_conlines < scr_con_current)
                        scr_con_current = scr_conlines;
        }
                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;
-       */
 }
        
 /*
 }
        
 /*
@@ -814,11 +796,11 @@ void GL_BrightenScreen()
        glDisable(GL_TEXTURE_2D);
        glEnable(GL_BLEND);
        f = brightness.value = bound(1.0f, brightness.value, 5.0f);
        glDisable(GL_TEXTURE_2D);
        glEnable(GL_BLEND);
        f = brightness.value = bound(1.0f, brightness.value, 5.0f);
-       if (f > 1)
+       if (f >= 1.01f)
        {
                glBlendFunc (GL_DST_COLOR, GL_ONE);
                glBegin (GL_TRIANGLES);
        {
                glBlendFunc (GL_DST_COLOR, GL_ONE);
                glBegin (GL_TRIANGLES);
-               while (f > 1)
+               while (f >= 1.01f)
                {
                        if (f >= 2)
                                glColor3f (1, 1, 1);
                {
                        if (f >= 2)
                                glColor3f (1, 1, 1);
@@ -833,7 +815,7 @@ void GL_BrightenScreen()
        }
        glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        contrast.value = bound(0.2, contrast.value, 1.0);
        }
        glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        contrast.value = bound(0.2, contrast.value, 1.0);
-       if (contrast.value < 1.0f)
+       if (contrast.value < 0.99f)
        {
                glBegin (GL_TRIANGLES);
                glColor4f (1, 1, 1, 1-contrast.value);
        {
                glBegin (GL_TRIANGLES);
                glColor4f (1, 1, 1, 1-contrast.value);
@@ -856,32 +838,22 @@ SCR_UpdateScreen
 This is called every frame, and can also be called explicitly to flush
 text to the screen.
 
 This is called every frame, and can also be called explicitly to flush
 text to the screen.
 
-WARNING: be very careful calling this from elsewhere, because the refresh
-needs almost the entire 256k of stack space!
+LordHavoc: due to my rewrite of R_WorldNode, it no longer takes 256k of stack space :)
 ==================
 */
 extern cvar_t gl_vertexarrays;
 extern qboolean gl_arrays;
 void GL_Finish();
 ==================
 */
 extern cvar_t gl_vertexarrays;
 extern qboolean gl_arrays;
 void GL_Finish();
-int c_nodes;
 void SCR_UpdateScreen (void)
 {
 void SCR_UpdateScreen (void)
 {
-       static float    oldscr_viewsize;
-       double  time1, time2;
+       double  time1 = 0, time2;
 
        if (r_speeds.value)
 
        if (r_speeds.value)
-       {
                time1 = Sys_FloatTime ();
                time1 = Sys_FloatTime ();
-               c_brush_polys = 0;
-               c_alias_polys = 0;
-               c_nodes = 0;
-       }
 
        if (!gl_arrays)
                gl_vertexarrays.value = 0;
 
 
        if (!gl_arrays)
                gl_vertexarrays.value = 0;
 
-       vid.numpages = 2 + gl_triplebuffer.value;
-
        scr_copytop = 0;
        scr_copyeverything = 0;
 
        scr_copytop = 0;
        scr_copyeverything = 0;
 
@@ -920,7 +892,7 @@ void SCR_UpdateScreen (void)
        if (vid.recalc_refdef)
                SCR_CalcRefdef ();
 
        if (vid.recalc_refdef)
                SCR_CalcRefdef ();
 
-       glClearColor(0,0,0,0);
+       glClearColor(1,0,0,0);
        glClear (GL_COLOR_BUFFER_BIT); // LordHavoc: clear the screen (around the view as well)
 
 //
        glClear (GL_COLOR_BUFFER_BIT); // LordHavoc: clear the screen (around the view as well)
 
 //
@@ -956,7 +928,7 @@ void SCR_UpdateScreen (void)
        else
        {
                if (crosshair.value)
        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 ();
                
                SCR_DrawRam ();
                SCR_DrawNet ();
@@ -991,7 +963,7 @@ void SCR_UpdateScreen (void)
        if (r_speeds.value)
        {
                time2 = Sys_FloatTime ();
        if (r_speeds.value)
        {
                time2 = Sys_FloatTime ();
-               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); 
+               Con_Printf ("%3i ms  %4i wpoly %4i epoly %4i transpoly %4i lightpoly %4i BSPnodes %4i BSPleafs\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys, currenttranspoly, c_light_polys, c_nodes, c_leafs);
        }
        GL_EndRendering ();
 }
        }
        GL_EndRendering ();
 }