]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
colormod values above 1 1 1 should work properly with r_glsl now
[xonotic/darkplaces.git] / cl_screen.c
index bf23f29fd6e54d6df3d5b658a1dc085c324d594b..7eb8bf880c9eb27fb2f8edb07a01c2b8a192e5ff 100644 (file)
@@ -65,7 +65,7 @@ static void SCR_ScreenShot_f (void);
 static void R_Envmap_f (void);
 
 // backend
-void R_ClearScreen(void);
+void R_ClearScreen(qboolean fogcolor);
 
 /*
 ===============================================================================
@@ -141,7 +141,7 @@ void SCR_DrawCenterString (void)
                // scan the number of characters on the line, not counting color codes
                char *newline = strchr(start, '\n');
                int l = newline ? (newline - start) : (int)strlen(start);
-               float width = DrawQ_TextWidth_Font(start, l, 8, 8, false, FONT_CENTERPRINT);
+               float width = DrawQ_TextWidth_Font(start, l, false, FONT_CENTERPRINT) * 8;
 
                x = (vid_conwidth.integer - width)/2;
                if (l > 0)
@@ -463,7 +463,7 @@ static int SCR_DrawQWDownload(int offset)
        else
                dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i/%i) at %i bytes/s\n", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadmemorymaxsize, cls.qw_downloadspeedrate);
        len = (int)strlen(temp);
-       x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, 0, FONT_INFOBAR)) / 2;
+       x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, 0, FONT_INFOBAR) * size) / 2;
        y = vid_conheight.integer - size - offset;
        DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
        DrawQ_String_Font(x, y, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
@@ -496,7 +496,7 @@ static int SCR_DrawCurlDownload(int offset)
        if(addinfo)
        {
                len = (int)strlen(addinfo);
-               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, size, size, false, FONT_INFOBAR)) / 2;
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, false, FONT_INFOBAR) * size) / 2;
                DrawQ_Fill(0, y - size, vid_conwidth.integer, size, 1, 1, 1, cls.signon == SIGNONS ? 0.8 : 1, 0);
                DrawQ_String_Font(x, y - size, addinfo, len, size, size, 0, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
        }
@@ -510,7 +510,7 @@ static int SCR_DrawCurlDownload(int offset)
                else
                        dpsnprintf(temp, sizeof(temp), "Downloading %s ...  %5.1f%% @ %.1f KiB/s\n", downinfo[i].filename, 100.0 * downinfo[i].progress, downinfo[i].speed / 1024.0);
                len = (int)strlen(temp);
-               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, false, FONT_INFOBAR)) / 2;
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, false, FONT_INFOBAR) * size) / 2;
                DrawQ_Fill(0, y + i * size, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
                DrawQ_String_Font(x, y + i * size, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
        }
@@ -1731,7 +1731,7 @@ static void R_Envmap_f (void)
        {
                sprintf(filename, "env/%s%s.tga", basename, envmapinfo[j].name);
                Matrix4x4_CreateFromQuakeEntity(&r_view.matrix, r_view.origin[0], r_view.origin[1], r_view.origin[2], envmapinfo[j].angles[0], envmapinfo[j].angles[1], envmapinfo[j].angles[2], 1);
-               R_ClearScreen();
+               r_view.clear = true;
                R_Mesh_Start();
                R_RenderView();
                R_Mesh_Finish();
@@ -1852,12 +1852,14 @@ qboolean SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *b
 
 //=============================================================================
 
-void R_ClearScreen(void)
+extern void R_UpdateFogColor(void);
+void R_ClearScreen(qboolean fogcolor)
 {
        // clear to black
        CHECKGLERROR
-       if (r_refdef.fogenabled)
+       if (fogcolor)
        {
+               R_UpdateFogColor();
                qglClearColor(r_refdef.fogcolor[0],r_refdef.fogcolor[1],r_refdef.fogcolor[2],0);CHECKGLERROR
        }
        else
@@ -2155,7 +2157,7 @@ void CL_UpdateScreen(void)
        qglDepthMask(1);CHECKGLERROR
        qglColorMask(1,1,1,1);CHECKGLERROR
        qglClearColor(0,0,0,0);CHECKGLERROR
-       R_ClearScreen();
+       R_ClearScreen(false);
        r_view.clear = false;
 
        if(scr_stipple.integer)