Get flat palremap working again

This commit is contained in:
GenericHeroGuy 2025-05-25 18:18:21 +02:00
parent fc03c880fb
commit 2642e8d972
3 changed files with 3 additions and 9 deletions

View file

@ -580,7 +580,6 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
// Look for a flat
int texturenum = R_CheckFlatNumForName(levelflat->name);
lumpnum_t texturelump = W_CheckNumForName(levelflat->name);
if (texturenum <= 0)
{
// If we can't find a flat, try looking for a texture!
@ -589,7 +588,6 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
{
// Use "not found" texture
texturenum = R_CheckTextureNumForName(MISSING_TEXTURE);
texturelump = W_CheckNumForName(MISSING_TEXTURE);
// Give up?
if (texturenum <= 0)
@ -601,7 +599,6 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
}
levelflat->texture_id = texturenum;
levelflat->lump = texturelump;
levelflat->terrain =
K_GetTerrainForTextureName(levelflat->name);

View file

@ -66,7 +66,6 @@ struct levelflat_t
terrain_t *terrain;
UINT8 type;
INT32 texture_id;
lumpnum_t lump;
};
extern size_t numlevelflats;

View file

@ -574,13 +574,8 @@ UINT8 *R_GetFlatForTexture(size_t texnum)
texpatch_t *patch = &texture->patches[0];
UINT16 wadnum = patch->wad;
lumpnum_t lumpnum = patch->lump;
boolean doremap = W_NeedPaletteRemapPwad(wadnum, lumpnum, false);
UINT8 *pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
if (doremap)
{
R_DoPaletteRemapFlat(pdata, W_LumpLengthPwad(wadnum, lumpnum));
}
#ifndef NO_PNG_LUMPS
if (Picture_IsLumpPNG(pdata, lumplength))
@ -592,6 +587,9 @@ UINT8 *R_GetFlatForTexture(size_t texnum)
memcpy(texture->flat, pdata, lumplength);
}
if (W_NeedPaletteRemapPwad(wadnum, lumpnum, true))
R_DoPaletteRemapFlat(texture->flat, lumplength);
Z_SetUser(texture->flat, &texture->flat);
Z_Free(pdata);