From ef92cafedce7d06c5e2bf50146402b4ed1cdcd43 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sat, 3 Mar 2001 22:49:59 +0000 Subject: [PATCH] redesigned transparent HL texture checking again, now treats color 255 as transparent but only when the texture begins with a { character git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@176 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 43 +++++++++++++++++++++++-------------------- wad.c | 2 +- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/model_brush.c b/model_brush.c index 3f09262d..7dc551ef 100644 --- a/model_brush.c +++ b/model_brush.c @@ -176,39 +176,47 @@ void Mod_LoadTextures (lump_t *l) if (hlbsp) { byte *in, *out, *pal; - int palsize, d, p; +// int palsize; + int d, p; bytesperpixel = 4; freeimage = TRUE; in = data; data = out = qmalloc(mt->width * mt->height * 4); pal = in + (((mt->width * mt->height) * 85) >> 6); - palsize = pal[1] * 0x100 + pal[0]; - if (palsize >= 256) - palsize = 255; +// palsize = pal[1] * 0x100 + pal[0]; +// if (palsize >= 256) +// palsize = 256; pal += 2; for (d = 0;d < mt->width * mt->height;d++) { - p = (*in++) * 3; - out[0] = pal[p]; - out[1] = pal[p+1]; - out[2] = pal[p+2]; - out[3] = 255; - if (out[0] == 0 && out[1] == 0 && out[2] == 255) // HL transparent color (pure blue) + p = *in++; + if (mt->name[0] == '{' && p == 255) { out[0] = out[1] = out[2] = out[3] = 0; transparent = TRUE; } + else + { + p *= 3; + out[0] = pal[p]; + out[1] = pal[p+1]; + out[2] = pal[p+2]; + out[3] = 255; + } out += 4; } } - else if (r_fullbrights.value && tx->name[0] != '*') + else { - for (j = 0;j < tx->width*tx->height;j++) + if (r_fullbrights.value && tx->name[0] != '*') { - if (data[j] >= 224) // fullbright + for (j = 0;j < tx->width*tx->height;j++) { - fullbrights = TRUE; - break; + if (data[j] >= 224) // fullbright + { + fullbrights = TRUE; + break; + } } } } @@ -219,11 +227,6 @@ void Mod_LoadTextures (lump_t *l) data = (byte *)((int) r_notexture_mip + r_notexture_mip->offsets[0]); } } - else - { - tx->width = image_width; - tx->height = image_height; - } if (!hlbsp && !strncmp(tx->name,"sky",3) && tx->width == 256 && tx->height == 128) // LordHavoc: HL sky textures are entirely unrelated { tx->transparent = FALSE; diff --git a/wad.c b/wad.c index 9fc1237d..00d7e7ef 100644 --- a/wad.c +++ b/wad.c @@ -354,7 +354,7 @@ byte *W_GetTexture(char *name, int matchwidth, int matchheight) for (i = 0;i < image_width*image_height;i++) { c = *indata++; - if (pal[c][0] == 0 && pal[c][1] == 0 && pal[c][2] == 255) // HL transparent color (pure blue) + if (name[0] == '{' && c == 255) outdata[0] = outdata[1] = outdata[2] = outdata[3] = 0; else { -- 2.39.2