diff --git a/Scripts/Configuration/PlaySettings.cs b/Scripts/Configuration/PlaySettings.cs index 6508a69..af79000 100644 --- a/Scripts/Configuration/PlaySettings.cs +++ b/Scripts/Configuration/PlaySettings.cs @@ -1,7 +1,19 @@ namespace WacK.Configuration { + /// + /// Player-configured settings that affect gameplay mechanics. + /// Can + /// public class PlaySettings { + /// + /// Scroll speed multiplier. + /// public static float playSpeedMultiplier = 2f; + + /// + /// How much to shift song audio by in seconds. + /// + public static float audioOffset = 0f; } } \ No newline at end of file diff --git a/Scripts/Constants.cs b/Scripts/Constants.cs index bd3adb8..c753a97 100644 --- a/Scripts/Constants.cs +++ b/Scripts/Constants.cs @@ -1,8 +1,9 @@ +using Godot; + namespace WacK { public class Constants { - public const float SCROLL_MULT = 3f; - public const float NOTE_DRAW_DISTANCE = 10; + public static readonly float BASE_2D_RESOLUTION = 1920f; } } \ No newline at end of file diff --git a/Scripts/Scenes/Play.cs b/Scripts/Scenes/Play.cs index 5313091..7c42445 100644 --- a/Scripts/Scenes/Play.cs +++ b/Scripts/Scenes/Play.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection.PortableExecutable; using Godot; +using WacK.Configuration; using WacK.Data.Chart; using WacK.Data.Mer; using WacK.Things.TunnelObjects; @@ -50,7 +51,13 @@ namespace WacK.Scenes // base scroll speed, which we can apply multipliers on public static readonly float BASE_PIXELS_PER_SECOND = 800; - public static float scrollPxPerSec = BASE_PIXELS_PER_SECOND * 3.5f; + public static float scrollPxPerSec + { + get + { + return BASE_PIXELS_PER_SECOND * PlaySettings.playSpeedMultiplier; + } + } public override void _Ready() { @@ -94,34 +101,6 @@ namespace WacK.Scenes } } - // private void RealizeHolds(NoteHold note) - // { - // List verts = new(note.points.Count*2 + 2); - - // // HoldStart's pos - // verts.Add(new Vector2((float)note.pos * 1920/60, (float)note.time * -scrollPxPerSec)); - // // ascending -- "left" side - // foreach (var (t, n) in note.points) - // { - // verts.Add(new Vector2((float)n.pos * 1920/60, t * -scrollPxPerSec)); - // } - // // descending -- "right" side - // foreach (var (t, n) in note.points.Reverse()) - // { - // verts.Add(new Vector2((float)((int)n.pos + (int)n.size) * 1920/60, t * -scrollPxPerSec)); - // } - // // HoldStart's pos + size - // verts.Add(new Vector2((float)((int)note.pos + (int)note.size) * 1920/60, (float)note.time * -scrollPxPerSec)); - - // var p2d = new Polygon2D - // { - // Polygon = verts.ToArray(), - // Antialiased = true, - // Modulate = new Color("#FFFFFFD0") - // }; - // scrollDisplay.AddChild(p2d); - // } - public override void _Process(double delta) { var nPos = noteDisplay.Position; diff --git a/Scripts/Things/TunnelObjects/Background.cs b/Scripts/Things/TunnelObjects/Background.cs index 11c9ff3..0e04346 100644 --- a/Scripts/Things/TunnelObjects/Background.cs +++ b/Scripts/Things/TunnelObjects/Background.cs @@ -32,7 +32,7 @@ namespace WacK.Things.TunnelObjects segmentsNode.AddChild(n); segments.Add(n); n.Name = i.ToString(); - n.SetPosition(new Vector2(i * 1920 / 60, 0)); + n.SetPosition(new Vector2(i * Constants.BASE_2D_RESOLUTION / 60, 0)); } } diff --git a/Scripts/Things/TunnelObjects/THNoteHold.cs b/Scripts/Things/TunnelObjects/THNoteHold.cs index 273f841..b5b48b9 100644 --- a/Scripts/Things/TunnelObjects/THNoteHold.cs +++ b/Scripts/Things/TunnelObjects/THNoteHold.cs @@ -1,5 +1,7 @@ using System.Linq; +using System.Reflection.Metadata; using Godot; +using WacK.Configuration; using WacK.Data.Chart; using WacK.Scenes; @@ -47,8 +49,7 @@ namespace WacK.Things.TunnelObjects private Polygon2D CreateSegment(NotePlay origin, NotePlay destination) { - Vector2I textureSize = new(1920, 1920); - float minuteSize = textureSize.X / 60; + float minuteSize = Constants.BASE_2D_RESOLUTION / 60; var length = Play.scrollPxPerSec * (float)(destination.time - origin.time); var verts = new Vector2[4]; diff --git a/Scripts/Things/TunnelObjects/THNotePlay.cs b/Scripts/Things/TunnelObjects/THNotePlay.cs index 5acc262..7356725 100644 --- a/Scripts/Things/TunnelObjects/THNotePlay.cs +++ b/Scripts/Things/TunnelObjects/THNotePlay.cs @@ -20,13 +20,18 @@ namespace WacK.Things.TunnelObjects pos += 1; size -= 2; } + else if (size >= 60) + { + size = 60; + // remove padding + } var nPos = Position; - nPos.X = pos * (1920f/60) - 12; + nPos.X = pos * (Constants.BASE_2D_RESOLUTION/60) - 12; Position = nPos; var nSize = Size; - nSize.X = size * (1920f/60) + 24; + nSize.X = size * (Constants.BASE_2D_RESOLUTION/60) + 24; Size = nSize; } } diff --git a/Scripts/Util.cs b/Scripts/Util.cs index 24c902c..8a3675b 100644 --- a/Scripts/Util.cs +++ b/Scripts/Util.cs @@ -10,8 +10,6 @@ using System; using Godot; -using WacK.Configuration; - namespace WacK { public static class Util @@ -110,22 +108,6 @@ namespace WacK return 60f / tempo * beatsPerMeasure * ((float)measure + (float)beat / 1920f); } - public static float NotePosition(int measure, int beat, float tempo, int beatsPerMeasure) - { - if (tempo == 0) return 0; // avoid divide by 0 - return TimeToPosition(60f / tempo * beatsPerMeasure * ((float)measure + (float)beat / 1920f)); - } - - public static float TimeToPosition(float time) - { - return time * PlaySettings.playSpeedMultiplier * Constants.SCROLL_MULT; - } - - public static float PositionToTime(float pos) - { - return pos / PlaySettings.playSpeedMultiplier / Constants.SCROLL_MULT; - } - public static string DifficultyValueToString(float diffPoint) { return Mathf.FloorToInt(diffPoint).ToString() + (diffPoint > Mathf.Floor(diffPoint) ? "+" : "");