Skip to content

Commit

Permalink
Merge branch 'master' into health-animates-in-intro
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Oct 4, 2023
2 parents 82ba545 + 66824ce commit bd71403
Show file tree
Hide file tree
Showing 119 changed files with 1,359 additions and 742 deletions.
1 change: 0 additions & 1 deletion osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ protected override IEnumerable<CatchHitObject> ConvertHitObject(HitObject obj, I
X = xPositionData?.X ?? 0,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0,
LegacyConvertedY = yPositionData?.Y ?? CatchHitObject.DEFAULT_LEGACY_CONVERT_Y,
SliderVelocityMultiplier = sliderVelocityData?.SliderVelocityMultiplier ?? 1
}.Yield();
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Catch/CatchRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Statistics;
Expand Down
12 changes: 0 additions & 12 deletions osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ public class CatchDifficultyCalculator : DifficultyCalculator

public override int Version => 20220701;

private readonly IWorkingBeatmap workingBeatmap;

public CatchDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
workingBeatmap = beatmap;
}

protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
Expand All @@ -49,15 +46,6 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType<JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)),
};

if (ComputeLegacyScoringValues)
{
CatchLegacyScoreSimulator sv1Simulator = new CatchLegacyScoreSimulator();
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
attributes.LegacyComboScore = sv1Simulator.ComboScore;
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
}

return attributes;
}

Expand Down
35 changes: 17 additions & 18 deletions osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,26 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Scoring.Legacy;

namespace osu.Game.Rulesets.Catch.Difficulty
{
internal class CatchLegacyScoreSimulator : ILegacyScoreSimulator
{
public int AccuracyScore { get; private set; }

public int ComboScore { get; private set; }

public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;

private int legacyBonusScore;
private int modernBonusScore;
private int standardisedBonusScore;
private int combo;

private double scoreMultiplier;

public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
public LegacyScoreAttributes Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap)
{
IBeatmap baseBeatmap = workingBeatmap.Beatmap;

Expand Down Expand Up @@ -70,13 +63,19 @@ public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, I
+ baseBeatmap.Difficulty.CircleSize
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);

scoreMultiplier = difficultyPeppyStars * mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
scoreMultiplier = difficultyPeppyStars;

LegacyScoreAttributes attributes = new LegacyScoreAttributes();

foreach (var obj in playableBeatmap.HitObjects)
simulateHit(obj);
simulateHit(obj, ref attributes);

attributes.BonusScoreRatio = legacyBonusScore == 0 ? 0 : (double)standardisedBonusScore / legacyBonusScore;

return attributes;
}

private void simulateHit(HitObject hitObject)
private void simulateHit(HitObject hitObject, ref LegacyScoreAttributes attributes)
{
bool increaseCombo = true;
bool addScoreComboMultiplier = false;
Expand Down Expand Up @@ -112,28 +111,28 @@ private void simulateHit(HitObject hitObject)

case JuiceStream:
foreach (var nested in hitObject.NestedHitObjects)
simulateHit(nested);
simulateHit(nested, ref attributes);
return;

case BananaShower:
foreach (var nested in hitObject.NestedHitObjects)
simulateHit(nested);
simulateHit(nested, ref attributes);
return;
}

if (addScoreComboMultiplier)
{
// ReSharper disable once PossibleLossOfFraction (intentional to match osu-stable...)
ComboScore += (int)(Math.Max(0, combo - 1) * (scoreIncrease / 25 * scoreMultiplier));
attributes.ComboScore += (int)(Math.Max(0, combo - 1) * (scoreIncrease / 25 * scoreMultiplier));
}

if (isBonus)
{
legacyBonusScore += scoreIncrease;
modernBonusScore += Judgement.ToNumericResult(bonusResult);
standardisedBonusScore += Judgement.ToNumericResult(bonusResult);
}
else
AccuracyScore += scoreIncrease;
attributes.AccuracyScore += scoreIncrease;

if (increaseCombo)
combo++;
Expand Down
8 changes: 3 additions & 5 deletions osu.Game.Rulesets.Catch/Objects/JuiceStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
int nodeIndex = 0;
SliderEventDescriptor? lastEvent = null;

foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset, cancellationToken))
foreach (var e in SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), cancellationToken))
{
// generate tiny droplets since the last point
if (lastEvent != null)
Expand All @@ -104,8 +104,8 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
}
}

// 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.
// this also includes LastTick and this is used for TinyDroplet generation above.
// this means that the final segment of TinyDroplets are increasingly mistimed where LastTick is being applied.
lastEvent = e;

switch (e.Type)
Expand Down Expand Up @@ -162,7 +162,5 @@ public SliderPath Path
public double Distance => Path.Distance;

public IList<IList<HitSampleInfo>> NodeSamples { get; set; } = new List<IList<HitSampleInfo>>();

public double? LegacyLastTickOffset { get; set; }
}
}
8 changes: 6 additions & 2 deletions osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyBananaPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Graphics.Textures;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
public partial class LegacyBananaPiece : LegacyCatchHitObjectPiece
{
private static readonly Vector2 banana_max_size = new Vector2(128);

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

Texture? texture = Skin.GetTexture("fruit-bananas");
Texture? overlayTexture = Skin.GetTexture("fruit-bananas-overlay");
Texture? texture = Skin.GetTexture("fruit-bananas")?.WithMaximumSize(banana_max_size);
Texture? overlayTexture = Skin.GetTexture("fruit-bananas-overlay")?.WithMaximumSize(banana_max_size);

SetTexture(texture, overlayTexture);
}
Expand Down
7 changes: 5 additions & 2 deletions osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyDropletPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Graphics.Textures;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
public partial class LegacyDropletPiece : LegacyCatchHitObjectPiece
{
private static readonly Vector2 droplet_max_size = new Vector2(82, 103);

public LegacyDropletPiece()
{
Scale = new Vector2(0.8f);
Expand All @@ -17,8 +20,8 @@ protected override void LoadComplete()
{
base.LoadComplete();

Texture? texture = Skin.GetTexture("fruit-drop");
Texture? overlayTexture = Skin.GetTexture("fruit-drop-overlay");
Texture? texture = Skin.GetTexture("fruit-drop")?.WithMaximumSize(droplet_max_size);
Texture? overlayTexture = Skin.GetTexture("fruit-drop-overlay")?.WithMaximumSize(droplet_max_size);

SetTexture(texture, overlayTexture);
}
Expand Down
17 changes: 13 additions & 4 deletions osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
internal partial class LegacyFruitPiece : LegacyCatchHitObjectPiece
{
private static readonly Vector2 fruit_max_size = new Vector2(128);

protected override void LoadComplete()
{
base.LoadComplete();
Expand All @@ -22,21 +26,26 @@ private void setTexture(FruitVisualRepresentation visualRepresentation)
switch (visualRepresentation)
{
case FruitVisualRepresentation.Pear:
SetTexture(Skin.GetTexture("fruit-pear"), Skin.GetTexture("fruit-pear-overlay"));
setTextures("pear");
break;

case FruitVisualRepresentation.Grape:
SetTexture(Skin.GetTexture("fruit-grapes"), Skin.GetTexture("fruit-grapes-overlay"));
setTextures("grapes");
break;

case FruitVisualRepresentation.Pineapple:
SetTexture(Skin.GetTexture("fruit-apple"), Skin.GetTexture("fruit-apple-overlay"));
setTextures("apple");
break;

case FruitVisualRepresentation.Raspberry:
SetTexture(Skin.GetTexture("fruit-orange"), Skin.GetTexture("fruit-orange-overlay"));
setTextures("orange");
break;
}

void setTextures(string fruitName) => SetTexture(
Skin.GetTexture($"fruit-{fruitName}")?.WithMaximumSize(fruit_max_size),
Skin.GetTexture($"fruit-{fruitName}-overlay")?.WithMaximumSize(fruit_max_size)
);
}
}
}
13 changes: 0 additions & 13 deletions osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ public class ManiaDifficultyCalculator : DifficultyCalculator

public override int Version => 20220902;

private readonly IWorkingBeatmap workingBeatmap;

public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
workingBeatmap = beatmap;

isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.MatchesOnlineID(ruleset);
originalOverallDifficulty = beatmap.BeatmapInfo.Difficulty.OverallDifficulty;
}
Expand All @@ -60,15 +56,6 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
MaxCombo = beatmap.HitObjects.Sum(maxComboForObject),
};

if (ComputeLegacyScoringValues)
{
ManiaLegacyScoreSimulator sv1Simulator = new ManiaLegacyScoreSimulator();
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
attributes.LegacyComboScore = sv1Simulator.ComboScore;
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
}

return attributes;
}

Expand Down
18 changes: 3 additions & 15 deletions osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyScoreSimulator.cs
Original file line number Diff line number Diff line change
@@ -1,28 +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 System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Scoring.Legacy;

namespace osu.Game.Rulesets.Mania.Difficulty
{
internal class ManiaLegacyScoreSimulator : ILegacyScoreSimulator
{
public int AccuracyScore => 0;
public int ComboScore { get; private set; }
public double BonusScoreRatio => 0;

public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
public LegacyScoreAttributes Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap)
{
double multiplier = mods.Where(m => m is not (ModHidden or ModHardRock or ModDoubleTime or ModFlashlight or ManiaModFadeIn))
.Select(m => m.ScoreMultiplier)
.Aggregate(1.0, (c, n) => c * n);

ComboScore = (int)(1000000 * multiplier);
return new LegacyScoreAttributes { ComboScore = 1000000 };
}
}
}
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Edit.Setup;
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private void load()
},
new SettingsCheckbox
{
Keywords = new[] { "color" },
LabelText = RulesetSettingsStrings.TimingBasedColouring,
Current = config.GetBindable<bool>(ManiaRulesetSetting.TimingBasedNoteColouring),
}
Expand Down
Loading

0 comments on commit bd71403

Please sign in to comment.