weaponwheel: fix crappy alpha calculation.

This commit is contained in:
Mari the Deer 2025-01-17 14:44:28 +01:00
commit 12f0139d11
2 changed files with 3 additions and 5 deletions

View file

@ -1524,17 +1524,16 @@ Class SWWMWeaponSelect : HUDMessageBase
// simplify some code here
private bool DrawWeapon( Weapon w, int i, double x, double &y, double hs, Vector2 hss, double salph, double fractic, bool bOverflow = false, bool bUpward = false )
{
double fade = clamp(.8-abs((bUpward?(y-GetHeight(w)):y)-hss.y)/hss.y,0.,.8)/.8;
let sw = SWWMWeapon(w);
double scl = sw?.125:1.;
y += bUpward?-8.:8.;
bool bHasAmmo = WeaponHasAmmo(w);
TextureID ico = GetIcon(w);
double fade = 0.;
if ( ico.IsValid() )
{
Vector2 sz = TexMan.GetScaledSize(ico);
y += sz.y*scl*(bUpward?-.5:.5);
fade = clamp(.8-abs(y-hss.y)/hss.y,0.,.8)/.8;
if ( sw && sw.SisterWeapon && (sw.Amount > 1) && ((mo.player.ReadyWeapon == sw) || ((mo.player.ReadyWeapon != sw.SisterWeapon) && !swwm_singlefirst)) )
{
// double draw
@ -1558,7 +1557,6 @@ Class SWWMWeaponSelect : HUDMessageBase
Vector2 sz = (fnt.StringWidth(label),fnt.GetHeight());
Screen.DrawText(fnt,bHasAmmo?Font.CR_WHITE:Font.CR_RED,x-sz.x*.5*hs,y*hs,label,DTA_ScaleX,hs,DTA_ScaleY,hs,DTA_Alpha,salph*fade,DTA_ColorOverlay,((i==cursel)&&!bOverflow)?0x00000000:0x80000000);
y += sz.y*(bUpward?-.5:.5);
fade = clamp(.8-abs(y-hss.y)/hss.y,0.,.8)/.8;
if ( (i == cursel) && !bOverflow )
{
Screen.DrawChar(fnt,Font.CR_FIRE,x-((sz.x*.5+16.+2.*sin((gametic+fractic)*8.))*hs),y*hs,0x25BA,DTA_ScaleX,hs,DTA_ScaleY,hs,DTA_Alpha,salph*fade,DTA_CenterOffset,true);