Restructure some configuration things
This commit is contained in:
@@ -1,7 +1,19 @@
|
|||||||
namespace WacK.Configuration
|
namespace WacK.Configuration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Player-configured settings that affect gameplay mechanics.
|
||||||
|
/// Can
|
||||||
|
/// </summary>
|
||||||
public class PlaySettings
|
public class PlaySettings
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Scroll speed multiplier.
|
||||||
|
/// </summary>
|
||||||
public static float playSpeedMultiplier = 2f;
|
public static float playSpeedMultiplier = 2f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How much to shift song audio by in seconds.
|
||||||
|
/// </summary>
|
||||||
|
public static float audioOffset = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
namespace WacK
|
namespace WacK
|
||||||
{
|
{
|
||||||
public class Constants
|
public class Constants
|
||||||
{
|
{
|
||||||
public const float SCROLL_MULT = 3f;
|
public static readonly float BASE_2D_RESOLUTION = 1920f;
|
||||||
public const float NOTE_DRAW_DISTANCE = 10;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-29
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection.PortableExecutable;
|
using System.Reflection.PortableExecutable;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using WacK.Configuration;
|
||||||
using WacK.Data.Chart;
|
using WacK.Data.Chart;
|
||||||
using WacK.Data.Mer;
|
using WacK.Data.Mer;
|
||||||
using WacK.Things.TunnelObjects;
|
using WacK.Things.TunnelObjects;
|
||||||
@@ -50,7 +51,13 @@ namespace WacK.Scenes
|
|||||||
|
|
||||||
// base scroll speed, which we can apply multipliers on
|
// base scroll speed, which we can apply multipliers on
|
||||||
public static readonly float BASE_PIXELS_PER_SECOND = 800;
|
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()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -94,34 +101,6 @@ namespace WacK.Scenes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void RealizeHolds(NoteHold note)
|
|
||||||
// {
|
|
||||||
// List<Vector2> 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)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
var nPos = noteDisplay.Position;
|
var nPos = noteDisplay.Position;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace WacK.Things.TunnelObjects
|
|||||||
segmentsNode.AddChild(n);
|
segmentsNode.AddChild(n);
|
||||||
segments.Add(n);
|
segments.Add(n);
|
||||||
n.Name = i.ToString();
|
n.Name = i.ToString();
|
||||||
n.SetPosition(new Vector2(i * 1920 / 60, 0));
|
n.SetPosition(new Vector2(i * Constants.BASE_2D_RESOLUTION / 60, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using WacK.Configuration;
|
||||||
using WacK.Data.Chart;
|
using WacK.Data.Chart;
|
||||||
using WacK.Scenes;
|
using WacK.Scenes;
|
||||||
|
|
||||||
@@ -47,8 +49,7 @@ namespace WacK.Things.TunnelObjects
|
|||||||
|
|
||||||
private Polygon2D CreateSegment(NotePlay origin, NotePlay destination)
|
private Polygon2D CreateSegment(NotePlay origin, NotePlay destination)
|
||||||
{
|
{
|
||||||
Vector2I textureSize = new(1920, 1920);
|
float minuteSize = Constants.BASE_2D_RESOLUTION / 60;
|
||||||
float minuteSize = textureSize.X / 60;
|
|
||||||
|
|
||||||
var length = Play.scrollPxPerSec * (float)(destination.time - origin.time);
|
var length = Play.scrollPxPerSec * (float)(destination.time - origin.time);
|
||||||
var verts = new Vector2[4];
|
var verts = new Vector2[4];
|
||||||
|
|||||||
@@ -20,13 +20,18 @@ namespace WacK.Things.TunnelObjects
|
|||||||
pos += 1;
|
pos += 1;
|
||||||
size -= 2;
|
size -= 2;
|
||||||
}
|
}
|
||||||
|
else if (size >= 60)
|
||||||
|
{
|
||||||
|
size = 60;
|
||||||
|
// remove padding
|
||||||
|
}
|
||||||
|
|
||||||
var nPos = Position;
|
var nPos = Position;
|
||||||
nPos.X = pos * (1920f/60) - 12;
|
nPos.X = pos * (Constants.BASE_2D_RESOLUTION/60) - 12;
|
||||||
Position = nPos;
|
Position = nPos;
|
||||||
|
|
||||||
var nSize = Size;
|
var nSize = Size;
|
||||||
nSize.X = size * (1920f/60) + 24;
|
nSize.X = size * (Constants.BASE_2D_RESOLUTION/60) + 24;
|
||||||
Size = nSize;
|
Size = nSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ using System;
|
|||||||
|
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
using WacK.Configuration;
|
|
||||||
|
|
||||||
namespace WacK
|
namespace WacK
|
||||||
{
|
{
|
||||||
public static class Util
|
public static class Util
|
||||||
@@ -110,22 +108,6 @@ namespace WacK
|
|||||||
return 60f / tempo * beatsPerMeasure * ((float)measure + (float)beat / 1920f);
|
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)
|
public static string DifficultyValueToString(float diffPoint)
|
||||||
{
|
{
|
||||||
return Mathf.FloorToInt(diffPoint).ToString() + (diffPoint > Mathf.Floor(diffPoint) ? "+" : "");
|
return Mathf.FloorToInt(diffPoint).ToString() + (diffPoint > Mathf.Floor(diffPoint) ? "+" : "");
|
||||||
|
|||||||
Reference in New Issue
Block a user