From 647121cd46d9746e5faf8e53ebed4126a18a23c9 Mon Sep 17 00:00:00 2001 From: Rozebud Date: Thu, 30 Jan 2025 08:31:11 -0500 Subject: [PATCH] make camera filters not null & songPlaybackSpeed fixes initialize camera filters to an empty array basically anywhere you can use a script to you dont have to do a null check fuck this stupid song playback speed why must you be so weird --- source/GameOverSubstate.hx | 1 + source/PauseSubState.hx | 1 + source/PlayState.hx | 31 ++++++++++++++++--------------- source/freeplay/FreeplayState.hx | 1 + source/results/ResultsState.hx | 5 +++++ 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index ea7b846b..f914a094 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -33,6 +33,7 @@ class GameOverSubstate extends MusicBeatSubstate camGameOver = new FlxCamera(); camGameOver.zoom = camZoom; + camGameOver.filters = []; FlxG.cameras.add(camGameOver, false); cameras = [camGameOver]; diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index f4b1e6f7..21042b69 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -40,6 +40,7 @@ class PauseSubState extends MusicBeatSubstate camPause = new FlxCamera(); camPause.bgColor.alpha = 0; + camPause.filters = []; FlxG.cameras.add(camPause, false); cameras = [camPause]; diff --git a/source/PlayState.hx b/source/PlayState.hx index 12f8c9ce..fa1d21b6 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -379,14 +379,16 @@ class PlayState extends MusicBeatState canHit = !(Config.ghostTapType > 0); camGame = new FlxCamera(); + camGame.filters = []; + + camOverlay = new FlxCamera(); + camOverlay.bgColor.alpha = 0; + camOverlay.filters = []; camHUD = new FlxCamera(); camHUD.bgColor.alpha = 0; camHUD.filters = [new ShaderFilter(hudShader.shader)]; - camOverlay = new FlxCamera(); - camOverlay.bgColor.alpha = 0; - FlxG.cameras.reset(camGame); FlxG.cameras.add(camOverlay, false); FlxG.cameras.add(camHUD, false); @@ -1488,6 +1490,8 @@ class PlayState extends MusicBeatState if (Binds.justPressed("polymodReload") && !isStoryMode){ FlxG.sound.music.pause(); + vocals.pause(); + if(vocalType == splitVocalTrack){ vocalsOther.pause(); } PolymodHandler.reload(); } @@ -1553,21 +1557,19 @@ class PlayState extends MusicBeatState vocals.pitch = songPlaybackSpeed; if(vocalType == splitVocalTrack){ vocalsOther.pitch = songPlaybackSpeed; } - if (startingSong) - { - if (startedCountdown) - { + if (startingSong){ + if (startedCountdown){ Conductor.songPosition += FlxG.elapsed * 1000; - if (Conductor.songPosition >= 0) + if (Conductor.songPosition >= 0){ startSong(); + } } } - /*else if(inEndingCutscene){ - - }*/ else{ if(previousReportedSongTime != FlxG.sound.music.time){ Conductor.songPosition = FlxG.sound.music.time; + //Failsafe to make sure that the onComplete actually runs because sometimes it would just not run sometimes when I was doing stuff with the song playback speed. + if(inRange(previousReportedSongTime, FlxG.sound.music.length, 1000) && Conductor.songPosition < FlxG.sound.music.length/2 && !songEnded){ FlxG.sound.music.onComplete(); } previousReportedSongTime = FlxG.sound.music.time; } else{ @@ -2385,15 +2387,14 @@ class PlayState extends MusicBeatState } } - override function stepHit() - { + override function stepHit(){ - if((Math.abs(FlxG.sound.music.time - (Conductor.songPosition)) > 20 || (vocalType != noVocalTrack && Math.abs(vocals.time - (Conductor.songPosition)) > 20)) && FlxG.sound.music.playing){ + if((Math.abs(FlxG.sound.music.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed) || (vocalType != noVocalTrack && Math.abs(vocals.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed))) && FlxG.sound.music.playing){ resyncVocals(); } if(vocalType == splitVocalTrack){ - if((Math.abs(vocalsOther.time - (Conductor.songPosition)) > 20) && FlxG.sound.music.playing){ + if((Math.abs(vocalsOther.time - (Conductor.songPosition)) > (20 * songPlaybackSpeed)) && FlxG.sound.music.playing){ resyncVocals(); } } diff --git a/source/freeplay/FreeplayState.hx b/source/freeplay/FreeplayState.hx index 244fc7cc..3060fe39 100644 --- a/source/freeplay/FreeplayState.hx +++ b/source/freeplay/FreeplayState.hx @@ -150,6 +150,7 @@ class FreeplayState extends MusicBeatState } camMenu = new FlxCamera(); + camMenu.filters = []; camFreeplay = new FlxCamera(); camFreeplay.bgColor.alpha = 0; diff --git a/source/results/ResultsState.hx b/source/results/ResultsState.hx index cafa9b03..e2332744 100644 --- a/source/results/ResultsState.hx +++ b/source/results/ResultsState.hx @@ -144,20 +144,25 @@ class ResultsState extends FlxUIStateExt persistentUpdate = persistentDraw = true; camBg = new FlxCamera(); + camBg.filters = []; camScroll = new FlxCamera(-50, -50, 1280 + 100, 720 + 100); camScroll.bgColor = FlxColor.TRANSPARENT; camScroll.angle = -3.8; + camScroll.filters = []; camCharacter = new FlxCamera(); camCharacter.bgColor = FlxColor.TRANSPARENT; + camCharacter.filters = []; camTitle = new FlxCamera(-50, -50, 1280 + 100, 720 + 100); camTitle.bgColor = FlxColor.TRANSPARENT; camTitle.angle = -3.8; + camTitle.filters = []; camUi = new FlxCamera(); camUi.bgColor = FlxColor.TRANSPARENT; + camUi.filters = []; FlxG.cameras.add(camBg, false); FlxG.cameras.add(camScroll, false);