- fixed applying of alpha to weapon sprites

https://forum.zdoom.org/viewtopic.php?t=60638
https://forum.zdoom.org/viewtopic.php?t=60642
This commit is contained in:
alexey.lysiuk 2018-05-21 10:49:29 +03:00
parent ad31da20e5
commit 2cdc9f9dda

View file

@ -252,14 +252,13 @@ bool HUDSprite::GetWeaponRenderStyle(DPSprite *psp, AActor *playermo, sector_t *
auto rs = psp->GetRenderStyle(playermo->RenderStyle, playermo->Alpha);
visstyle_t vis;
float trans = 0.f;
vis.RenderStyle = STYLE_Count;
vis.Alpha = rs.second;
vis.Invert = false;
playermo->AlterWeaponSprite(&vis);
if (!(psp->Flags & PSPF_FORCEALPHA)) trans = vis.Alpha;
alpha = (psp->Flags & PSPF_FORCEALPHA) ? 0.f : vis.Alpha;
if (vis.RenderStyle != STYLE_Count && !(psp->Flags & PSPF_FORCESTYLE))
{
@ -303,14 +302,10 @@ bool HUDSprite::GetWeaponRenderStyle(DPSprite *psp, AActor *playermo, sector_t *
{
alpha = 1.f;
}
else if (trans == 0.f)
else if (alpha == 0.f)
{
alpha = vis.Alpha;
}
else
{
alpha = trans;
}
if (!RenderStyle.IsVisible(alpha)) return false; // if it isn't visible skip the rest.
PalEntry ThingColor = (playermo->RenderStyle.Flags & STYLEF_ColorIsFixed) ? playermo->fillcolor : 0xffffff;