- made AActor::alpha a floating point value
- replaced some uses of FRACUNIT with OPAQUE when it was about translucency. - simplified some overly complicated translucency multiplications in the SBARINFO code.
This commit is contained in:
parent
b29058c1ab
commit
4e60ea0252
50 changed files with 235 additions and 216 deletions
|
|
@ -415,28 +415,28 @@ void APowerInvulnerable::DoEffect ()
|
|||
// Don't mess with the translucency settings if an
|
||||
// invisibility powerup is active.
|
||||
Owner->RenderStyle = STYLE_Translucent;
|
||||
if (!(level.time & 7) && Owner->alpha > 0 && Owner->alpha < OPAQUE)
|
||||
if (!(level.time & 7) && Owner->Alpha > 0 && Owner->Alpha < 1)
|
||||
{
|
||||
if (Owner->alpha == HX_SHADOW)
|
||||
if (Owner->Alpha == HX_SHADOW)
|
||||
{
|
||||
Owner->alpha = HX_ALTSHADOW;
|
||||
Owner->Alpha = HX_ALTSHADOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner->alpha = 0;
|
||||
Owner->Alpha = 0;
|
||||
Owner->flags2 |= MF2_NONSHOOTABLE;
|
||||
}
|
||||
}
|
||||
if (!(level.time & 31))
|
||||
{
|
||||
if (Owner->alpha == 0)
|
||||
if (Owner->Alpha == 0)
|
||||
{
|
||||
Owner->flags2 &= ~MF2_NONSHOOTABLE;
|
||||
Owner->alpha = HX_ALTSHADOW;
|
||||
Owner->Alpha = HX_ALTSHADOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner->alpha = HX_SHADOW;
|
||||
Owner->Alpha = HX_SHADOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ void APowerInvulnerable::EndEffect ()
|
|||
// Don't mess with the translucency settings if an
|
||||
// invisibility powerup is active.
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
}
|
||||
}
|
||||
else if (Mode == NAME_Reflective)
|
||||
|
|
@ -499,8 +499,8 @@ int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis)
|
|||
{
|
||||
if (Mode == NAME_Ghost && !(Owner->flags & MF_SHADOW))
|
||||
{
|
||||
fixed_t wp_alpha = MIN<fixed_t>(FRACUNIT/4 + Owner->alpha*3/4, FRACUNIT);
|
||||
if (wp_alpha != FIXED_MAX) vis->alpha = wp_alpha;
|
||||
double wp_alpha = MIN<double>(0.25 + Owner->Alpha*0.75, 1.);
|
||||
vis->alpha = FLOAT2FIXED(wp_alpha);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
|
|
@ -616,8 +616,10 @@ void APowerInvisibility::DoEffect ()
|
|||
Super::DoEffect();
|
||||
// Due to potential interference with other PowerInvisibility items
|
||||
// the effect has to be refreshed each tic.
|
||||
fixed_t ts = (Strength/100) * (special1 + 1); if (ts > FRACUNIT) ts = FRACUNIT;
|
||||
Owner->alpha = clamp<fixed_t>((OPAQUE - ts), 0, OPAQUE);
|
||||
double ts = FIXED2DBL((Strength/100) * (special1 + 1));
|
||||
|
||||
if (ts > 1.) ts = 1.;
|
||||
Owner->Alpha = clamp((1. - ts), 0., 1.);
|
||||
switch (Mode)
|
||||
{
|
||||
case (NAME_Fuzzy):
|
||||
|
|
@ -645,7 +647,7 @@ void APowerInvisibility::DoEffect ()
|
|||
break;
|
||||
default: // Something's wrong
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -666,7 +668,7 @@ void APowerInvisibility::EndEffect ()
|
|||
Owner->flags5 &= ~(flags5 & INVISIBILITY_FLAGS5);
|
||||
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
|
||||
// Check whether there are other invisibility items and refresh their effect.
|
||||
// If this isn't done there will be one incorrectly drawn frame when this
|
||||
|
|
@ -1180,14 +1182,14 @@ IMPLEMENT_CLASS (APlayerSpeedTrail)
|
|||
|
||||
void APlayerSpeedTrail::Tick ()
|
||||
{
|
||||
const int fade = OPAQUE*6/10/8;
|
||||
if (alpha <= fade)
|
||||
const double fade = .6 / 8;
|
||||
if (Alpha <= fade)
|
||||
{
|
||||
Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha -= fade;
|
||||
Alpha -= fade;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue