From 84627f97afdccdacdda0a0abf97d4d5062be2f3a Mon Sep 17 00:00:00 2001 From: APAmk2 <107351397+APAmk2@users.noreply.github.com> Date: Tue, 3 Mar 2026 11:19:07 +0400 Subject: [PATCH 1/2] utils: pxrad: fix wrong palette offset for textures --- utils/pxrad/textures.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/pxrad/textures.cpp b/utils/pxrad/textures.cpp index df7f625a..9e2021e3 100644 --- a/utils/pxrad/textures.cpp +++ b/utils/pxrad/textures.cpp @@ -118,7 +118,7 @@ miptex_t *GetTextureByMiptex( int miptex ) newMip->offsets[0] = sizeof(miptex_t); byte *buf = ((byte *)newMip) + newMip->offsets[0]; - byte *pal = ((byte *)newMip) + newMip->offsets[0] + (((newMip->width * newMip->height) * 85) >> 6); + byte *pal = ((byte *)newMip) + newMip->offsets[0] + (((newMip->width * newMip->height) * 85) >> 6) + sizeof(short); memcpy(buf, texture->buffer, newMip->width * newMip->height); for (int i = 0; i < 256; i++) From 6ea7ae90722405c90641cad59e39890e9a7f8563 Mon Sep 17 00:00:00 2001 From: APAmk2 <107351397+APAmk2@users.noreply.github.com> Date: Tue, 3 Mar 2026 11:19:34 +0400 Subject: [PATCH 2/2] utils: pxrad: rearrange texture loading order to match pxcsg behavior --- utils/pxrad/textures.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/utils/pxrad/textures.cpp b/utils/pxrad/textures.cpp index 9e2021e3..43eb78bf 100644 --- a/utils/pxrad/textures.cpp +++ b/utils/pxrad/textures.cpp @@ -59,25 +59,25 @@ rgbdata_t* TryLoadMiptex(const char* name) char texname[64]; rgbdata_t *texture = NULL; - Q_snprintf(texname, sizeof(texname), "textures/%s", name); - texture = COM_LoadImage(texname, false, FS_LoadFile); - - if (!texture) + Q_snprintf(texname, sizeof(texname), "%s.mip", name); + // check wads in reverse order + for (int i = wadlist.count - 1; i >= 0; i--) { - Q_strncpy(texname, name, sizeof(texname)); - // check wads in reverse order - for (int i = wadlist.count - 1; i >= 0; i--) - { - char *texpath = va("%s.wad/%s.mip", wadlist.wadnames[i], texname); + char *texpath = va("%s.wad/%s", wadlist.wadnames[i], texname); - if (FS_FileExists(texpath, false)) - { - texture = COM_LoadImage(texpath, true, FS_LoadFile); - break; - } + if (FS_FileExists(texpath, false)) + { + texture = COM_LoadImage(texpath, true, FS_LoadFile); + break; } } + if (!texture) + { + Q_snprintf(texname, sizeof(texname), "textures/%s", name); + texture = COM_LoadImage(texname, false, FS_LoadFile); + } + if (!texture) return NULL;