Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"CursorTrailRotate" does not work even if enabled in skin.ini #31482

Closed
renyoko opened this issue Jan 11, 2025 · 3 comments · Fixed by #31519
Closed

"CursorTrailRotate" does not work even if enabled in skin.ini #31482

renyoko opened this issue Jan 11, 2025 · 3 comments · Fixed by #31519

Comments

@renyoko
Copy link

renyoko commented Jan 11, 2025

Type

Cosmetic

Bug description

When the skin.ini setting ‘CursorTrailRotate’ is enabled, the cursortrail rotates in stable, but not in lazer.
There is a possibility that this is the intended behaviour, but I was curious.

Here is a skin where you can see the behaviour (blue line is cursor and red line is cursortrail, both ‘CursorRotate’ and ‘CursorTrailRotate’ are enabled for clarity)

Screenshots or videos

stable:
https://github.com/user-attachments/assets/1a07c58b-8e54-4e90-aec2-1dc0ea52917b

lazer:
https://github.com/user-attachments/assets/04172685-a634-4d4f-85f9-d36ee69fdbd2

Version

2025.101.0-lazer

Logs

compressed-logs.zip

@renyoko renyoko changed the title "CursorTrailRotate" is not enabled in skin.ini CursorTrailRotate’ does not work even if enabled in skin.ini Jan 11, 2025
@renyoko renyoko changed the title CursorTrailRotate’ does not work even if enabled in skin.ini "CursorTrailRotate" does not work even if enabled in skin.ini Jan 11, 2025
@peppy
Copy link
Member

peppy commented Jan 13, 2025

This will require shader changes. Maybe @EVAST9919 can pick it up?

https://osu.ppy.sh/wiki/en/Skinning/skin.ini

CursorTrailRotate:
Question: Should the cursor trail sprite rotate constantly?
Values: 0 or 1
Default: 1

Here's a starting point:

diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
index ca0002d8c0..45ea485963 100644
--- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
+++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs
@@ -24,6 +24,7 @@ public partial class LegacyCursorTrail : CursorTrail
         private IBindable<float> cursorSize = null!;
 
         private Vector2? currentPosition;
+        private bool spin;
 
         public LegacyCursorTrail(ISkin skin)
         {
@@ -34,6 +35,7 @@ public LegacyCursorTrail(ISkin skin)
         private void load(OsuConfigManager config, ISkinSource skinSource)
         {
             cursorSize = config.GetBindable<float>(OsuSetting.GameplayCursorSize).GetBoundCopy();
+            spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorTrailRotate)?.Value ?? true;
 
             Texture = skin.GetTexture("cursortrail");
 
diff --git a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs
index 9685ab685d..81488ca1a3 100644
--- a/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs
+++ b/osu.Game.Rulesets.Osu/Skinning/OsuSkinConfiguration.cs
@@ -9,6 +9,7 @@ public enum OsuSkinConfiguration
         CursorCentre,
         CursorExpand,
         CursorRotate,
+        CursorTrailRotate,
         HitCircleOverlayAboveNumber,
 
         // ReSharper disable once IdentifierTypo
diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
index 5132dc2859..5670d7213c 100644
--- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
+++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
@@ -206,6 +206,7 @@ private void addPart(Vector2 localSpacePosition)
         private struct TrailPart
         {
             public Vector2 Position;
+            public float Rotation;
             public float Time;
             public Vector2 Scale;
             public long InvalidationID;
@@ -219,6 +220,7 @@ private class TrailDrawNode : DrawNode
             private Texture texture;
 
             private float time;
+            private float rotation;
             private float fadeExponent;
 
             private readonly TrailPart[] parts = new TrailPart[max_sprites];
@@ -239,6 +241,7 @@ public override void ApplyState()
                 texture = Source.texture;
                 time = Source.time;
                 fadeExponent = Source.FadeExponent;
+                rotation = Source.Rotation;
 
                 originPosition = Vector2.Zero;
 

@EVAST9919
Copy link
Contributor

Not sure why we would need to change shader code. Can't we just compute rotated vertex positions in the draw node?

@peppy
Copy link
Member

peppy commented Jan 14, 2025

Possibly, it was a bit deep for me to setup in 5 minutes so I bailed 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants