mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +08:00
Make mania scroll speed independent of hit position
This commit is contained in:
parent
dde88bb05e
commit
2ec6aa7fbb
@ -19,12 +19,14 @@ using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Configuration;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.Replays;
|
||||
using osu.Game.Rulesets.Mania.Skinning;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
@ -57,6 +59,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
// Stores the current speed adjustment active in gameplay.
|
||||
private readonly Track speedAdjustmentTrack = new TrackVirtual(0);
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skin { get; set; }
|
||||
|
||||
public DrawableManiaRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||
: base(ruleset, beatmap, mods)
|
||||
{
|
||||
@ -104,7 +109,20 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
updateTimeRange();
|
||||
}
|
||||
|
||||
private void updateTimeRange() => TimeRange.Value = smoothTimeRange * speedAdjustmentTrack.AggregateTempo.Value * speedAdjustmentTrack.AggregateFrequency.Value;
|
||||
private void updateTimeRange()
|
||||
{
|
||||
float hitPosition = skin.GetConfig<ManiaSkinConfigurationLookup, float>(
|
||||
new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.HitPosition))?.Value
|
||||
?? Stage.HIT_TARGET_POSITION;
|
||||
|
||||
const float length_to_default_hit_position = 768 - LegacyManiaSkinConfiguration.DEFAULT_HIT_POSITION;
|
||||
float lengthToHitPosition = 768 - hitPosition;
|
||||
|
||||
// This scaling factor preserves the scroll speed as the scroll length varies from changes to the hit position.
|
||||
float scale = lengthToHitPosition / length_to_default_hit_position;
|
||||
|
||||
TimeRange.Value = smoothTimeRange * speedAdjustmentTrack.AggregateTempo.Value * speedAdjustmentTrack.AggregateFrequency.Value * scale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes a scroll time (in milliseconds) from a scroll speed in the range of 1-40.
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public const float DEFAULT_COLUMN_SIZE = 30 * POSITION_SCALE_FACTOR;
|
||||
|
||||
public const float DEFAULT_HIT_POSITION = (480 - 402) * POSITION_SCALE_FACTOR;
|
||||
|
||||
public readonly int Keys;
|
||||
|
||||
public Dictionary<string, Color4> CustomColours { get; } = new Dictionary<string, Color4>();
|
||||
@ -35,7 +37,7 @@ namespace osu.Game.Skinning
|
||||
public readonly float[] ExplosionWidth;
|
||||
public readonly float[] HoldNoteLightWidth;
|
||||
|
||||
public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR;
|
||||
public float HitPosition = DEFAULT_HIT_POSITION;
|
||||
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
|
||||
public float ScorePosition = 300 * POSITION_SCALE_FACTOR;
|
||||
public bool ShowJudgementLine = true;
|
||||
|
Loading…
Reference in New Issue
Block a user