Skip to content

Commit

Permalink
Fix incorrect combo colours
Browse files Browse the repository at this point in the history
  • Loading branch information
EVAST9919 committed Feb 11, 2023
1 parent 82081eb commit b8e7f49
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 53 deletions.
12 changes: 0 additions & 12 deletions osu.Game.Rulesets.Touhosu/Beatmaps/TouhosuBeatmapProcessor.cs

This file was deleted.

62 changes: 36 additions & 26 deletions osu.Game.Rulesets.Touhosu/Extensions/ConversionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public static IEnumerable<TouhosuHitObject> ConvertDefaultSlider(HitObject obj,
var curvePosition = curve.CurvePositionAt(e.PathProgress / (curve.RepeatCount + 1)) + originalPosition;
var sliderEventPosition = toPlayfieldSpace(curvePosition * new Vector2(1, 0.4f));

if (!withinPlayfield(sliderEventPosition))
continue;

switch (e.Type)
{
case SliderEventType.Repeat:
Expand Down Expand Up @@ -96,7 +99,7 @@ public static IEnumerable<TouhosuHitObject> ConvertBuzzSlider(HitObject obj, Vec

var slider = SliderEventGenerator.Generate(obj.StartTime, spanDuration, velocity, tickDistance, curve.Path.Distance, curve.RepeatCount + 1, legacyLastTickOffset, new CancellationToken());

var sliderEventPosition = toPlayfieldSpace(originalPosition * new Vector2(1, 0.4f));
var buzzPosition = toPlayfieldSpace(originalPosition * new Vector2(1, 0.4f));
var repeats = slider.Select(e => e.Type == SliderEventType.Repeat);

var repeatCount = repeats.Count();
Expand All @@ -114,23 +117,25 @@ public static IEnumerable<TouhosuHitObject> ConvertBuzzSlider(HitObject obj, Vec
switch (e.Type)
{
case SliderEventType.Head:
converted.AddRange(generateExplosion(e.Time, bullets_per_slider_reverse, sliderEventPosition));
converted.AddRange(generateExplosion(e.Time, bullets_per_slider_reverse, buzzPosition));
break;

case SliderEventType.Tail:
converted.AddRange(generateExplosion(e.Time, bullets_per_slider_reverse, sliderEventPosition, slider_angle_per_span * (repeatCount + 1)));
converted.AddRange(generateExplosion(e.Time, bullets_per_slider_reverse, buzzPosition, slider_angle_per_span * (repeatCount + 1)));
break;
}
}

for (int i = 0; i < totalRepeats; i++)
converted.AddRange(generateExplosion(obj.StartTime + (i + 1) * repeatDuration, bullets_per_slider_reverse, sliderEventPosition, slider_angle_per_span * (i + 1)));
converted.AddRange(generateExplosion(obj.StartTime + (i + 1) * repeatDuration, bullets_per_slider_reverse, buzzPosition, slider_angle_per_span * (i + 1)));

return converted;
}

public static IEnumerable<TouhosuHitObject> GenerateSliderBody(double startTime, IHasPathWithRepeats curve, Vector2 originalPosition)
{
List<InstantProjectile> bodyProjectiles = new List<InstantProjectile>();

var bodyCherriesCount = Math.Min(curve.Distance * (curve.RepeatCount + 1) / 10, max_visuals_per_slider_span * (curve.RepeatCount + 1));

for (int i = 0; i < bodyCherriesCount; i++)
Expand All @@ -139,15 +144,26 @@ public static IEnumerable<TouhosuHitObject> GenerateSliderBody(double startTime,
var position = curve.CurvePositionAt(progress) + originalPosition;
position = toPlayfieldSpace(position * new Vector2(1, 0.4f));

if (withinPlayfield(position))
if (!withinPlayfield(position))
continue;

bodyProjectiles.Add(new InstantProjectile
{
yield return new InstantProjectile
{
StartTime = startTime + curve.Duration * progress,
Position = position
};
}
StartTime = startTime + curve.Duration * progress,
Position = position
});
}

if (!bodyProjectiles.Any())
{
bodyProjectiles.Add(new InstantProjectile
{
StartTime = startTime,
Position = new Vector2(-100)
});
}

return bodyProjectiles;
}

public static IEnumerable<TouhosuHitObject> ConvertSpinner(double startTime, IHasDuration endTime, double beatLength)
Expand Down Expand Up @@ -186,29 +202,23 @@ public static IEnumerable<TouhosuHitObject> ConvertSpinner(double startTime, IHa

private static IEnumerable<TouhosuHitObject> generateExplosion(double startTime, int bulletCount, Vector2 position, float angleOffset = 0, float angleRange = 360f)
{
if (withinPlayfield(position))
for (int i = 0; i < bulletCount; i++)
{
for (int i = 0; i < bulletCount; i++)
yield return new AngeledProjectile
{
yield return new AngeledProjectile
{
Angle = MathExtensions.BulletDistribution(bulletCount, angleRange, i, angleOffset),
StartTime = startTime,
Position = position,
};
}
Angle = MathExtensions.BulletDistribution(bulletCount, angleRange, i, angleOffset),
StartTime = startTime,
Position = position,
};
}
}

private static IEnumerable<TouhosuHitObject> generatePolygonExplosion(double startTime, int bullets_per_side, int verticesCount, Vector2 position, float angleOffset = 0)
{
if (withinPlayfield(position))
for (int i = 0; i < verticesCount; i++)
{
for (int i = 0; i < verticesCount; i++)
{
foreach (var h in generatePolygonLine(startTime, bullets_per_side, verticesCount, position, i * (360f / verticesCount) + angleOffset))
yield return h;
}
foreach (var h in generatePolygonLine(startTime, bullets_per_side, verticesCount, position, i * (360f / verticesCount) + angleOffset))
yield return h;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace osu.Game.Rulesets.Touhosu.Objects.Drawables
{
public abstract class DrawableProjectile<T> : DrawableTouhosuHitObject<T>
public abstract partial class DrawableProjectile<T> : DrawableTouhosuHitObject<T>
where T : Projectile
{
private const int hidden_distance = 70;
Expand All @@ -20,7 +20,6 @@ public abstract class DrawableProjectile<T> : DrawableTouhosuHitObject<T>
public bool IsGrazed = false;

public readonly IBindable<Vector2> PositionBindable = new Bindable<Vector2>();
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();

protected abstract bool CanHitPlayer { get; }

Expand Down Expand Up @@ -121,7 +120,6 @@ protected override void OnApply()
base.OnApply();

PositionBindable.BindTo(HitObject.PositionBindable);
IndexInBeatmap.BindTo(HitObject.IndexInBeatmapBindable);
IsGrazed = false;
}

Expand All @@ -130,7 +128,6 @@ protected override void OnFree()
base.OnFree();

PositionBindable.UnbindFrom(HitObject.PositionBindable);
IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);
}


Expand Down
8 changes: 0 additions & 8 deletions osu.Game.Rulesets.Touhosu/Objects/Projectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ public abstract class Projectile : TouhosuHitObject, IHasComboInformation
{
public double TimePreempt { get; set; } = 400;

public readonly Bindable<int> IndexInBeatmapBindable = new Bindable<int>();

public int IndexInBeatmap
{
get => IndexInBeatmapBindable.Value;
set => IndexInBeatmapBindable.Value = value;
}

public Bindable<int> IndexInCurrentComboBindable { get; } = new Bindable<int>();

public int IndexInCurrentCombo
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Touhosu/TouhosuRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override HealthProcessor CreateHealthProcessor(double drainStartTime)

public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TouhosuBeatmapConverter(beatmap, this);

public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new TouhosuBeatmapProcessor(beatmap);
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new BeatmapProcessor(beatmap);

public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TouhosuReplayFrame();

Expand Down Expand Up @@ -112,7 +112,7 @@ protected override IEnumerable<HitResult> GetValidHitResults() => new[]

public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new TouhosuDifficultyCalculator(RulesetInfo, beatmap);

private class TouhosuIcon : Sprite
private partial class TouhosuIcon : Sprite
{
private readonly TouhosuRuleset ruleset;

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Touhosu/osu.Game.Rulesets.Touhosu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<EmbeddedResource Include="Resources\**\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2023.123.0"/>
<PackageReference Include="ppy.osu.Game" Version="2023.207.0"/>
</ItemGroup>
</Project>

0 comments on commit b8e7f49

Please sign in to comment.