Repair removeflats commit to make it function correctly with colormapping
This commit is contained in:
parent
c83d5cebd4
commit
b429a3e74c
2 changed files with 15 additions and 19 deletions
|
|
@ -953,7 +953,9 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
|||
|
||||
if (!grMipmap->data && !grMipmap->downloaded)
|
||||
{
|
||||
UINT8 *flat;
|
||||
UINT8 *colormap = colormaps;
|
||||
UINT8 *converted;
|
||||
|
||||
if (!noencoremap && encoremap)
|
||||
{
|
||||
|
|
@ -967,7 +969,13 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
|||
grMipmap->height = (UINT16)textures[texturenum]->height;
|
||||
|
||||
size_t size = grMipmap->width * grMipmap->height;
|
||||
memcpy(Z_Malloc(size, PU_HWRCACHE, &grMipmap->data), R_GetFlatForTexture(texturenum), size);
|
||||
flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
|
||||
converted = (UINT8 *)Picture_TextureToFlat(texturenum);
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
flat[i] = colormap[converted[i]];
|
||||
}
|
||||
Z_Free(converted);
|
||||
|
||||
if (!noencoremap && encoremap)
|
||||
{
|
||||
|
|
@ -991,13 +999,6 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
|||
|
||||
if (!grMipmap->data && !grMipmap->downloaded)
|
||||
{
|
||||
UINT8 *colormap = colormaps;
|
||||
|
||||
if (!noencoremap && encoremap)
|
||||
{
|
||||
colormap += COLORMAP_REMAPOFFSET;
|
||||
}
|
||||
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
|
|
|
|||
|
|
@ -571,7 +571,12 @@ 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);
|
||||
if (doremap)
|
||||
{
|
||||
R_DoPaletteRemapFlat(pdata, W_LumpLengthPwad(wadnum, lumpnum));
|
||||
}
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
|
||||
|
|
@ -951,17 +956,7 @@ void *R_GetFlat(levelflat_t *levelflat)
|
|||
if (levelflat->type == LEVELFLAT_NONE)
|
||||
return NULL;
|
||||
|
||||
// FIXME: checking this every time a flat is fetched for drawing is stupid...
|
||||
// sadly they are not cached anywhere else so i have no choice
|
||||
lumpnum_t flatlumpnum = levelflat->lump;
|
||||
boolean doremap = W_NeedPaletteRemap(flatlumpnum, false);
|
||||
void *flat = W_CacheLumpNum(flatlumpnum, PU_LEVEL);
|
||||
if (doremap)
|
||||
R_DoPaletteRemapFlat(flat, W_LumpLength(flatlumpnum));
|
||||
return flat;
|
||||
|
||||
// FIXME: How do I convert above for new format.
|
||||
//return R_GetFlatForTexture(R_GetTextureNumForFlat(levelflat));
|
||||
return R_GetFlatForTexture(R_GetTextureNumForFlat(levelflat));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue