Skip to content

Commit

Permalink
Merge pull request #4 from ppy/master
Browse files Browse the repository at this point in the history
Sync fork
  • Loading branch information
KaisoBits authored Aug 14, 2019
2 parents f6d41a5 + 5825818 commit 3c5a829
Show file tree
Hide file tree
Showing 156 changed files with 4,117 additions and 1,525 deletions.
Empty file removed .gitmodules
Empty file.
2 changes: 0 additions & 2 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Detailed changelogs are published on the [official osu! site](https://osu.ppy.sh
## Requirements

- A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed.
- When running on linux, please have a system-wide ffmpeg installation available to support video decoding.
- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs.
- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio 2017+](https://visualstudio.microsoft.com/vs/), [Jetbrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
- Note that there are **[additional requirements for Windows 7 and Windows 8.1](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)** which you may need to manually install if your operating system is not up-to-date.

## Running osu!

Expand All @@ -34,7 +35,7 @@ If you are not interested in developing the game, you can still consume our [bin
| ------------- | ------------- |

- **Linux** users are recommended to self-compile until we have official deployment in place.
- **iOS** users can join the [TestFlight beta program](https://t.co/PasE1zrHhw) (note that due to high demand this is regularly full).
- **iOS** users can join the [TestFlight beta program](https://testflight.apple.com/join/2tLcjWlF) (note that due to high demand this is regularly full).
- **Android** users can self-compile, and expect a public beta soon.

If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
Expand Down
8 changes: 3 additions & 5 deletions osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
<None Include="$(MSBuildThisFileDirectory)\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)\osu.Android\lib\**\*.so">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="$(OutputPath)\**\*.so" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -62,7 +60,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.730.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.809.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.814.0" />
</ItemGroup>
</Project>
Binary file removed osu.Android/lib/arm64-v8a/libbass.so
Binary file not shown.
Binary file removed osu.Android/lib/arm64-v8a/libbass_fx.so
Binary file not shown.
Binary file removed osu.Android/lib/armeabi-v7a/libbass.so
Binary file not shown.
Binary file removed osu.Android/lib/armeabi-v7a/libbass_fx.so
Binary file not shown.
Binary file removed osu.Android/lib/x86/libbass.so
Binary file not shown.
Binary file removed osu.Android/lib/x86/libbass_fx.so
Binary file not shown.
3 changes: 2 additions & 1 deletion osu.Desktop/Overlays/VersionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ public UpdateCompleteNotification(string version)
}

[BackgroundDependencyLoader]
private void load(OsuColour colours, ChangelogOverlay changelog)
private void load(OsuColour colours, ChangelogOverlay changelog, NotificationOverlay notificationOverlay)
{
Icon = FontAwesome.Solid.CheckSquare;
IconBackgound.Colour = colours.BlueDark;

Activated = delegate
{
notificationOverlay.Hide();
changelog.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="..\osu.iOS\libbass.a">
<Link>libbass.a</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\osu.iOS\libbass_fx.a">
<Link>libbass_fx.a</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<LinkDescription Include="..\osu.iOS\Linker.xml">
<Link>Linker.xml</Link>
</LinkDescription>
Expand Down
9 changes: 5 additions & 4 deletions osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
Expand All @@ -22,10 +23,10 @@ public class CatchBeatmapConversionTest : BeatmapConversionTest<ConvertValue>
[TestCase("spinner")]
[TestCase("spinner-and-circles")]
[TestCase("slider")]
public new void Test(string name)
{
base.Test(name);
}
[TestCase("hardrock-stream", new[] { typeof(CatchModHardRock) })]
[TestCase("hardrock-repeat-slider", new[] { typeof(CatchModHardRock) })]
[TestCase("hardrock-spinner", new[] { typeof(CatchModHardRock) })]
public new void Test(string name, params Type[] mods) => base.Test(name, mods);

protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
</ItemGroup>
<PropertyGroup Label="Project">
Expand Down
131 changes: 121 additions & 10 deletions osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using osu.Game.Rulesets.Objects.Types;
using osuTK;
using osu.Game.Rulesets.Catch.MathUtils;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Rulesets.Catch.Beatmaps
{
Expand All @@ -26,7 +27,7 @@ public override void PostProcess()
{
base.PostProcess();

applyPositionOffsets();
ApplyPositionOffsets(Beatmap);

initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects);

Expand All @@ -40,19 +41,29 @@ public override void PostProcess()
}
}

private void applyPositionOffsets()
public static void ApplyPositionOffsets(IBeatmap beatmap, params Mod[] mods)
{
var rng = new FastRandom(RNG_SEED);
// todo: HardRock displacement should be applied here

foreach (var obj in Beatmap.HitObjects)
bool shouldApplyHardRockOffset = mods.Any(m => m is ModHardRock);
float? lastPosition = null;
double lastStartTime = 0;

foreach (var obj in beatmap.HitObjects.OfType<CatchHitObject>())
{
obj.XOffset = 0;

switch (obj)
{
case Fruit fruit:
if (shouldApplyHardRockOffset)
applyHardRockOffset(fruit, ref lastPosition, ref lastStartTime, rng);
break;

case BananaShower bananaShower:
foreach (var banana in bananaShower.NestedHitObjects.OfType<Banana>())
{
banana.X = (float)rng.NextDouble();
banana.XOffset = (float)rng.NextDouble();
rng.Next(); // osu!stable retrieved a random banana type
rng.Next(); // osu!stable retrieved a random banana rotation
rng.Next(); // osu!stable retrieved a random banana colour
Expand All @@ -63,19 +74,119 @@ private void applyPositionOffsets()
case JuiceStream juiceStream:
foreach (var nested in juiceStream.NestedHitObjects)
{
var hitObject = (CatchHitObject)nested;
if (hitObject is TinyDroplet)
hitObject.X += rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH;
else if (hitObject is Droplet)
var catchObject = (CatchHitObject)nested;
catchObject.XOffset = 0;

if (catchObject is TinyDroplet)
catchObject.XOffset = MathHelper.Clamp(rng.Next(-20, 20) / CatchPlayfield.BASE_WIDTH, -catchObject.X, 1 - catchObject.X);
else if (catchObject is Droplet)
rng.Next(); // osu!stable retrieved a random droplet rotation
hitObject.X = MathHelper.Clamp(hitObject.X, 0, 1);
}

break;
}
}
}

private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng)
{
if (hitObject is JuiceStream stream)
{
lastPosition = stream.EndX;
lastStartTime = stream.EndTime;
return;
}

if (!(hitObject is Fruit))
return;

float offsetPosition = hitObject.X;
double startTime = hitObject.StartTime;

if (lastPosition == null)
{
lastPosition = offsetPosition;
lastStartTime = startTime;

return;
}

float positionDiff = offsetPosition - lastPosition.Value;
double timeDiff = startTime - lastStartTime;

if (timeDiff > 1000)
{
lastPosition = offsetPosition;
lastStartTime = startTime;
return;
}

if (positionDiff == 0)
{
applyRandomOffset(ref offsetPosition, timeDiff / 4d, rng);
hitObject.XOffset = offsetPosition - hitObject.X;
return;
}

if (Math.Abs(positionDiff * CatchPlayfield.BASE_WIDTH) < timeDiff / 3d)
applyOffset(ref offsetPosition, positionDiff);

hitObject.XOffset = offsetPosition - hitObject.X;

lastPosition = offsetPosition;
lastStartTime = startTime;
}

/// <summary>
/// Applies a random offset in a random direction to a position, ensuring that the final position remains within the boundary of the playfield.
/// </summary>
/// <param name="position">The position which the offset should be applied to.</param>
/// <param name="maxOffset">The maximum offset, cannot exceed 20px.</param>
/// <param name="rng">The random number generator.</param>
private static void applyRandomOffset(ref float position, double maxOffset, FastRandom rng)
{
bool right = rng.NextBool();
float rand = Math.Min(20, (float)rng.Next(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH;

if (right)
{
// Clamp to the right bound
if (position + rand <= 1)
position += rand;
else
position -= rand;
}
else
{
// Clamp to the left bound
if (position - rand >= 0)
position -= rand;
else
position += rand;
}
}

/// <summary>
/// Applies an offset to a position, ensuring that the final position remains within the boundary of the playfield.
/// </summary>
/// <param name="position">The position which the offset should be applied to.</param>
/// <param name="amount">The amount to offset by.</param>
private static void applyOffset(ref float position, float amount)
{
if (amount > 0)
{
// Clamp to the right bound
if (position + amount < 1)
position += amount;
}
else
{
// Clamp to the left bound
if (position + amount > 0)
position += amount;
}
}

private void initialiseHyperDash(List<CatchHitObject> objects)
{
List<CatchHitObject> objectWithDroplets = new List<CatchHitObject>();
Expand Down
8 changes: 8 additions & 0 deletions osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public uint NextUInt()
/// <returns>The random value.</returns>
public int Next(int lowerBound, int upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound));

/// <summary>
/// Generates a random integer value within the range [<paramref name="lowerBound"/>, <paramref name="upperBound"/>).
/// </summary>
/// <param name="lowerBound">The lower bound of the range.</param>
/// <param name="upperBound">The upper bound of the range.</param>
/// <returns>The random value.</returns>
public int Next(double lowerBound, double upperBound) => (int)(lowerBound + NextDouble() * (upperBound - lowerBound));

/// <summary>
/// Generates a random double value within the range [0, 1).
/// </summary>
Expand Down
Loading

0 comments on commit 3c5a829

Please sign in to comment.