]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
fixed a crash with lights that have no clusters (a light outside the level) by alloca...
[xonotic/darkplaces.git] / gl_backend.c
index 915abadef8822257f5db2748903196b4a34d76ad..8ceda052da2cb5a2b1c4d4f30e55d85d698dec34 100644 (file)
@@ -75,8 +75,6 @@ void GL_PrintError(int errornumber, char *filename, int linenumber)
 
 #define BACKENDACTIVECHECK if (!backendactive) Sys_Error("GL backend function called when backend is not active\n");
 
-int c_meshs, c_meshelements;
-
 void SCR_ScreenShot_f (void);
 
 static matrix4x4_t backend_viewmatrix;
@@ -1209,6 +1207,17 @@ qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *b
        qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer1);
        CHECKGLERROR
 
+       if (scr_screenshot_gamma.value != 1)
+       {
+               int i;
+               double igamma = 1.0 / scr_screenshot_gamma.value;
+               unsigned char ramp[256];
+               for (i = 0;i < 256;i++)
+                       ramp[i] = (unsigned char) (pow(i * (1.0 / 255.0), igamma) * 255.0);
+               for (i = 0;i < width*height*3;i++)
+                       buffer1[i] = ramp[buffer1[i]];
+       }
+
        Image_CopyMux (buffer2, buffer1, width, height, flipx, flipy, flipdiagonal, 3, 3, indices);
 
        if (jpeg)
@@ -1283,7 +1292,7 @@ void SCR_DrawScreen (void)
                        r_showtrispass = 1;
                }
 
-               if (scr_conlines < vid.conheight && cls.signon == SIGNONS)
+               if (cls.signon == SIGNONS)
                {
                        float size;
 
@@ -1419,56 +1428,6 @@ void SCR_UpdateScreen (void)
        if (gl_combine.integer && (!gl_combine_extension || r_textureunits.integer < 2))
                Cvar_SetValueQuick(&gl_combine, 0);
 
-       // don't allow cheats in multiplayer
-       if (!cl.islocalgame && cl.worldmodel)
-       {
-               if (r_fullbright.integer != 0)
-                       Cvar_Set ("r_fullbright", "0");
-               if (r_ambient.value != 0)
-                       Cvar_Set ("r_ambient", "0");
-       }
-
-       // bound viewsize
-       if (scr_viewsize.value < 30)
-               Cvar_Set ("viewsize","30");
-       if (scr_viewsize.value > 120)
-               Cvar_Set ("viewsize","120");
-
-       // bound field of view
-       if (scr_fov.value < 1)
-               Cvar_Set ("fov","1");
-       if (scr_fov.value > 170)
-               Cvar_Set ("fov","170");
-
-       // intermission is always full screen
-       if (cl.intermission)
-               sb_lines = 0;
-       else
-       {
-               if (scr_viewsize.value >= 120)
-                       sb_lines = 0;           // no status bar at all
-               else if (scr_viewsize.value >= 110)
-                       sb_lines = 24;          // no inventory
-               else
-                       sb_lines = 24+16+8;
-       }
-
-       r_refdef.fovscale_x = 1;
-       r_refdef.fovscale_y = 1;
-       if (r_waterwarp.value > 0 && cl.worldmodel)
-       {
-               Mod_CheckLoaded(cl.worldmodel);
-               if (CL_PointSuperContents(r_vieworigin) & SUPERCONTENTS_LIQUIDSMASK)
-               {
-                       r_refdef.fovscale_x = 1 - (((sin(cl.time * 4.7) + 1) * 0.015) * r_waterwarp.value);
-                       r_refdef.fovscale_y = 1 - (((sin(cl.time * 3.0) + 1) * 0.015) * r_waterwarp.value);
-               }
-       }
-
-       r_refdef.colormask[0] = 1;
-       r_refdef.colormask[1] = 1;
-       r_refdef.colormask[2] = 1;
-
        CHECKGLERROR
        qglViewport(0, 0, vid.realwidth, vid.realheight);
        qglDisable(GL_SCISSOR_TEST);