Skip to content

Commit

Permalink
Merge pull request #498 from smoogipooo/taiko_hitobject_base
Browse files Browse the repository at this point in the history
Taiko hitobject base
  • Loading branch information
peppy authored Mar 19, 2017
2 parents 33d70b9 + 73ffbf8 commit f237b5f
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 55 deletions.
8 changes: 4 additions & 4 deletions osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace osu.Game.Modes.Taiko.Beatmaps
{
internal class TaikoBeatmapConverter : IBeatmapConverter<TaikoBaseHit>
internal class TaikoBeatmapConverter : IBeatmapConverter<TaikoHitObject>
{
public Beatmap<TaikoBaseHit> Convert(Beatmap original)
public Beatmap<TaikoHitObject> Convert(Beatmap original)
{
return new Beatmap<TaikoBaseHit>(original)
return new Beatmap<TaikoHitObject>(original)
{
HitObjects = new List<TaikoBaseHit>() // Todo: Implement
HitObjects = new List<TaikoHitObject>() // Todo: Implement
};
}
}
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

namespace osu.Game.Modes.Taiko.Beatmaps
{
internal class TaikoBeatmapProcessor : IBeatmapProcessor<TaikoBaseHit>
internal class TaikoBeatmapProcessor : IBeatmapProcessor<TaikoHitObject>
{
public void SetDefaults(TaikoBaseHit hitObject, Beatmap<TaikoBaseHit> beatmap)
public void SetDefaults(TaikoHitObject hitObject, Beatmap<TaikoHitObject> beatmap)
{
}

public void PostProcess(Beatmap<TaikoBaseHit> beatmap)
public void PostProcess(Beatmap<TaikoHitObject> beatmap)
{
}
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
{
internal class DrawableTaikoHit : Sprite
{
private TaikoBaseHit h;
private TaikoHitObject h;

public DrawableTaikoHit(TaikoBaseHit h)
public DrawableTaikoHit(TaikoHitObject h)
{
this.h = h;

Expand Down
20 changes: 0 additions & 20 deletions osu.Game.Modes.Taiko/Objects/TaikoBaseHit.cs

This file was deleted.

59 changes: 59 additions & 0 deletions osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects;

namespace osu.Game.Modes.Taiko.Objects
{
public class TaikoHitObject : HitObject
{
/// <summary>
/// HitCircle radius.
/// </summary>
public const float CIRCLE_RADIUS = 64;

/// <summary>
/// The hit window that results in a "GREAT" hit.
/// </summary>
public double HitWindowGreat = 35;

/// <summary>
/// The hit window that results in a "GOOD" hit.
/// </summary>
public double HitWindowGood = 80;

/// <summary>
/// The hit window that results in a "MISS".
/// </summary>
public double HitWindowMiss = 95;

/// <summary>
/// The time to scroll in the HitObject.
/// </summary>
public double PreEmpt;

/// <summary>
/// Whether this HitObject is in Kiai time.
/// </summary>
public bool Kiai;

public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);

PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;

ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;

if (overridePoint != null)
Kiai |= overridePoint.KiaiMode;

HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20);
HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50);
HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70);
}
}
}
21 changes: 21 additions & 0 deletions osu.Game.Modes.Taiko/Objects/TaikoHitType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;

namespace osu.Game.Modes.Taiko.Objects
{
[Flags]
public enum TaikoHitType
{
None = 0,
CentreHit = 1 << 0,
RimHit = 1 << 1,
DrumRoll = 1 << 2,
DrumRollTick = 1 << 3,
Bash = 1 << 4,
Finisher = 1 << 5,

Hit = CentreHit | RimHit
}
}
4 changes: 2 additions & 2 deletions osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace osu.Game.Modes.Taiko
{
public class TaikoDifficultyCalculator : DifficultyCalculator<TaikoBaseHit>
public class TaikoDifficultyCalculator : DifficultyCalculator<TaikoHitObject>
{
public TaikoDifficultyCalculator(Beatmap beatmap) : base(beatmap)
{
Expand All @@ -19,6 +19,6 @@ protected override double CalculateInternal(Dictionary<string, string> categoryD
return 0;
}

protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
protected override IBeatmapConverter<TaikoHitObject> CreateBeatmapConverter() => new TaikoBeatmapConverter();
}
}
4 changes: 2 additions & 2 deletions osu.Game.Modes.Taiko/TaikoScoreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace osu.Game.Modes.Taiko
{
internal class TaikoScoreProcessor : ScoreProcessor<TaikoBaseHit, TaikoJudgementInfo>
internal class TaikoScoreProcessor : ScoreProcessor<TaikoHitObject, TaikoJudgementInfo>
{
public TaikoScoreProcessor()
{
}

public TaikoScoreProcessor(HitRenderer<TaikoBaseHit, TaikoJudgementInfo> hitRenderer)
public TaikoScoreProcessor(HitRenderer<TaikoHitObject, TaikoJudgementInfo> hitRenderer)
: base(hitRenderer)
{
}
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace osu.Game.Modes.Taiko.UI
{
public class TaikoHitRenderer : HitRenderer<TaikoBaseHit, TaikoJudgementInfo>
public class TaikoHitRenderer : HitRenderer<TaikoHitObject, TaikoJudgementInfo>
{
public TaikoHitRenderer(WorkingBeatmap beatmap)
: base(beatmap)
Expand All @@ -19,12 +19,12 @@ public TaikoHitRenderer(WorkingBeatmap beatmap)

public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);

protected override IBeatmapConverter<TaikoBaseHit> CreateBeatmapConverter() => new TaikoBeatmapConverter();
protected override IBeatmapConverter<TaikoHitObject> CreateBeatmapConverter() => new TaikoBeatmapConverter();

protected override IBeatmapProcessor<TaikoBaseHit> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();
protected override IBeatmapProcessor<TaikoHitObject> CreateBeatmapProcessor() => new TaikoBeatmapProcessor();

protected override Playfield<TaikoBaseHit, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();
protected override Playfield<TaikoHitObject, TaikoJudgementInfo> CreatePlayfield() => new TaikoPlayfield();

protected override DrawableHitObject<TaikoBaseHit, TaikoJudgementInfo> GetVisualRepresentation(TaikoBaseHit h) => null;
protected override DrawableHitObject<TaikoHitObject, TaikoJudgementInfo> GetVisualRepresentation(TaikoHitObject h) => null;
}
}
2 changes: 1 addition & 1 deletion osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace osu.Game.Modes.Taiko.UI
{
public class TaikoPlayfield : Playfield<TaikoBaseHit, TaikoJudgementInfo>
public class TaikoPlayfield : Playfield<TaikoHitObject, TaikoJudgementInfo>
{
public TaikoPlayfield()
{
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
<Compile Include="Beatmaps\TaikoBeatmapProcessor.cs" />
<Compile Include="Judgements\TaikoJudgementInfo.cs" />
<Compile Include="Objects\TaikoHitType.cs" />
<Compile Include="TaikoDifficultyCalculator.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
<Compile Include="Objects\TaikoBaseHit.cs" />
<Compile Include="Objects\TaikoHitObject.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TaikoScoreProcessor.cs" />
<Compile Include="UI\TaikoHitRenderer.cs" />
Expand Down
15 changes: 0 additions & 15 deletions osu.Game/Beatmaps/Beatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ public Beatmap(Beatmap original = null)
TimingInfo = original?.TimingInfo ?? TimingInfo;
ComboColors = original?.ComboColors ?? ComboColors;
}

/// <summary>
/// Finds the slider velocity at a time.
/// </summary>
/// <param name="time">The time to find the slider velocity at.</param>
/// <returns>The slider velocity in positional length units.</returns>
public double SliderVelocityAt(double time)
{
double scoringDistance = 100 * BeatmapInfo.Difficulty.SliderMultiplier;
double beatDistance = TimingInfo.BeatDistanceAt(time);

if (beatDistance > 0)
return scoringDistance / beatDistance * 1000;
return scoringDistance;
}
}

/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions osu.Game/Beatmaps/Timing/TimingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,21 @@ public ControlPoint TimingPointAt(double time, out ControlPoint overridePoint)

return timingPoint ?? ControlPoint.Default;
}

/// <summary>
/// Finds the slider velocity at a time.
/// </summary>
/// <param name="time">The time to find the slider velocity at.</param>
/// <returns>The slider velocity in milliseconds.</returns>
public double SliderVelocityAt(double time)
{
const double base_scoring_distance = 100;

double beatDistance = BeatDistanceAt(time);

if (beatDistance > 0)
return base_scoring_distance / beatDistance * 1000;
return base_scoring_distance;
}
}
}

0 comments on commit f237b5f

Please sign in to comment.