1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 15:12:57 +08:00

Fix LegacySmoke alpha calculations

This commit is contained in:
Alden Wu 2022-10-03 16:02:33 -07:00
parent 0bac5ef465
commit 929eb8559e

View File

@ -67,6 +67,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
protected new LegacySmoke Source => (LegacySmoke)base.Source; protected new LegacySmoke Source => (LegacySmoke)base.Source;
private double initialFadeOutDurationTrunc; private double initialFadeOutDurationTrunc;
private double firstVisiblePointTime;
private double initialFadeOutTime; private double initialFadeOutTime;
private double reFadeInTime; private double reFadeInTime;
private double finalFadeOutTime; private double finalFadeOutTime;
@ -83,20 +85,22 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{ {
base.ApplyState(); base.ApplyState();
initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime);
rotationSeed = Source.RotationSeed; rotationSeed = Source.RotationSeed;
rotationRNG = new Random(rotationSeed); rotationRNG = new Random(rotationSeed);
initialFadeOutTime = Math.Min(CurrentTime, SmokeEndTime);
reFadeInTime = re_fade_in_speed * (CurrentTime - SmokeEndTime) + SmokeEndTime - initialFadeOutDurationTrunc; initialFadeOutDurationTrunc = Math.Min(initial_fade_out_duration, SmokeEndTime - SmokeStartTime);
finalFadeOutTime = final_fade_out_speed * (CurrentTime - SmokeEndTime) + SmokeEndTime - initialFadeOutDurationTrunc * (1 + 1 / re_fade_in_speed); firstVisiblePointTime = SmokeEndTime - initialFadeOutDurationTrunc;
initialFadeOutTime = CurrentTime;
reFadeInTime = CurrentTime - initialFadeOutDurationTrunc - firstVisiblePointTime * (1 - 1 / re_fade_in_speed);
finalFadeOutTime = CurrentTime - initialFadeOutDurationTrunc - firstVisiblePointTime * (1 - 1 / final_fade_out_speed);
} }
protected override Color4 PointColour(SmokePoint point) protected override Color4 PointColour(SmokePoint point)
{ {
var color = Color4.White; var color = Color4.White;
double timeDoingInitialFadeOut = initialFadeOutTime - point.Time; double timeDoingInitialFadeOut = Math.Min(initialFadeOutTime, SmokeEndTime) - point.Time;
if (timeDoingInitialFadeOut > 0) if (timeDoingInitialFadeOut > 0)
{ {
@ -106,8 +110,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
if (color.A > 0) if (color.A > 0)
{ {
double timeDoingReFadeIn = reFadeInTime - point.Time; double timeDoingReFadeIn = reFadeInTime - point.Time / re_fade_in_speed;
double timeDoingFinalFadeOut = finalFadeOutTime - point.Time; double timeDoingFinalFadeOut = finalFadeOutTime - point.Time / final_fade_out_speed;
if (timeDoingFinalFadeOut > 0) if (timeDoingFinalFadeOut > 0)
{ {