Move ruleset-specific hitwindows to post-converted hitobjects

This commit is contained in:
smoogipoo
2018-05-17 13:35:06 +09:00
parent 5647e53f03
commit f67d263596
19 changed files with 36 additions and 46 deletions

View File

@ -84,10 +84,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
yield break; yield break;
foreach (ManiaHitObject obj in objects) foreach (ManiaHitObject obj in objects)
{
obj.HitWindows = original.HitWindows;
yield return obj; yield return obj;
}
} }
private readonly List<double> prevNoteTimes = new List<double>(max_notes_for_density); private readonly List<double> prevNoteTimes = new List<double>(max_notes_for_density);

View File

@ -1,8 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mania.Objects.Types; using osu.Game.Rulesets.Mania.Objects.Types;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -12,12 +10,6 @@ namespace osu.Game.Rulesets.Mania.Objects
{ {
public virtual int Column { get; set; } public virtual int Column { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) protected override HitWindows CreateHitWindows() => new ManiaHitWindows();
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
HitWindows.AllowsPerfect = true;
HitWindows.AllowsOk = true;
}
} }
} }

View File

@ -3,11 +3,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Objects.Legacy.Mania namespace osu.Game.Rulesets.Mania.Objects
{ {
public class ConvertHitWindows : HitWindows public class ManiaHitWindows : HitWindows
{ {
private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)> private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)>
{ {
@ -21,6 +22,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public override void SetDifficulty(double difficulty) public override void SetDifficulty(double difficulty)
{ {
AllowsPerfect = true;
AllowsOk = true;
Perfect = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Perfect]); Perfect = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Perfect]);
Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]); Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]);
Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]); Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]);

View File

@ -40,8 +40,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
RepeatSamples = curveData.RepeatSamples, RepeatSamples = curveData.RepeatSamples,
RepeatCount = curveData.RepeatCount, RepeatCount = curveData.RepeatCount,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false, NewCombo = comboData?.NewCombo ?? false
HitWindows = original.HitWindows
}; };
} }
else if (endTimeData != null) else if (endTimeData != null)
@ -51,8 +50,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
StartTime = original.StartTime, StartTime = original.StartTime,
Samples = original.Samples, Samples = original.Samples,
EndTime = endTimeData.EndTime, EndTime = endTimeData.EndTime,
Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2, Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2
HitWindows = original.HitWindows
}; };
} }
else else
@ -62,8 +60,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
StartTime = original.StartTime, StartTime = original.StartTime,
Samples = original.Samples, Samples = original.Samples,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false, NewCombo = comboData?.NewCombo ?? false
HitWindows = original.HitWindows
}; };
} }
} }

View File

@ -71,5 +71,7 @@ namespace osu.Game.Rulesets.Osu.Objects
} }
public virtual void OffsetPosition(Vector2 offset) => Position += offset; public virtual void OffsetPosition(Vector2 offset) => Position += offset;
protected override HitWindows CreateHitWindows() => new OsuHitWindows();
} }
} }

View File

@ -3,11 +3,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Objects.Legacy.Osu namespace osu.Game.Rulesets.Osu.Objects
{ {
public class ConvertHitWindows : HitWindows public class OsuHitWindows : HitWindows
{ {
private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)> private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)>
{ {

View File

@ -132,8 +132,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{ {
StartTime = j, StartTime = j,
Samples = currentSamples, Samples = currentSamples,
IsStrong = strong, IsStrong = strong
HitWindows = obj.HitWindows
}; };
} }
else else
@ -142,8 +141,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{ {
StartTime = j, StartTime = j,
Samples = currentSamples, Samples = currentSamples,
IsStrong = strong, IsStrong = strong
HitWindows = obj.HitWindows
}; };
} }
@ -158,8 +156,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Samples = obj.Samples, Samples = obj.Samples,
IsStrong = strong, IsStrong = strong,
Duration = taikoDuration, Duration = taikoDuration,
TickRate = beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate == 3 ? 3 : 4, TickRate = beatmap.BeatmapInfo.BaseDifficulty.SliderTickRate == 3 ? 3 : 4
HitWindows = obj.HitWindows
}; };
} }
} }
@ -173,8 +170,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Samples = obj.Samples, Samples = obj.Samples,
IsStrong = strong, IsStrong = strong,
Duration = endTimeData.Duration, Duration = endTimeData.Duration,
RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier)
HitWindows = obj.HitWindows
}; };
} }
else else
@ -187,8 +183,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{ {
StartTime = obj.StartTime, StartTime = obj.StartTime,
Samples = obj.Samples, Samples = obj.Samples,
IsStrong = strong, IsStrong = strong
HitWindows = obj.HitWindows
}; };
} }
else else
@ -197,8 +192,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{ {
StartTime = obj.StartTime, StartTime = obj.StartTime,
Samples = obj.Samples, Samples = obj.Samples,
IsStrong = strong, IsStrong = strong
HitWindows = obj.HitWindows
}; };
} }
} }

View File

@ -27,5 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
/// Strong hit objects give more points for hitting the hit object with both keys. /// Strong hit objects give more points for hitting the hit object with both keys.
/// </summary> /// </summary>
public bool IsStrong; public bool IsStrong;
protected override HitWindows CreateHitWindows() => new TaikoHitWindows();
} }
} }

View File

@ -3,11 +3,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Objects.Legacy.Taiko namespace osu.Game.Rulesets.Taiko.Objects
{ {
public class ConvertHitWindows : HitWindows public class TaikoHitWindows : HitWindows
{ {
private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)> private static readonly IReadOnlyDictionary<HitResult, (double od0, double od5, double od10)> base_ranges = new Dictionary<HitResult, (double, double, double)>
{ {

View File

@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -16,6 +16,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
public float X { get; set; } public float X { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -19,6 +19,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -19,6 +19,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
public float Y => Position.Y; public float Y => Position.Y;
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
{ {
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
{ {
public bool NewCombo { get; set; } public bool NewCombo { get; set; }
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
protected override HitWindows CreateHitWindows() => new ConvertHitWindows(); protected override HitWindows CreateHitWindows() => null;
} }
} }