Added ability to perform reverse fades with A_SetBlend

This commit is contained in:
Major Cooke 2017-12-27 19:21:11 -06:00 committed by Rachael Alexanderson
parent a3399c1af2
commit fa0082aef6
3 changed files with 6 additions and 4 deletions

View File

@ -59,6 +59,7 @@ DFlashFader::DFlashFader (float r1, float g1, float b1, float a1,
void DFlashFader::OnDestroy ()
{
Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade.
SetBlend (1.f);
Super::OnDestroy();
}

View File

@ -3575,16 +3575,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetBlend)
PARAM_FLOAT (alpha);
PARAM_INT (tics);
PARAM_COLOR_DEF (color2);
PARAM_FLOAT_DEF (alpha2);
if (color == MAKEARGB(255,255,255,255))
color = 0;
if (color2 == MAKEARGB(255,255,255,255))
color2 = 0;
if (color2.a == 0)
color2 = color;
// if (color2.a == 0)
// color2 = color;
Create<DFlashFader>(color.r/255.f, color.g/255.f, color.b/255.f, float(alpha),
color2.r/255.f, color2.g/255.f, color2.b/255.f, 0.f,
color2.r/255.f, color2.g/255.f, color2.b/255.f, float(alpha2),
float(tics)/TICRATE, self);
return 0;
}

View File

@ -1030,7 +1030,7 @@ class Actor : Thinker native
native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
native void A_DropInventory(class<Inventory> itemtype, int amount = -1);
native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0);
native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.);
deprecated("2.3") native void A_ChangeFlag(string flagname, bool value);
native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE);
native void A_RaiseMaster(int flags = 0);