1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Move helper method to LegacyRulesetExtensions and stop applying rounding allowance to catch

As discussed, it isn't used in stable like this. Was a mistake.
This commit is contained in:
Dean Herbert 2023-10-20 18:57:14 +09:00
parent 2ba6286470
commit 3fb74cb5f9
No known key found for this signature in database
7 changed files with 29 additions and 20 deletions

View File

@ -8,6 +8,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osuTK;
@ -151,7 +152,7 @@ namespace osu.Game.Rulesets.Catch.Objects
TimePreempt = (float)IBeatmapDifficultyInfo.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450);
Scale = IBeatmapDifficultyInfo.CalculateScaleFromCircleSize(difficulty.CircleSize);
Scale = LegacyRulesetExtensions.CalculateScaleFromCircleSize(difficulty.CircleSize);
}
protected override HitWindows CreateHitWindows() => HitWindows.Empty;

View File

@ -17,6 +17,7 @@ using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.Skinning;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
@ -469,7 +470,7 @@ namespace osu.Game.Rulesets.Catch.UI
/// <summary>
/// Calculates the scale of the catcher based off the provided beatmap difficulty.
/// </summary>
private static Vector2 calculateScale(IBeatmapDifficultyInfo difficulty) => new Vector2(IBeatmapDifficultyInfo.CalculateScaleFromCircleSize(difficulty.CircleSize) * 2);
private static Vector2 calculateScale(IBeatmapDifficultyInfo difficulty) => new Vector2(LegacyRulesetExtensions.CalculateScaleFromCircleSize(difficulty.CircleSize) * 2);
private enum DroppedObjectAnimation
{

View File

@ -10,6 +10,7 @@ using osu.Game.Beatmaps;
using osu.Game.Replays;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Replays;
@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{
const double time_slider_start = 1000;
float circleRadius = OsuHitObject.OBJECT_RADIUS * IBeatmapDifficultyInfo.CalculateScaleFromCircleSize(circleSize);
float circleRadius = OsuHitObject.OBJECT_RADIUS * LegacyRulesetExtensions.CalculateScaleFromCircleSize(circleSize, true);
float followCircleRadius = circleRadius * 1.2f;
performTest(new Beatmap<OsuHitObject>

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring;
@ -155,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Objects
// This adjustment is necessary for AR>10, otherwise TimePreempt can become smaller leading to hitcircles not fully fading in.
TimeFadeIn = 400 * Math.Min(1, TimePreempt / PREEMPT_MIN);
Scale = IBeatmapDifficultyInfo.CalculateScaleFromCircleSize(difficulty.CircleSize);
Scale = LegacyRulesetExtensions.CalculateScaleFromCircleSize(difficulty.CircleSize, true);
}
protected override HitWindows CreateHitWindows() => new OsuHitWindows();

View File

@ -13,6 +13,7 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Scoring;
using osuTK;
@ -208,7 +209,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
if (score.HitEvents.Count == 0)
return;
float radius = OsuHitObject.OBJECT_RADIUS * IBeatmapDifficultyInfo.CalculateScaleFromCircleSize(playableBeatmap.Difficulty.CircleSize);
float radius = OsuHitObject.OBJECT_RADIUS * LegacyRulesetExtensions.CalculateScaleFromCircleSize(playableBeatmap.Difficulty.CircleSize, true);
foreach (var e in score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)))
{

View File

@ -44,21 +44,6 @@ namespace osu.Game.Beatmaps
/// </summary>
double SliderTickRate { get; }
static float CalculateScaleFromCircleSize(float circleSize)
{
// The following comment is copied verbatim from osu-stable:
//
// Builds of osu! up to 2013-05-04 had the gamefield being rounded down, which caused incorrect radius calculations
// in widescreen cases. This ratio adjusts to allow for old replays to work post-fix, which in turn increases the lenience
// for all plays, but by an amount so small it should only be effective in replays.
//
// To match expectations of gameplay we need to apply this multiplier to circle scale. It's weird but is what it is.
// It works out to under 1 game pixel and is generally not meaningful to gameplay, but is to replay playback accuracy.
const float broken_gamefield_rounding_allowance = 1.00041f;
return (float)(1.0f - 0.7f * DifficultyRange(circleSize)) / 2 * broken_gamefield_rounding_allowance;
}
/// <summary>
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
/// </summary>

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Types;
@ -38,5 +39,23 @@ namespace osu.Game.Rulesets.Objects.Legacy
return timingControlPoint.BeatLength * bpmMultiplier;
}
/// <summary>
/// Calculates scale from a CS value, with an optional fudge that was historically applied to the osu! ruleset.
/// </summary>
public static float CalculateScaleFromCircleSize(float circleSize, bool applyFudge = false)
{
// The following comment is copied verbatim from osu-stable:
//
// Builds of osu! up to 2013-05-04 had the gamefield being rounded down, which caused incorrect radius calculations
// in widescreen cases. This ratio adjusts to allow for old replays to work post-fix, which in turn increases the lenience
// for all plays, but by an amount so small it should only be effective in replays.
//
// To match expectations of gameplay we need to apply this multiplier to circle scale. It's weird but is what it is.
// It works out to under 1 game pixel and is generally not meaningful to gameplay, but is to replay playback accuracy.
const float broken_gamefield_rounding_allowance = 1.00041f;
return (float)(1.0f - 0.7f * IBeatmapDifficultyInfo.DifficultyRange(circleSize)) / 2 * broken_gamefield_rounding_allowance;
}
}
}