From 1c1974bae5e41a3aa04ff608b75e873725ebc16f Mon Sep 17 00:00:00 2001
From: Cameron Taylor <cameron.taylor.ninja@gmail.com>
Date: Wed, 6 Jul 2022 18:45:27 -0400
Subject: [PATCH] better beat visualizations

---
 source/funkin/LatencyState.hx | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/source/funkin/LatencyState.hx b/source/funkin/LatencyState.hx
index 33855321e..9760e4b2d 100644
--- a/source/funkin/LatencyState.hx
+++ b/source/funkin/LatencyState.hx
@@ -18,6 +18,7 @@ class LatencyState extends MusicBeatSubstate
 	var blocks:FlxGroup;
 
 	var songPosVis:FlxSprite;
+	var songVisFollow:FlxSprite;
 
 	var beatTrail:FlxSprite;
 
@@ -45,6 +46,9 @@ class LatencyState extends MusicBeatSubstate
 			add(beatTick);
 		}
 
+		songVisFollow = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.YELLOW);
+		add(songVisFollow);
+
 		songPosVis = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.RED);
 		add(songPosVis);
 
@@ -96,14 +100,26 @@ class LatencyState extends MusicBeatSubstate
 
 	override function update(elapsed:Float)
 	{
+		if (FlxG.keys.justPressed.SPACE)
+		{
+			if (FlxG.sound.music.playing)
+				FlxG.sound.music.pause();
+			else
+				FlxG.sound.music.resume();
+		}
+
+		if (FlxG.keys.pressed.D)
+			FlxG.sound.music.time += 1000 * FlxG.elapsed;
+
+		Conductor.songPosition = FlxG.sound.music.time - Conductor.offset;
+
 		songPosVis.x = songPosToX(Conductor.songPosition);
+		songVisFollow.x = songPosToX(Conductor.songPosition - Conductor.visualOffset);
 
 		offsetText.text = "Offset: " + Conductor.visualOffset + "ms";
 		offsetText.text += "\ncurStep: " + curStep;
 		offsetText.text += "\ncurBeat: " + curBeat;
 
-		Conductor.songPosition = FlxG.sound.music.time - Conductor.offset;
-
 		var multiply:Float = 10;
 
 		if (FlxG.keys.pressed.SHIFT)
@@ -119,12 +135,12 @@ class LatencyState extends MusicBeatSubstate
 			Conductor.visualOffset -= 1 * multiply;
 		}
 
-		if (FlxG.keys.justPressed.SPACE)
-		{
-			FlxG.sound.music.stop();
+		/* if (FlxG.keys.justPressed.SPACE)
+			{
+				FlxG.sound.music.stop();
 
-			FlxG.resetState();
-		}
+				FlxG.resetState();
+		}*/
 
 		noteGrp.forEach(function(daNote:Note)
 		{