diff --git a/source/ClientPrefs.hx b/source/ClientPrefs.hx index a66f7e3682b..c776a392540 100644 --- a/source/ClientPrefs.hx +++ b/source/ClientPrefs.hx @@ -127,7 +127,6 @@ class ClientPrefs { //default settings if it can't find a save file containing y public static var ratingPopups:Bool = true; public static var comboPopups:Bool = true; public static var showMS:Bool = false; - public static var songLoading:Bool = true; public static var noSpawnFunc:Bool = false; public static var noHitFuncs:Bool = false; public static var noSkipFuncs:Bool = false; diff --git a/source/PlayState.hx b/source/PlayState.hx index b7274eb82f7..227d1418650 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2561,28 +2561,25 @@ class PlayState extends MusicBeatState { if(time < 0) time = 0; - if (ClientPrefs.songLoading) - { - FlxG.sound.music.pause(); - pauseVocals(); + FlxG.sound.music.pause(); + pauseVocals(); - FlxG.sound.music.time = time; - FlxG.sound.music.play(); - FlxG.sound.music.pitch = playbackRate; - if (ffmpegMode) FlxG.sound.music.volume = 0; + FlxG.sound.music.time = time; + FlxG.sound.music.play(); + FlxG.sound.music.pitch = playbackRate; + if (ffmpegMode) FlxG.sound.music.volume = 0; - if (Conductor.songPosition <= vocals.length) - { - setVocalsTime(time); - #if FLX_PITCH - vocals.pitch = playbackRate; - opponentVocals.pitch = playbackRate; - #end - } - vocals.play(); - opponentVocals.play(); - if (ffmpegMode) vocals.volume = opponentVocals.volume = 0; + if (Conductor.songPosition <= vocals.length) + { + setVocalsTime(time); + #if FLX_PITCH + vocals.pitch = playbackRate; + opponentVocals.pitch = playbackRate; + #end } + vocals.play(); + opponentVocals.play(); + if (ffmpegMode) vocals.volume = opponentVocals.volume = 0; Conductor.songPosition = time; songTime = time; clearNotesBefore(time); @@ -2603,25 +2600,22 @@ class PlayState extends MusicBeatState { startingSong = false; - if (ClientPrefs.songLoading) - { - var diff:String = (SONG.specialAudioName.length > 1 ? SONG.specialAudioName : CoolUtil.difficultyString()).toLowerCase(); - @:privateAccess - if (!ffmpegMode) { - FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song, diff), 1, false); - FlxG.sound.music.onComplete = finishSong.bind(); - } else { - FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song, diff), 0, false); - vocals.volume = 0; - opponentVocals.play(); - } - if (!ffmpegMode && (!trollingMode || SONG.song.toLowerCase() != 'anti-cheat-song')) - FlxG.sound.music.onComplete = finishSong.bind(); - FlxG.sound.music.pitch = playbackRate; - vocals.play(); + var diff:String = (SONG.specialAudioName.length > 1 ? SONG.specialAudioName : CoolUtil.difficultyString()).toLowerCase(); + @:privateAccess + if (!ffmpegMode) { + FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song, diff), 1, false); + FlxG.sound.music.onComplete = finishSong.bind(); + } else { + FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song, diff), 0, false); + vocals.volume = 0; opponentVocals.play(); - vocals.pitch = opponentVocals.pitch = playbackRate; } + if (!ffmpegMode && (!trollingMode || SONG.song.toLowerCase() != 'anti-cheat-song')) + FlxG.sound.music.onComplete = finishSong.bind(); + FlxG.sound.music.pitch = playbackRate; + vocals.play(); + opponentVocals.play(); + vocals.pitch = opponentVocals.pitch = playbackRate; if(startOnTime > 0) { @@ -2631,11 +2625,8 @@ class PlayState extends MusicBeatState if(paused) { //trace('Oopsie doopsie! Paused sound'); - if (ClientPrefs.songLoading) - { - FlxG.sound.music.pause(); - pauseVocals(); - } + FlxG.sound.music.pause(); + pauseVocals(); } curTime = Conductor.songPosition - ClientPrefs.noteOffset; songPercent = (curTime / songLength); @@ -2643,8 +2634,8 @@ class PlayState extends MusicBeatState stagesFunc(function(stage:BaseStage) stage.startSong()); // Song duration in a float, useful for the time left feature - if (ClientPrefs.lengthIntro && ClientPrefs.songLoading) FlxTween.tween(this, {songLength: FlxG.sound.music.length}, 1, {ease: FlxEase.expoOut}); - if (!ClientPrefs.lengthIntro && ClientPrefs.songLoading) songLength = FlxG.sound.music.length; //so that the timer won't just appear as 0 + if (ClientPrefs.lengthIntro) FlxTween.tween(this, {songLength: FlxG.sound.music.length}, 1, {ease: FlxEase.expoOut}); + if (!ClientPrefs.lengthIntro) songLength = FlxG.sound.music.length; //so that the timer won't just appear as 0 if (ClientPrefs.timeBarType != 'Disabled') { timeBar.scale.x = 0.01; timeBarBG.scale.x = 0.01; @@ -2701,8 +2692,8 @@ class PlayState extends MusicBeatState if (ting2 != 0) songSpeed = ogSongSpeed / playbackRate; - if (ClientPrefs.songLoading) setVocalsTime(Conductor.songPosition); - if (ClientPrefs.songLoading && !ffmpegMode) resyncVocals(); + setVocalsTime(Conductor.songPosition); + if (!ffmpegMode) resyncVocals(); }}); } @@ -2738,28 +2729,25 @@ class PlayState extends MusicBeatState if (SONG.windowName != null && SONG.windowName != '') MusicBeatState.windowNamePrefix = SONG.windowName; - if (ClientPrefs.songLoading) + vocals = new FlxSound(); + opponentVocals = new FlxSound(); + try { - vocals = new FlxSound(); - opponentVocals = new FlxSound(); - try + if (SONG.needsVoices) { - if (SONG.needsVoices) - { - var playerVocals = Paths.voices(curSong, diff, (boyfriend.vocalsFile == null || boyfriend.vocalsFile.length < 1) ? 'Player' : boyfriend.vocalsFile); - vocals.loadEmbedded(playerVocals != null ? playerVocals : Paths.voices(curSong, diff)); - - var oppVocals = Paths.voices(curSong, diff, (dad.vocalsFile == null || dad.vocalsFile.length < 1) ? 'Opponent' : dad.vocalsFile); - if(oppVocals != null) opponentVocals.loadEmbedded(oppVocals); - } + var playerVocals = Paths.voices(curSong, diff, (boyfriend.vocalsFile == null || boyfriend.vocalsFile.length < 1) ? 'Player' : boyfriend.vocalsFile); + vocals.loadEmbedded(playerVocals != null ? playerVocals : Paths.voices(curSong, diff)); + + var oppVocals = Paths.voices(curSong, diff, (dad.vocalsFile == null || dad.vocalsFile.length < 1) ? 'Opponent' : dad.vocalsFile); + if(oppVocals != null) opponentVocals.loadEmbedded(oppVocals); } - catch(e) {} - - vocals.pitch = opponentVocals.pitch = playbackRate; - FlxG.sound.list.add(vocals); - FlxG.sound.list.add(opponentVocals); - FlxG.sound.list.add(new FlxSound().loadEmbedded(Paths.inst(PlayState.SONG.song, diff))); } + catch(e) {} + + vocals.pitch = opponentVocals.pitch = playbackRate; + FlxG.sound.list.add(vocals); + FlxG.sound.list.add(opponentVocals); + FlxG.sound.list.add(new FlxSound().loadEmbedded(Paths.inst(PlayState.SONG.song, diff))); final noteData:Array = SONG.notes; @@ -3134,7 +3122,7 @@ class PlayState extends MusicBeatState if (!isStoryMode && !skipArrowStartTween) { babyArrow.alpha = 0; - FlxTween.tween(babyArrow, {alpha: targetAlpha}, 1/(SONG.bpm/240) / playbackRate, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i) / (SONG.bpm/240) / playbackRate}); + FlxTween.tween(babyArrow, {alpha: targetAlpha}, 1/(Conductor.bpm/240) / playbackRate, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i) / (Conductor.bpm/240) / playbackRate}); } else { @@ -3187,10 +3175,8 @@ class PlayState extends MusicBeatState { if (FlxG.sound.music != null) { - if (ClientPrefs.songLoading) { - FlxG.sound.music.pause(); - pauseVocals(); - } + FlxG.sound.music.pause(); + pauseVocals(); } FlxTimer.globalManager.forEach(function(tmr:FlxTimer) if(!tmr.finished) tmr.active = false); FlxTween.globalManager.forEach(function(twn:FlxTween) if(!twn.finished) twn.active = false); @@ -3982,7 +3968,7 @@ class PlayState extends MusicBeatState if(!endingSong && !startingSong) { if (FlxG.keys.justPressed.ONE) { KillNotes(); - if (ClientPrefs.songLoading) FlxG.sound.music.onComplete(); + FlxG.sound.music.onComplete(); } if(FlxG.keys.justPressed.TWO) { //Go 10 seconds into the future :O setSongTime(Conductor.songPosition + 10000); @@ -4086,7 +4072,7 @@ class PlayState extends MusicBeatState persistentDraw = true; paused = true; - if(FlxG.sound.music != null && ClientPrefs.songLoading) { + if(FlxG.sound.music != null) { FlxG.sound.music.pause(); pauseVocals(); } @@ -4164,12 +4150,9 @@ class PlayState extends MusicBeatState paused = true; - if (ClientPrefs.songLoading) - { - vocals.stop(); - opponentVocals.stop(); - FlxG.sound.music.stop(); - } + vocals.stop(); + opponentVocals.stop(); + FlxG.sound.music.stop(); persistentUpdate = false; persistentDraw = false; @@ -4371,9 +4354,9 @@ class PlayState extends MusicBeatState fakelength *= (Math.isNaN(fakelength) ? 1 : 1000); //don't multiply if value1 is null, but do if value1 is not null var doTween:Bool = value2 == "true" ? true : false; if (Math.isNaN(fakelength)) - if (ClientPrefs.songLoading) fakelength = FlxG.sound.music.length; + fakelength = FlxG.sound.music.length; if (doTween = true) FlxTween.tween(this, {songLength: fakelength}, 1, {ease: FlxEase.expoOut}); - if (doTween = true && ClientPrefs.songLoading && (Math.isNaN(fakelength))) FlxTween.tween(this, {songLength: FlxG.sound.music.length}, 1, {ease: FlxEase.expoOut}); + if (doTween = true && (Math.isNaN(fakelength))) FlxTween.tween(this, {songLength: FlxG.sound.music.length}, 1, {ease: FlxEase.expoOut}); songLength = fakelength; case 'Add Camera Zoom': @@ -4774,10 +4757,8 @@ class PlayState extends MusicBeatState { if (!trollingMode && SONG.song.toLowerCase() != 'anti-cheat-song') { updateTime = false; - if (ClientPrefs.songLoading) { - FlxG.sound.music.volume = 0; - vocals.volume = opponentVocals.volume = 0; - } + FlxG.sound.music.volume = 0; + vocals.volume = opponentVocals.volume = 0; FlxG.mouse.unload(); // just in case you changed it beforehand pauseVocals(); if(!ffmpegMode){ @@ -4971,8 +4952,8 @@ class PlayState extends MusicBeatState { if (process != null) stopRender(); PlayState.instance.paused = true; // For lua - if (ClientPrefs.songLoading) FlxG.sound.music.volume = 0; - if (ClientPrefs.songLoading) vocals.volume = opponentVocals.volume = 0; + FlxG.sound.music.volume = 0; + vocals.volume = opponentVocals.volume = 0; if(noTrans) { @@ -5265,7 +5246,7 @@ class PlayState extends MusicBeatState { //more accurate hit time for the ratings? var lastTime:Float = Conductor.songPosition; - if (ClientPrefs.songLoading) Conductor.songPosition = FlxG.sound.music.time; + Conductor.songPosition = FlxG.sound.music.time; var canMiss:Bool = !ClientPrefs.ghostTapping; @@ -5483,7 +5464,7 @@ class PlayState extends MusicBeatState } songMisses += 1 * polyphony; - if (SONG.needsVoices && ClientPrefs.songLoading && !ffmpegMode) + if (SONG.needsVoices && !ffmpegMode) if (opponentChart && opponentVocals != null && opponentVocals.volume != 0) opponentVocals.volume = 0; else if (!opponentChart && vocals.volume != 0 || vocals.volume != 0) vocals.volume = 0; if(!practiceMode) songScore -= 10 * Std.int(polyphony); @@ -5810,7 +5791,7 @@ class PlayState extends MusicBeatState } note.wasGoodHit = true; if (ClientPrefs.noteSplashes && note.isSustainNote && splashesPerFrame[3] <= 4) spawnHoldSplashOnNote(note); - if (SONG.needsVoices && ClientPrefs.songLoading && !ffmpegMode) + if (SONG.needsVoices && !ffmpegMode) if (opponentChart && opponentVocals != null && opponentVocals.volume != 1) opponentVocals.volume = 1; else if (!opponentChart && vocals.volume != 1 || vocals.volume != 1) vocals.volume = 1; @@ -5874,7 +5855,7 @@ class PlayState extends MusicBeatState } if (!ClientPrefs.noSkipFuncs) callOnLuas((oppTrigger ? 'opponentNoteSkip' : 'goodNoteSkip'), [null, Math.abs(noteAlt.noteData), noteAlt.noteType, noteAlt.isSustainNote]); health += noteAlt.hitHealth * healthGain * polyphony; - if (ClientPrefs.songLoading && !ffmpegMode) (opponentChart ? opponentVocals : vocals).volume = 1; + if (!ffmpegMode) (opponentChart ? opponentVocals : vocals).volume = 1; } return; } @@ -6218,7 +6199,7 @@ class PlayState extends MusicBeatState cameraSpeed = 1; } } - if (!ffmpegMode && ClientPrefs.songLoading && playbackRate < 256) //much better resync code, doesn't just resync every step!! + if (!ffmpegMode && playbackRate < 256) //much better resync code, doesn't just resync every step!! { var timeSub:Float = Conductor.songPosition - Conductor.offset; var syncTime:Float = 20 * playbackRate; diff --git a/source/editors/ChartingState.hx b/source/editors/ChartingState.hx index 5ccc3e37735..f0500175122 100644 --- a/source/editors/ChartingState.hx +++ b/source/editors/ChartingState.hx @@ -305,6 +305,8 @@ class ChartingState extends MusicBeatState DiscordClient.changePresence("Chart Editor - Charting " + StringTools.replace(_song.song, '-', ' '), '${FlxStringUtil.formatMoney(CoolUtil.getNoteAmount(_song), false)} Notes'); #end + FlxG.autoPause = true; // this might help with some issues + vortex = FlxG.save.data.chart_vortex; showTheGrid = FlxG.save.data.showGrid; idleMusicAllow = FlxG.save.data.idleMusicAllowed; @@ -4466,6 +4468,12 @@ class ChartingState extends MusicBeatState super.destroy(); } + + override function startOutro(onOutroComplete:()->Void):Void + { + FlxG.autoPause = ClientPrefs.autoPause; + onOutroComplete(); + } } class AttachedFlxText extends FlxText diff --git a/source/editors/EditorPlayState.hx b/source/editors/EditorPlayState.hx index 803e79eaf81..68ed4a8b99e 100644 --- a/source/editors/EditorPlayState.hx +++ b/source/editors/EditorPlayState.hx @@ -217,32 +217,29 @@ class EditorPlayState extends MusicBeatState var boyfriendVocals:String = loadCharacterFile(PlayState.SONG.player1).vocals_file; var dadVocals:String = loadCharacterFile(PlayState.SONG.player2).vocals_file; - if (ClientPrefs.songLoading) + vocals = new FlxSound(); + opponentVocals = new FlxSound(); + try { - vocals = new FlxSound(); - opponentVocals = new FlxSound(); - try + if (songData.needsVoices) { - if (songData.needsVoices) - { - var playerVocals = Paths.voices(songData.song, diff, (boyfriendVocals == null || boyfriendVocals.length < 1) ? 'Player' : boyfriendVocals); - vocals.loadEmbedded(playerVocals != null ? playerVocals : Paths.voices(songData.song, diff)); - - var oppVocals = Paths.voices(songData.song, diff, (dadVocals == null || dadVocals.length < 1) ? 'Opponent' : dadVocals); - if(oppVocals != null) opponentVocals.loadEmbedded(oppVocals); - } + var playerVocals = Paths.voices(songData.song, diff, (boyfriendVocals == null || boyfriendVocals.length < 1) ? 'Player' : boyfriendVocals); + vocals.loadEmbedded(playerVocals != null ? playerVocals : Paths.voices(songData.song, diff)); + + var oppVocals = Paths.voices(songData.song, diff, (dadVocals == null || dadVocals.length < 1) ? 'Opponent' : dadVocals); + if(oppVocals != null) opponentVocals.loadEmbedded(oppVocals); } - catch(e:Dynamic) {} + } + catch(e:Dynamic) {} - vocals.volume = 0; - opponentVocals.volume = 0; + vocals.volume = 0; + opponentVocals.volume = 0; - FlxG.sound.list.add(vocals); - FlxG.sound.list.add(opponentVocals); - inst = new FlxSound().loadEmbedded(Paths.inst(songData.song, diff)); - FlxG.sound.list.add(inst); - FlxG.sound.music.volume = 0; - } + FlxG.sound.list.add(vocals); + FlxG.sound.list.add(opponentVocals); + inst = new FlxSound().loadEmbedded(Paths.inst(songData.song, diff)); + FlxG.sound.list.add(inst); + FlxG.sound.music.volume = 0; var currentBPMLol:Float = Conductor.bpm; for (section in songData.notes) { diff --git a/source/options/OptimizationSubState.hx b/source/options/OptimizationSubState.hx index 0b4f2841ac5..3a1b363cb0f 100644 --- a/source/options/OptimizationSubState.hx +++ b/source/options/OptimizationSubState.hx @@ -64,13 +64,6 @@ class OptimizationSubState extends BaseOptionsMenu false); addOption(option); - var option:Option = new Option('Load Songs', - "If unchecked, PlayState songs won't be loaded.\n(Breaks a few of the Visuals & UI things, so be careful!)", - 'songLoading', - 'bool', - true); - addOption(option); - var option:Option = new Option('Disable onSpawnNote Lua Calls', "If checked, the game will not call onSpawnNote when a note is spawned.\nIf you have a script that uses that, maybe leave it on.", 'noSpawnFunc',