]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
redesigned transparent HL texture checking again, now treats color 255 as transparent...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Mar 2001 22:49:59 +0000 (22:49 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Mar 2001 22:49:59 +0000 (22:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@176 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c
wad.c

index 3f09262d54aaadff80939fc380e20bd6808f09a5..7dc551efd7f4472c154e30c7e2d610bfeb95770f 100644 (file)
@@ -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 9fc1237dcdaf910ed38c4e379c2c05e9fa1b165a..00d7e7efd27a693d32060e141ce5d73b67438c9c 100644 (file)
--- 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
                                        {