From fa0082aef6fcb4aa84bb8bb2b8028ed47b1030e2 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Wed, 27 Dec 2017 19:21:11 -0600 Subject: [PATCH] Added ability to perform reverse fades with A_SetBlend --- src/g_shared/a_flashfader.cpp | 1 + src/p_actionfunctions.cpp | 7 ++++--- wadsrc/static/zscript/actor.txt | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/g_shared/a_flashfader.cpp b/src/g_shared/a_flashfader.cpp index 64c4ff218..359c732a6 100644 --- a/src/g_shared/a_flashfader.cpp +++ b/src/g_shared/a_flashfader.cpp @@ -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(); } diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index ea64c36d3..b7a817cd3 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -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(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; } diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 13f5140c9..ee464a35b 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -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 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);