]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_sky.c
cleaned up almost all direct indexing of matrix4x4_t structures to go through proper...
[xonotic/darkplaces.git] / r_sky.c
diff --git a/r_sky.c b/r_sky.c
index 487ebb5ccec6b128ddcd4a757f08726409a890b4..bf2c009ebdaf6f3715a82c462c9a6826bbcbaec5 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -142,7 +142,7 @@ int R_SetSkyBox(const char *sky)
                return false;
        }
 
-       strcpy(skyname, sky);
+       strlcpy(skyname, sky, sizeof(skyname));
 
        return R_LoadSkyBox();
 }
@@ -268,7 +268,8 @@ int skyboxelements[6*2*3] =
 static void R_SkyBox(void)
 {
        int i;
-       GL_Color(1, 1, 1, 1);
+       // FIXME: fixed function path can't properly handle r_view.colorscale > 1
+       GL_Color(1 * r_view.colorscale, 1 * r_view.colorscale, 1 * r_view.colorscale, 1);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(false);
        GL_DepthTest(false); // don't modify or read zbuffer
@@ -365,7 +366,8 @@ static void R_SkySphere(void)
        speedscale -= (int)speedscale;
        Matrix4x4_CreateTranslate(&scroll2matrix, speedscale, speedscale, 0);
 
-       GL_Color(1, 1, 1, 1);
+       // FIXME: fixed function path can't properly handle r_view.colorscale > 1
+       GL_Color(1 * r_view.colorscale, 1 * r_view.colorscale, 1 * r_view.colorscale, 1);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
        GL_DepthTest(false); // don't modify or read zbuffer
@@ -375,7 +377,7 @@ static void R_SkySphere(void)
        R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.solidskytexture));
        R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f);
        R_Mesh_TexMatrix(0, &scroll1matrix);
-       if (r_textureunits.integer >= 2)
+       if (r_textureunits.integer >= 2 && r_view.colorscale == 1)
        {
                // one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
                R_Mesh_TexBind(1, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));