From fa523c3e53add5d023c14823d8d674b42831bb7a Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 30 Sep 2018 01:42:00 +0000 Subject: [PATCH] fix today's no-alpha bug. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5314 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/wad.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/client/wad.c b/engine/client/wad.c index ca63c4966..bd86c68a9 100644 --- a/engine/client/wad.c +++ b/engine/client/wad.c @@ -482,7 +482,7 @@ qbyte *W_GetTexture(const char *name, int *width, int *height, uploadfmt_t *form *width = 128; *height = 128; - *format = PTI_RGBX8; + *format = PTI_RGBA8; data = BZ_Malloc(128 * 128 * 4); for (i = 0; i < 128 * 128; i++) @@ -498,15 +498,20 @@ qbyte *W_GetTexture(const char *name, int *width, int *height, uploadfmt_t *form } else if (lumptype == TYP_QPIC && lumpsize == 8+p->width*p->height) { + qboolean alpha = false; + qbyte pal; *width = p->width; *height = p->height; - *format = PTI_RGBX8; data = BZ_Malloc(p->width * p->height * 4); for (i = 0; i < p->width * p->height; i++) { - ((unsigned int*)data)[i] = d_8to24rgbtable[p->data[i]]; + pal = p->data[i]; + ((unsigned int*)data)[i] = d_8to24rgbtable[pal]; + if (pal == 0xff) + alpha = true; } + *format = alpha?PTI_RGBA8:PTI_RGBX8; return data; } else if (lumptype == TYP_QPIC && lumpsize == 8+p->width*p->height+4+768)