mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- copied the changes to DFlashFader in master.
This commit is contained in:
parent
a78daa8937
commit
77cbd0c238
2 changed files with 7 additions and 11 deletions
|
@ -43,14 +43,10 @@ IMPLEMENT_POINTERS_START(DFlashFader)
|
||||||
IMPLEMENT_POINTER(ForWho)
|
IMPLEMENT_POINTER(ForWho)
|
||||||
IMPLEMENT_POINTERS_END
|
IMPLEMENT_POINTERS_END
|
||||||
|
|
||||||
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, bool terminate)
|
float time, AActor *who, bool terminate)
|
||||||
: TotalTics ((int)(time*TICRATE)), StartTic (level.time), ForWho (who)
|
: TotalTics ((int)(time*TICRATE)), RemainingTics(TotalTics), 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;
|
||||||
|
@ -68,7 +64,7 @@ void DFlashFader::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
arc("totaltics", TotalTics)
|
arc("totaltics", TotalTics)
|
||||||
("starttic", StartTic)
|
("remainingtics", RemainingTics)
|
||||||
("forwho", ForWho)
|
("forwho", ForWho)
|
||||||
.Array("blends", Blends[0], 8);
|
.Array("blends", Blends[0], 8);
|
||||||
}
|
}
|
||||||
|
@ -80,13 +76,13 @@ void DFlashFader::Tick ()
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level.time >= StartTic+TotalTics)
|
if (--RemainingTics <= 0)
|
||||||
{
|
{
|
||||||
SetBlend (1.f);
|
SetBlend (1.f);
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetBlend ((float)(level.time - StartTic) / (float)TotalTics);
|
SetBlend (1.f - (float)RemainingTics / (float)TotalTics);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DFlashFader::SetBlend (float time)
|
void DFlashFader::SetBlend (float time)
|
||||||
|
@ -105,6 +101,6 @@ void DFlashFader::SetBlend (float time)
|
||||||
|
|
||||||
void DFlashFader::Cancel ()
|
void DFlashFader::Cancel ()
|
||||||
{
|
{
|
||||||
TotalTics = level.time - StartTic;
|
RemainingTics = 0;
|
||||||
Blends[1][3] = 0.f;
|
Blends[1][3] = 0.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,11 +95,11 @@ public:
|
||||||
protected:
|
protected:
|
||||||
float Blends[2][4];
|
float Blends[2][4];
|
||||||
int TotalTics;
|
int TotalTics;
|
||||||
int StartTic;
|
int RemainingTics;
|
||||||
TObjPtr<AActor*> ForWho;
|
TObjPtr<AActor*> ForWho;
|
||||||
bool Terminate;
|
bool Terminate;
|
||||||
void SetBlend (float time);
|
void SetBlend (float time);
|
||||||
DFlashFader ();
|
DFlashFader() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
Loading…
Reference in a new issue