Skip to content

Commit

Permalink
Merge branch 'master' into masking-ssbo
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Aug 22, 2023
2 parents ed3bf7a + 2937dce commit 0bd75f0
Show file tree
Hide file tree
Showing 203 changed files with 3,302 additions and 1,610 deletions.
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.724.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.817.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
5 changes: 4 additions & 1 deletion osu.Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sh.ppy.osulazer" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!" android:icon="@drawable/lazer" />
<!-- for editor usage -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
</manifest>
2 changes: 1 addition & 1 deletion osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private object onLegacyIpcMessageReceived(object message)
case LegacyIpcDifficultyCalculationRequest req:
try
{
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile);
WorkingBeatmap beatmap = new FlatWorkingBeatmap(req.BeatmapFile);
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();

Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void Main(string[] args)
}
}

using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, new HostOptions { BindIPC = true }))
using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, new HostOptions { BindIPC = !tournamentClient }))
{
if (!host.IsPrimaryInstance)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- using a different name because package name cannot contain 'catch' -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Catch_Tests.Android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!catch Test" />
</manifest>
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania.Tests.Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="osu.Game.Rulesets.Mania.Tests.Android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<application android:allowBackup="true" android:supportsRtl="true" android:label="osu!mania Test" />
</manifest>
37 changes: 2 additions & 35 deletions osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModHoldOff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Tests.Visual;
using System.Collections.Generic;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mania.Beatmaps;
Expand All @@ -24,21 +23,6 @@ public void TestMapHasNoHoldNotes()
Assert.False(testBeatmap.HitObjects.OfType<HoldNote>().Any());
}

[Test]
public void TestCorrectNoteValues()
{
var testBeatmap = createRawBeatmap();
var noteValues = new List<double>(testBeatmap.HitObjects.OfType<HoldNote>().Count());

foreach (HoldNote h in testBeatmap.HitObjects.OfType<HoldNote>())
{
noteValues.Add(ManiaModHoldOff.GetNoteDurationInBeatLength(h, testBeatmap));
}

noteValues.Sort();
Assert.AreEqual(noteValues, new List<double> { 0.125, 0.250, 0.500, 1.000, 2.000 });
}

[Test]
public void TestCorrectObjectCount()
{
Expand All @@ -47,25 +31,8 @@ public void TestCorrectObjectCount()
var rawBeatmap = createRawBeatmap();
var testBeatmap = createModdedBeatmap();

// Calculate expected number of objects
int expectedObjectCount = 0;

foreach (ManiaHitObject h in rawBeatmap.HitObjects)
{
// Both notes and hold notes account for at least one object
expectedObjectCount++;

if (h.GetType() == typeof(HoldNote))
{
double noteValue = ManiaModHoldOff.GetNoteDurationInBeatLength((HoldNote)h, rawBeatmap);

if (noteValue >= ManiaModHoldOff.END_NOTE_ALLOW_THRESHOLD)
{
// Should generate an end note if it's longer than the minimum note value
expectedObjectCount++;
}
}
}
// Both notes and hold notes account for at least one object
int expectedObjectCount = rawBeatmap.HitObjects.Count;

Assert.That(testBeatmap.HitObjects.Count == expectedObjectCount);
}
Expand Down
14 changes: 6 additions & 8 deletions osu.Game.Rulesets.Mania.Tests/TestSceneStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,16 @@ private void createHoldNote()

private void createBarLine(bool major)
{
foreach (var stage in stages)
var obj = new BarLine
{
var obj = new BarLine
{
StartTime = Time.Current + 2000,
Major = major,
};
StartTime = Time.Current + 2000,
Major = major,
};

obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

foreach (var stage in stages)
stage.Add(obj);
}
}

private ScrollingTestContainer createStage(ScrollingDirection direction, ManiaAction action)
Expand Down
11 changes: 7 additions & 4 deletions osu.Game.Rulesets.Mania/Difficulty/Skills/Strain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Strain : StrainDecaySkill
{
private const double individual_decay_base = 0.125;
private const double overall_decay_base = 0.30;
private const double release_threshold = 24;
private const double release_threshold = 30;

protected override double SkillMultiplier => 1;
protected override double StrainDecayBase => 1;
Expand Down Expand Up @@ -50,10 +50,13 @@ protected override double StrainValueOf(DifficultyHitObject current)
for (int i = 0; i < endTimes.Length; ++i)
{
// The current note is overlapped if a previous note or end is overlapping the current note body
isOverlapping |= Precision.DefinitelyBigger(endTimes[i], startTime, 1) && Precision.DefinitelyBigger(endTime, endTimes[i], 1);
isOverlapping |= Precision.DefinitelyBigger(endTimes[i], startTime, 1) &&
Precision.DefinitelyBigger(endTime, endTimes[i], 1) &&
Precision.DefinitelyBigger(startTime, startTimes[i], 1);

// We give a slight bonus to everything if something is held meanwhile
if (Precision.DefinitelyBigger(endTimes[i], endTime, 1))
if (Precision.DefinitelyBigger(endTimes[i], endTime, 1) &&
Precision.DefinitelyBigger(startTime, startTimes[i], 1))
holdFactor = 1.25;

closestEndTime = Math.Min(closestEndTime, Math.Abs(endTime - endTimes[i]));
Expand All @@ -70,7 +73,7 @@ protected override double StrainValueOf(DifficultyHitObject current)
// 0.0 +--------+-+---------------> Release Difference / ms
// release_threshold
if (isOverlapping)
holdAddition = 1 / (1 + Math.Exp(0.5 * (release_threshold - closestEndTime)));
holdAddition = 1 / (1 + Math.Exp(0.27 * (release_threshold - closestEndTime)));

// Decay and increase individualStrains in own column
individualStrains[column] = applyDecay(individualStrains[column], startTime - startTimes[column], individual_decay_base);
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Mania/ManiaSkinComponentLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ public enum ManiaSkinComponents
HitExplosion,
StageBackground,
StageForeground,
BarLine
}
}
21 changes: 0 additions & 21 deletions osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class ManiaModHoldOff : Mod, IApplicableAfterBeatmapConversion

public override Type[] IncompatibleMods => new[] { typeof(ManiaModInvert) };

public const double END_NOTE_ALLOW_THRESHOLD = 0.5;

public void ApplyToBeatmap(IBeatmap beatmap)
{
var maniaBeatmap = (ManiaBeatmap)beatmap;
Expand All @@ -46,28 +44,9 @@ public void ApplyToBeatmap(IBeatmap beatmap)
StartTime = h.StartTime,
Samples = h.GetNodeSamples(0)
});

// Don't add an end note if the duration is shorter than the threshold
double noteValue = GetNoteDurationInBeatLength(h, maniaBeatmap); // 1/1, 1/2, 1/4, etc.

if (noteValue >= END_NOTE_ALLOW_THRESHOLD)
{
newObjects.Add(new Note
{
Column = h.Column,
StartTime = h.EndTime,
Samples = h.GetNodeSamples((h.NodeSamples?.Count - 1) ?? 1)
});
}
}

maniaBeatmap.HitObjects = maniaBeatmap.HitObjects.OfType<Note>().Concat(newObjects).OrderBy(h => h.StartTime).ToList();
}

public static double GetNoteDurationInBeatLength(HoldNote holdNote, ManiaBeatmap beatmap)
{
double beatLength = beatmap.ControlPointInfo.TimingPointAt(holdNote.StartTime).BeatLength;
return holdNote.Duration / beatLength;
}
}
}
11 changes: 10 additions & 1 deletion osu.Game.Rulesets.Mania/Objects/BarLine.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Bindables;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;

namespace osu.Game.Rulesets.Mania.Objects
{
public class BarLine : ManiaHitObject, IBarLine
{
public bool Major { get; set; }
private HitObjectProperty<bool> major;

public Bindable<bool> MajorBindable => major.Bindable;

public bool Major
{
get => major.Value;
set => major.Value = value;
}

public override Judgement CreateJudgement() => new IgnoreJudgement();
}
Expand Down
64 changes: 31 additions & 33 deletions osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
using osu.Game.Rulesets.Mania.Skinning.Default;
using osu.Game.Skinning;

namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
Expand All @@ -13,45 +15,41 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
/// </summary>
public partial class DrawableBarLine : DrawableManiaHitObject<BarLine>
{
public readonly Bindable<bool> Major = new Bindable<bool>();

public DrawableBarLine()
: this(null!)
{
}

public DrawableBarLine(BarLine barLine)
: base(barLine)
{
RelativeSizeAxes = Axes.X;
Height = barLine.Major ? 1.7f : 1.2f;
}

AddInternal(new Box
[BackgroundDependencyLoader]
private void load()
{
AddInternal(new SkinnableDrawable(new ManiaSkinComponentLookup(ManiaSkinComponents.BarLine), _ => new DefaultBarLine())
{
Name = "Bar line",
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
Alpha = barLine.Major ? 0.5f : 0.2f
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});

if (barLine.Major)
{
Vector2 size = new Vector2(22, 6);
const float line_offset = 4;

AddInternal(new Circle
{
Name = "Left line",
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreRight,

Size = size,
X = -line_offset,
});

AddInternal(new Circle
{
Name = "Right line",
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreLeft,
Size = size,
X = line_offset,
});
}
Major.BindValueChanged(major => Height = major.NewValue ? 1.7f : 1.2f, true);
}

protected override void OnApply()
{
base.OnApply();
Major.BindTo(HitObject.MajorBindable);
}

protected override void OnFree()
{
base.OnFree();
Major.UnbindFrom(HitObject.MajorBindable);
}

protected override void UpdateStartTimeStateTransforms() => this.FadeOut(150);
Expand Down
Loading

0 comments on commit 0bd75f0

Please sign in to comment.