From 5dc4083f462f3a21d6acc4d69e6da1dd6f4ed8a5 Mon Sep 17 00:00:00 2001 From: James O'Neill Date: Mon, 22 Apr 2024 00:07:23 +0900 Subject: [PATCH] Merge PR 'Compare Q1BSP sky textures properly when loading' 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 --- model_brush.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/model_brush.c b/model_brush.c index 3357d0df..83645cf3 100644 --- a/model_brush.c +++ b/model_brush.c @@ -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); } -- 2.39.2