From a2e8c929d9b76eef30ee136154bbdadbe504092c Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 31 Jul 2002 11:45:17 +0000 Subject: [PATCH] cleaned up behavior when an invalid replacement sky texture is found - now it will fall back to the texture inside the map git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2142 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/model_brush.c b/model_brush.c index c0c7fac9..feab7d7e 100644 --- a/model_brush.c +++ b/model_brush.c @@ -224,23 +224,27 @@ static void Mod_LoadTextures (lump_t *l) // LordHavoc: HL sky textures are entirely different than quake if (!loadmodel->ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == 256 && mtheight == 128) { - data = loadimagepixels(tx->name, false, 0, 0); - if (data) + if (loadmodel->isworldmodel) { - if (image_width == 256 && image_height == 128) + data = loadimagepixels(tx->name, false, 0, 0); + if (data) { - if (loadmodel->isworldmodel) - R_InitSky (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 (image_width == 256 && image_height == 128) + { + R_InitSky (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_InitSky (mtdata, 1); + } } + else if (mtdata != NULL) + R_InitSky (mtdata, 1); } - else if (loadmodel->isworldmodel) - R_InitSky (mtdata, 1); } else if ((tx->texture = loadtextureimagewithmask(loadmodel->texturepool, tx->name, 0, 0, false, true, true))) { -- 2.39.2