Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
tangalbert919 committed Mar 17, 2019
2 parents c047101 + 14af957 commit e865ac2
Show file tree
Hide file tree
Showing 44 changed files with 934 additions and 437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CatchDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";

[TestCase(4.2038001515546597d, "diffcalc-test")]
[TestCase(4.2058561036909863d, "diffcalc-test")]
public void Test(double expected, string name)
=> base.Test(expected, name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
using osu.Game.Rulesets.Catch.Difficulty.Skills;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Difficulty;
Expand Down Expand Up @@ -88,5 +89,13 @@ protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(I
{
new Movement(),
};

protected override Mod[] DifficultyAdjustmentMods => new Mod[]
{
new CatchModDoubleTime(),
new CatchModHalfTime(),
new CatchModHardRock(),
new CatchModEasy(),
};
}
}
121 changes: 45 additions & 76 deletions osu.Game.Rulesets.Catch/Objects/JuiceStream.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Audio;
Expand All @@ -25,6 +24,11 @@ public class JuiceStream : CatchHitObject, IHasCurve
public double Velocity;
public double TickDistance;

/// <summary>
/// The length of one span of this <see cref="JuiceStream"/>.
/// </summary>
public double SpanDuration => Duration / this.SpanCount();

protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
Expand All @@ -41,19 +45,6 @@ protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, B
protected override void CreateNestedHitObjects()
{
base.CreateNestedHitObjects();
createTicks();
}

private void createTicks()
{
if (TickDistance == 0)
return;

var length = Path.Distance;
var tickDistance = Math.Min(TickDistance, length);
var spanDuration = length / Velocity;

var minDistanceFromEnd = Velocity * 0.01;

var tickSamples = Samples.Select(s => new SampleInfo
{
Expand All @@ -62,81 +53,59 @@ private void createTicks()
Volume = s.Volume
}).ToList();

AddNested(new Fruit
{
Samples = Samples,
StartTime = StartTime,
X = X
});

double lastTickTime = StartTime;
SliderEventDescriptor? lastEvent = null;

for (int span = 0; span < this.SpanCount(); span++)
foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset))
{
var spanStartTime = StartTime + span * spanDuration;
var reversed = span % 2 == 1;

for (double d = tickDistance;; d += tickDistance)
// generate tiny droplets since the last point
if (lastEvent != null)
{
bool isLastTick = false;
if (d + minDistanceFromEnd >= length)
{
d = length;
isLastTick = true;
}

var timeProgress = d / length;
var distanceProgress = reversed ? 1 - timeProgress : timeProgress;
double sinceLastTick = e.Time - lastEvent.Value.Time;

double time = spanStartTime + timeProgress * spanDuration;

if (LegacyLastTickOffset != null)
if (sinceLastTick > 80)
{
// If we're the last tick, apply the legacy offset
if (span == this.SpanCount() - 1 && isLastTick)
time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value);
}
double timeBetweenTiny = sinceLastTick;
while (timeBetweenTiny > 100)
timeBetweenTiny /= 2;

int tinyTickCount = 1;
double tinyTickInterval = time - lastTickTime;
while (tinyTickInterval > 100 && tinyTickCount < 10000)
{
tinyTickInterval /= 2;
tinyTickCount *= 2;
for (double t = timeBetweenTiny; t < sinceLastTick; t += timeBetweenTiny)
{
AddNested(new TinyDroplet
{
Samples = tickSamples,
StartTime = t + lastEvent.Value.Time,
X = X + Path.PositionAt(
lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X / CatchPlayfield.BASE_WIDTH,
});
}
}
}

for (int tinyTickIndex = 0; tinyTickIndex < tinyTickCount - 1; tinyTickIndex++)
{
var t = lastTickTime + (tinyTickIndex + 1) * tinyTickInterval;
double progress = reversed ? 1 - (t - spanStartTime) / spanDuration : (t - spanStartTime) / spanDuration;
// this also includes LegacyLastTick and this is used for TinyDroplet generation above.
// this means that the final segment of TinyDroplets are increasingly mistimed where LegacyLastTickOffset is being applied.
lastEvent = e;

AddNested(new TinyDroplet
switch (e.Type)
{
case SliderEventType.Tick:
AddNested(new Droplet
{
StartTime = t,
X = X + Path.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
Samples = tickSamples
Samples = tickSamples,
StartTime = e.Time,
X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
});
break;
case SliderEventType.Head:
case SliderEventType.Tail:
case SliderEventType.Repeat:
AddNested(new Fruit
{
Samples = Samples,
StartTime = e.Time,
X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH,
});
}

lastTickTime = time;

if (isLastTick)
break;

AddNested(new Droplet
{
StartTime = time,
X = X + Path.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
Samples = tickSamples
});
}

AddNested(new Fruit
{
Samples = Samples,
StartTime = spanStartTime + spanDuration,
X = X + Path.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH
});
}
}

Expand Down
21 changes: 7 additions & 14 deletions osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,15 @@ private void load()
JudgementText.Font = JudgementText.Font.With(size: 25);
}

protected override void LoadComplete()
{
base.LoadComplete();

this.FadeInFromZero(50, Easing.OutQuint);
protected override double FadeInDuration => 50;

if (Result.IsHit)
{
JudgementBody.ScaleTo(0.8f);
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);

JudgementBody.Delay(50).ScaleTo(0.75f, 250);
this.Delay(50).FadeOut(200);
}
protected override void ApplyHitAnimations()
{
JudgementBody.ScaleTo(0.8f);
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);

Expire();
JudgementBody.Delay(FadeInDuration).ScaleTo(0.75f, 250);
this.Delay(FadeInDuration).FadeOut(200);
}
}
}
16 changes: 16 additions & 0 deletions osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;

namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestCaseOsuPlayer : Game.Tests.Visual.TestCasePlayer
{
public TestCaseOsuPlayer()
: base(new OsuRuleset())
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using osuTK;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
Expand All @@ -16,12 +15,10 @@ public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObje
{
}

protected override void LoadComplete()
protected override void ApplyHitAnimations()
{
if (Result.Type != HitResult.Miss)
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);

base.LoadComplete();
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
base.ApplyHitAnimations();
}
}
}
6 changes: 6 additions & 0 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ public override void ClearTransformsAfter(double time, bool propagateChildren =
base.ClearTransformsAfter(time, false, targetMember);
}

public override void ApplyTransformsAt(double time, bool propagateChildren = false)
{
// For the same reasons as above w.r.t rewinding, we shouldn't propagate to children here either.
base.ApplyTransformsAt(time, false);
}

private bool tracking;

public bool Tracking
Expand Down
Loading

0 comments on commit e865ac2

Please sign in to comment.