Fix vid_hw2d 0 rendering glitch

This commit is contained in:
Magnus Norddahl 2016-10-16 16:14:54 +02:00
parent 49e890f212
commit 2534e80a19
2 changed files with 38 additions and 16 deletions

View file

@ -2689,6 +2689,8 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
alpha = clamp<fixed_t> (alpha, 0, OPAQUE);
}
if (translation != -1)
{
dc_translation = NULL;
if (translation != 0)
{
@ -2701,6 +2703,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
dc_translation = table->Remap;
}
}
}
basecolormapsave = basecolormap;
hcolfunc_pre = R_DrawColumnHoriz;
@ -2801,10 +2804,11 @@ bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)())
void R_SetTranslationMap(lighttable_t *translation)
{
dc_fcolormap = nullptr;
dc_colormap = translation;
if (r_swtruecolor)
{
dc_fcolormap = nullptr;
dc_colormap = nullptr;
dc_translation = translation;
dc_shade_constants.light_red = 256;
dc_shade_constants.light_green = 256;
dc_shade_constants.light_blue = 256;
@ -2817,6 +2821,11 @@ void R_SetTranslationMap(lighttable_t *translation)
dc_shade_constants.simple_shade = true;
dc_light = 0;
}
else
{
dc_fcolormap = nullptr;
dc_colormap = translation;
}
}
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)

View file

@ -169,12 +169,18 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
parms.colorOverlay = PalEntry(parms.colorOverlay).InverseColor();
}
// Note that this overrides DTA_Translation in software, but not in hardware.
FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255,255,255),
parms.colorOverlay & MAKEARGB(0,255,255,255), 0);
translation = &colormap->Maps[(APART(parms.colorOverlay)*NUMCOLORMAPS/255)*256];
if (!r_swtruecolor)
{
FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255, 255, 255),
parms.colorOverlay & MAKEARGB(0, 255, 255, 255), 0);
translation = &colormap->Maps[(APART(parms.colorOverlay)*NUMCOLORMAPS / 255) * 256];
}
}
else if (parms.remap != NULL)
{
if (r_swtruecolor)
translation = (const BYTE*)parms.remap->Palette;
else
translation = parms.remap->Remap;
}
@ -184,11 +190,18 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
}
else
{
if (r_swtruecolor)
R_SetTranslationMap(nullptr);
else
R_SetTranslationMap(identitymap);
}
fixedcolormap = dc_fcolormap;
ESPSResult mode = R_SetPatchStyle (parms.style, parms.Alpha, 0, parms.fillcolor);
ESPSResult mode;
if (r_swtruecolor)
mode = R_SetPatchStyle(parms.style, parms.Alpha, -1, parms.fillcolor);
else
mode = R_SetPatchStyle(parms.style, parms.Alpha, 0, parms.fillcolor);
BYTE *destorgsave = dc_destorg;
dc_destorg = screen->GetBuffer();