mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- Fade cancelling should only always be active for A_SetBlend fades, not always for everything else (such as ACS fades).
This commit is contained in:
parent
fa0082aef6
commit
10465c1d27
3 changed files with 7 additions and 5 deletions
|
@ -50,16 +50,17 @@ DFlashFader::DFlashFader ()
|
||||||
|
|
||||||
DFlashFader::DFlashFader (float r1, float g1, float b1, float a1,
|
DFlashFader::DFlashFader (float r1, float g1, float b1, float a1,
|
||||||
float r2, float g2, float b2, float a2,
|
float r2, float g2, float b2, float a2,
|
||||||
float time, AActor *who)
|
float time, AActor *who, bool terminate)
|
||||||
: TotalTics ((int)(time*TICRATE)), StartTic (level.time), ForWho (who)
|
: TotalTics ((int)(time*TICRATE)), StartTic (level.time), ForWho (who)
|
||||||
{
|
{
|
||||||
Blends[0][0]=r1; Blends[0][1]=g1; Blends[0][2]=b1; Blends[0][3]=a1;
|
Blends[0][0]=r1; Blends[0][1]=g1; Blends[0][2]=b1; Blends[0][3]=a1;
|
||||||
Blends[1][0]=r2; Blends[1][1]=g2; Blends[1][2]=b2; Blends[1][3]=a2;
|
Blends[1][0]=r2; Blends[1][1]=g2; Blends[1][2]=b2; Blends[1][3]=a2;
|
||||||
|
Terminate = terminate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DFlashFader::OnDestroy ()
|
void DFlashFader::OnDestroy ()
|
||||||
{
|
{
|
||||||
Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade.
|
if (Terminate) Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade.
|
||||||
SetBlend (1.f);
|
SetBlend (1.f);
|
||||||
Super::OnDestroy();
|
Super::OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,19 +84,20 @@ class DFlashFader : public DThinker
|
||||||
public:
|
public:
|
||||||
DFlashFader (float r1, float g1, float b1, float a1,
|
DFlashFader (float r1, float g1, float b1, float a1,
|
||||||
float r2, float g2, float b2, float a2,
|
float r2, float g2, float b2, float a2,
|
||||||
float time, AActor *who);
|
float time, AActor *who, bool terminate = false);
|
||||||
void OnDestroy() override;
|
void OnDestroy() override;
|
||||||
void Serialize(FSerializer &arc);
|
void Serialize(FSerializer &arc);
|
||||||
void Tick ();
|
void Tick ();
|
||||||
AActor *WhoFor() { return ForWho; }
|
AActor *WhoFor() { return ForWho; }
|
||||||
void Cancel ();
|
void Cancel ();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float Blends[2][4];
|
float Blends[2][4];
|
||||||
int TotalTics;
|
int TotalTics;
|
||||||
int StartTic;
|
int StartTic;
|
||||||
TObjPtr<AActor*> ForWho;
|
TObjPtr<AActor*> ForWho;
|
||||||
|
bool Terminate;
|
||||||
void SetBlend (float time);
|
void SetBlend (float time);
|
||||||
DFlashFader ();
|
DFlashFader ();
|
||||||
};
|
};
|
||||||
|
|
|
@ -3586,7 +3586,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetBlend)
|
||||||
|
|
||||||
Create<DFlashFader>(color.r/255.f, color.g/255.f, color.b/255.f, float(alpha),
|
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, float(alpha2),
|
color2.r/255.f, color2.g/255.f, color2.b/255.f, float(alpha2),
|
||||||
float(tics)/TICRATE, self);
|
float(tics)/TICRATE, self, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue