Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions utils/pxrad/textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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++)
Expand Down
Loading