- 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
1 changed files with 2 additions and 7 deletions

View File

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