From 6e5171b766867f73bf5496956f17d631f3fa0557 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 1 May 2024 22:39:13 -0400 Subject: [PATCH] Moved scroll speed to an instance variable in PlayState (for da modders :P) --- source/funkin/play/PlayState.hx | 15 ++++++++++++++- source/funkin/play/notes/Strumline.hx | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f5d139fa2..58767d267 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -216,6 +216,16 @@ class PlayState extends MusicBeatSubState */ public var playbackRate:Float = 1.0; + /** + * The scroll speed on the player's strumline. + */ + public var playerScrollSpeed:Float = 1.0; + + /** + * The scroll speed on the opponent's strumline. + */ + public var opponentScrollSpeed:Float = 1.0; + /** * An empty FlxObject contained in the scene. * The current gameplay camera will always follow this object. Tween its position to move the camera smoothly. @@ -869,6 +879,9 @@ class PlayState extends MusicBeatSubState playerStrumline.clean(); opponentStrumline.clean(); + playerScrollSpeed = currentChart?.scrollSpeed ?? 1.0; + opponentScrollSpeed = currentChart?.scrollSpeed ?? 1.0; + // Delete all notes and reset the arrays. regenNoteData(); @@ -1455,7 +1468,7 @@ class PlayState extends MusicBeatSubState */ function danceOnBeat():Void { - if (currentStage == null) return; + if (currentStage == null || Conductor.instance == null) return; // TODO: Add HEY! song events to Tutorial. if (Conductor.instance.currentBeat % 16 == 15 diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 6a18f17d5..59dabec3b 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -283,7 +283,7 @@ class Strumline extends FlxSpriteGroup // var vwoosh:Float = (strumTime < Conductor.songPosition) && vwoosh ? 2.0 : 1.0; // ^^^ commented this out... do NOT make it move faster as it moves offscreen! var vwoosh:Float = 1.0; - var scrollSpeed:Float = PlayState.instance?.currentChart?.scrollSpeed ?? 1.0; + var scrollSpeed:Float = (isPlayer ? PlayState.instance?.playerScrollSpeed : PlayState.instance?.opponentScrollSpeed) ?? 1.0; return Constants.PIXELS_PER_MS * (conductorInUse.songPosition - strumTime - Conductor.instance.inputOffset) * scrollSpeed * vwoosh * (Preferences.downscroll ? 1 : -1);