]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
if a (supposedly) quake sky texture is not 128x256, upload it just as a solid layer
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 Oct 2004 13:30:42 +0000 (13:30 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 Oct 2004 13:30:42 +0000 (13:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4682 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index 74a01d48cb8caa9878abbba4000fe059390460e8..d70a58198890880109e9782d37e7fdba3add9f2d 100644 (file)
@@ -911,11 +911,19 @@ R_Q1BSP_LoadSplitSky
 A sky texture is 256*128, with the right side being a masked overlay
 ==============
 */
-void R_Q1BSP_LoadSplitSky (qbyte *src, int bytesperpixel)
+void R_Q1BSP_LoadSplitSky (qbyte *src, int width, int height, int bytesperpixel)
 {
        int i, j;
        unsigned solidpixels[128*128], alphapixels[128*128];
 
+       // if sky isn't the right size, just use it as a solid layer
+       if (width != 256 || height != 128)
+       {
+               loadmodel->brush.solidskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_solidtexture", width, height, src, bytesperpixel == 4 ? TEXTYPE_RGBA : TEXTYPE_PALETTE, TEXF_PRECACHE, bytesperpixel == 1 ? palette_complete : NULL);
+               loadmodel->brush.alphaskytexture = NULL;;
+               return;
+       }
+
        if (bytesperpixel == 4)
        {
                for (i = 0;i < 128;i++)
@@ -1068,21 +1076,11 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
                                data = loadimagepixels(tx->name, false, 0, 0);
                                if (data)
                                {
-                                       if (image_width == 256 && image_height == 128)
-                                       {
-                                               R_Q1BSP_LoadSplitSky(data, 4);
-                                               Mem_Free(data);
-                                       }
-                                       else
-                                       {
-                                               Mem_Free(data);
-                                               Con_Printf("Invalid replacement texture for sky \"%s\" in %\"%s\", must be 256x128 pixels\n", tx->name, loadmodel->name);
-                                               if (mtdata != NULL)
-                                                       R_Q1BSP_LoadSplitSky(mtdata, 1);
-                                       }
+                                       R_Q1BSP_LoadSplitSky(data, image_width, image_height, 4);
+                                       Mem_Free(data);
                                }
                                else if (mtdata != NULL)
-                                       R_Q1BSP_LoadSplitSky(mtdata, 1);
+                                       R_Q1BSP_LoadSplitSky(mtdata, mtwidth, mtheight, 1);
                        }
                }
                else