]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Merge PR 'Compare Q1BSP sky textures properly when loading'
authorJames O'Neill <hemebond@gmail.com>
Sun, 21 Apr 2024 15:07:23 +0000 (00:07 +0900)
committerGitHub <noreply@github.com>
Sun, 21 Apr 2024 15:07:23 +0000 (01:07 +1000)
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/58 by loading sky textures with CRC checking, previously they
were always considered duplicates by `R_SkinFrame_LoadInternalBGRA`
because they reuse the same names.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/105

See https://github.com/DarkPlacesEngine/darkplaces/pull/153

---------

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
model_brush.c

index 3357d0dfe6968920bd025a6d2afc7f1e7c76f380..83645cf378d7d047127867ff040f65bace29908b 100644 (file)
@@ -1625,8 +1625,21 @@ static void Mod_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, i
                }
        }
 
-       loadmodel->brush.solidskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_solidtexture", 0         , (unsigned char *) solidpixels, w, h, 0, 0, 0, vid.sRGB3D);
-       loadmodel->brush.alphaskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_alphatexture", TEXF_ALPHA, (unsigned char *) alphapixels, w, h, 0, 0, 0, vid.sRGB3D);
+       // Load the solid and alpha parts of the sky texture as separate textures
+       loadmodel->brush.solidskyskinframe = R_SkinFrame_LoadInternalBGRA(
+               "sky_solidtexture",
+               0,
+               (unsigned char *) solidpixels,
+               w, h, w, h,
+               CRC_Block((unsigned char *) solidpixels, w*h*4),
+               vid.sRGB3D);
+       loadmodel->brush.alphaskyskinframe = R_SkinFrame_LoadInternalBGRA(
+               "sky_alphatexture",
+               TEXF_ALPHA,
+               (unsigned char *) alphapixels,
+               w, h, w, h,
+               CRC_Block((unsigned char *) alphapixels, w*h*4),
+               vid.sRGB3D);
        Mem_Free(solidpixels);
        Mem_Free(alphapixels);
 }