]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_shadow.c
some const fixes and type fixes found by gcc -combine
[xonotic/darkplaces.git] / r_shadow.c
index eb324479059227440d6cc95f9f1fa0fbeaf2c0c3..0091ada67abbe8c956cf1593c111063d49ab09f4 100644 (file)
@@ -1051,7 +1051,7 @@ void R_Shadow_RenderMode_Begin(void)
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX;
 }
 
-void R_Shadow_RenderMode_ActiveLight(rtlight_t *rtlight)
+void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight)
 {
        rsurface.rtlight = rtlight;
 }
@@ -3417,14 +3417,12 @@ rtexture_t *R_Shadow_Cubemap(const char *basename)
        int i;
        for (i = 0;i < numcubemaps;i++)
                if (!strcasecmp(cubemaps[i].basename, basename))
-                       return cubemaps[i].texture;
+                       return cubemaps[i].texture ? cubemaps[i].texture : r_texture_whitecube;
        if (i >= MAX_CUBEMAPS)
                return r_texture_whitecube;
        numcubemaps++;
        strlcpy(cubemaps[i].basename, basename, sizeof(cubemaps[i].basename));
        cubemaps[i].texture = R_Shadow_LoadCubemap(cubemaps[i].basename);
-       if (!cubemaps[i].texture)
-               cubemaps[i].texture = r_texture_whitecube;
        return cubemaps[i].texture;
 }
 
@@ -3435,7 +3433,8 @@ void R_Shadow_FreeCubemaps(void)
        {
                if (developer_loading.integer)
                        Con_Printf("unloading cubemap \"%s\"\n", cubemaps[i].basename);
-               R_FreeTexture(cubemaps[i].texture);
+               if (cubemaps[i].texture)
+                       R_FreeTexture(cubemaps[i].texture);
        }
 
        numcubemaps = 0;