Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into flashlight-assist
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwcgt committed Jan 3, 2025
2 parents 1fb7fb1 + 2d4a3aa commit bbf5f17
Show file tree
Hide file tree
Showing 211 changed files with 5,775 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/diffcalc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
steps:
- name: Check permissions
run: |
ALLOWED_USERS=(smoogipoo peppy bdach frenzibyte)
ALLOWED_USERS=(smoogipoo peppy bdach frenzibyte tsunyoku stanriders)
for i in "${ALLOWED_USERS[@]}"; do
if [[ "${{ github.actor }}" == "$i" ]]; then
exit 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ public class EmptyFreeformHitObject : HitObject, IHasPosition

public Vector2 Position { get; set; }

public float X => Position.X;
public float Y => Position.Y;
public float X
{
get => Position.X;
set => Position = new Vector2(value, Y);
}

public float Y
{
get => Position.Y;
set => Position = new Vector2(X, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ public class PippidonHitObject : HitObject, IHasPosition

public Vector2 Position { get; set; }

public float X => Position.X;
public float Y => Position.Y;
public float X
{
get => Position.X;
set => Position = new Vector2(value, Y);
}

public float Y
{
get => Position.Y;
set => Position = new Vector2(X, value);
}
}
}
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="2024.1206.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.1224.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
1 change: 0 additions & 1 deletion osu.Desktop/OsuGameDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public override void SetHost(GameHost host)
if (iconStream != null)
host.Window.SetIconFromStream(iconStream);

host.Window.CursorState |= CursorState.Hidden;
host.Window.Title = Name;
}

Expand Down
15 changes: 15 additions & 0 deletions osu.Game.Rulesets.Catch.Tests.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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 Foundation;
using osu.Framework.iOS;
using osu.Game.Tests;

namespace osu.Game.Rulesets.Catch.Tests.iOS
{
[Register("AppDelegate")]
public class AppDelegate : GameApplicationDelegate
{
protected override Framework.Game CreateGame() => new OsuTestBrowser();
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// 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.iOS;
using osu.Game.Tests;
using UIKit;

namespace osu.Game.Rulesets.Catch.Tests.iOS
{
public static class Application
public static class Program
{
public static void Main(string[] args)
{
GameApplication.Main(new OsuTestBrowser());
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Screens.Edit;
using osuTK;
using osuTK.Input;
Expand Down Expand Up @@ -54,6 +56,12 @@ public partial class JuiceStreamSelectionBlueprint : CatchSelectionBlueprint<Jui
[Resolved]
private EditorBeatmap? editorBeatmap { get; set; }

[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }

[Resolved]
private BindableBeatDivisor? beatDivisor { get; set; }

public JuiceStreamSelectionBlueprint(JuiceStream hitObject)
: base(hitObject)
{
Expand Down Expand Up @@ -119,6 +127,20 @@ protected override bool OnMouseDown(MouseDownEvent e)
return base.OnMouseDown(e);
}

protected override bool OnKeyDown(KeyDownEvent e)
{
if (!IsSelected)
return false;

if (e.Key == Key.F && e.ControlPressed && e.ShiftPressed)
{
convertToStream();
return true;
}

return false;
}

private void onDefaultsApplied(HitObject _)
{
computeObjectBounds();
Expand Down Expand Up @@ -168,6 +190,50 @@ private void updateHitObjectFromPath()
lastSliderPathVersion = HitObject.Path.Version.Value;
}

// duplicated in `SliderSelectionBlueprint.convertToStream()`
// consider extracting common helper when applying changes here
private void convertToStream()
{
if (editorBeatmap == null || beatDivisor == null)
return;

var timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(HitObject.StartTime);
double streamSpacing = timingPoint.BeatLength / beatDivisor.Value;

changeHandler?.BeginChange();

int i = 0;
double time = HitObject.StartTime;

while (!Precision.DefinitelyBigger(time, HitObject.GetEndTime(), 1))
{
// positionWithRepeats is a fractional number in the range of [0, HitObject.SpanCount()]
// and indicates how many fractional spans of a slider have passed up to time.
double positionWithRepeats = (time - HitObject.StartTime) / HitObject.Duration * HitObject.SpanCount();
double pathPosition = positionWithRepeats - (int)positionWithRepeats;
// every second span is in the reverse direction - need to reverse the path position.
if (positionWithRepeats % 2 >= 1)
pathPosition = 1 - pathPosition;

float fruitXValue = HitObject.OriginalX + HitObject.Path.PositionAt(pathPosition).X;

editorBeatmap.Add(new Fruit
{
StartTime = time,
OriginalX = fruitXValue,
NewCombo = i == 0 && HitObject.NewCombo,
Samples = HitObject.Samples.Select(s => s.With()).ToList()
});

i += 1;
time = HitObject.StartTime + i * streamSpacing;
}

editorBeatmap.Remove(HitObject);

changeHandler?.EndChange();
}

private IEnumerable<MenuItem> getContextMenuItems()
{
yield return new OsuMenuItem("Add vertex", MenuItemType.Standard, () =>
Expand All @@ -177,6 +243,11 @@ private IEnumerable<MenuItem> getContextMenuItems()
{
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.MouseLeft))
};

yield return new OsuMenuItem("Convert to stream", MenuItemType.Destructive, convertToStream)
{
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.F))
};
}

protected override void Dispose(bool isDisposing)
Expand Down
22 changes: 19 additions & 3 deletions osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,27 @@ public void UpdateComboInformation(IHasComboInformation? lastObj)
/// </summary>
public float LegacyConvertedY { get; set; } = DEFAULT_LEGACY_CONVERT_Y;

float IHasXPosition.X => OriginalX;
float IHasXPosition.X
{
get => OriginalX;
set => OriginalX = value;
}

float IHasYPosition.Y => LegacyConvertedY;
float IHasYPosition.Y
{
get => LegacyConvertedY;
set => LegacyConvertedY = value;
}

Vector2 IHasPosition.Position => new Vector2(OriginalX, LegacyConvertedY);
Vector2 IHasPosition.Position
{
get => new Vector2(OriginalX, LegacyConvertedY);
set
{
((IHasXPosition)this).X = value.X;
((IHasYPosition)this).Y = value.Y;
}
}

#endregion
}
Expand Down
15 changes: 15 additions & 0 deletions osu.Game.Rulesets.Mania.Tests.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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 Foundation;
using osu.Framework.iOS;
using osu.Game.Tests;

namespace osu.Game.Rulesets.Mania.Tests.iOS
{
[Register("AppDelegate")]
public class AppDelegate : GameApplicationDelegate
{
protected override Framework.Game CreateGame() => new OsuTestBrowser();
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// 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.iOS;
using osu.Game.Tests;
using UIKit;

namespace osu.Game.Rulesets.Mania.Tests.iOS
{
public static class Application
public static class Program
{
public static void Main(string[] args)
{
GameApplication.Main(new OsuTestBrowser());
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ public class ManiaBeatmapConversionTest : BeatmapConversionTest<ManiaConvertMapp

[TestCase("basic")]
[TestCase("zero-length-slider")]
[TestCase("mania-specific-spinner")]
[TestCase("20544")]
[TestCase("100374")]
[TestCase("1450162")]
[TestCase("4869637")]
public void Test(string name) => base.Test(name);

protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit bbf5f17

Please sign in to comment.