From b32c4a751897b3c49696b8f6c0a751cc7edd8566 Mon Sep 17 00:00:00 2001 From: JordanSantiagoYT Date: Thu, 26 Oct 2023 15:23:01 -0400 Subject: [PATCH] YES added another window name suffix that updates based on if your JSE version is outdated, i'll fix the outdated state tomorrow (when JSE 1.13.0 releases!) made the windownamesuffix update based on which state you're in FINALLY fixed the Machine Gun Options bug on Android builds (turns out Stefan/MaysLastPlay forgot to make it remove the current virtualpad when you opened one of the menus) Gave different exit choices fixed a null object reference with Showcase Mode & scoreTxt Size temporarily disabled the results screen in story mode, as it appears to popup after the first song --- source/CreditsState.hx | 4 ++- source/FlashingState.hx | 2 ++ source/FreeplayState.hx | 2 ++ source/MainMenuState.hx | 3 +- source/MusicBeatState.hx | 3 +- source/OutdatedState.hx | 2 ++ source/PauseSubState.hx | 57 +++++++++++++++++++++++++++++-- source/PlayState.hx | 10 +++--- source/TitleState.hx | 2 ++ source/options/BaseOptionsMenu.hx | 2 +- source/options/OptionsState.hx | 21 ++++++++++++ 11 files changed, 95 insertions(+), 13 deletions(-) diff --git a/source/CreditsState.hx b/source/CreditsState.hx index 8e81d8eab4a..928a49cd210 100644 --- a/source/CreditsState.hx +++ b/source/CreditsState.hx @@ -42,9 +42,11 @@ class CreditsState extends MusicBeatState Paths.clearStoredMemory(); Paths.clearUnusedMemory(); + MusicBeatState.windowNameSuffix = " - Credits"; + #if desktop // Updating Discord Rich Presence - DiscordClient.changePresence("In the Menus", null); + DiscordClient.changePresence("Viewing the Credits", null); #end persistentUpdate = true; diff --git a/source/FlashingState.hx b/source/FlashingState.hx index 83b60fb8fe7..03d3a008fc8 100644 --- a/source/FlashingState.hx +++ b/source/FlashingState.hx @@ -21,6 +21,8 @@ class FlashingState extends MusicBeatState Paths.clearStoredMemory(); Paths.clearUnusedMemory(); + MusicBeatState.windowNameSuffix = " - Flashing Lights Warning Screen"; + super.create(); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index dcafcb7772f..52897beef70 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -194,6 +194,8 @@ class FreeplayState extends MusicBeatState changeSelection(); changeDiff(); + MusicBeatState.windowNameSuffix = " - Freeplay Menu"; + var swag:Alphabet = new Alphabet(1, 0, "swag"); // JUST DOIN THIS SHIT FOR TESTING!!! diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 2f846d5a5a3..ef7de19e39c 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -25,7 +25,7 @@ using StringTools; class MainMenuState extends MusicBeatState { - public static var psychEngineJSVersion:String = '1.12.0'; //This is also used for Discord RPC + public static var psychEngineJSVersion:String = '1.13.0'; //This is also used for Discord RPC public static var psychEngineVersion:String = '0.6.3'; //This is also used for Discord RPC public static var curSelected:Int = 0; @@ -50,6 +50,7 @@ class MainMenuState extends MusicBeatState override function create() { + MusicBeatState.windowNameSuffix = " - Main Menu"; Paths.clearStoredMemory(); Paths.clearUnusedMemory(); diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index cb5f498fd5e..1d20dcb613b 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -140,6 +140,7 @@ class MusicBeatState extends FlxUIState } public static var windowNameSuffix:String = ""; + public static var windowNameSuffix2:String = ""; //changes to "Outdated!" if the version of the engine is outdated public static var windowNamePrefix:String = "Friday Night Funkin': JS Engine"; override public function new() { @@ -185,7 +186,7 @@ class MusicBeatState extends FlxUIState FlxG.autoPause = ClientPrefs.autoPause; super.update(elapsed); - Application.current.window.title = windowNamePrefix + windowNameSuffix; + Application.current.window.title = windowNamePrefix + windowNameSuffix + windowNameSuffix2; } private function updateSection():Void diff --git a/source/OutdatedState.hx b/source/OutdatedState.hx index cdd9cad2a7e..ef92d897f7d 100644 --- a/source/OutdatedState.hx +++ b/source/OutdatedState.hx @@ -24,6 +24,8 @@ class OutdatedState extends MusicBeatState Paths.clearStoredMemory(); Paths.clearUnusedMemory(); + MusicBeatState.windowNameSuffix2 = " (Outdated!)"; + super.create(); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 580d4c3a56a..c935eeb451a 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -22,7 +22,8 @@ class PauseSubState extends MusicBeatSubstate var grpMenuShit:FlxTypedGroup; var menuItems:Array = []; - var menuItemsOG:Array = ['Resume', 'Restart Song', 'Change Gameplay Settings', 'Change Difficulty', 'Options', 'Exit to menu']; + var menuItemsOG:Array = ['Resume', 'Restart Song', 'Change Gameplay Settings', 'Change Difficulty', 'Options', 'Exit']; + var menuItemsExit:Array = [(PlayState.isStoryMode ? 'Exit to Story Menu' : 'Exit to Freeplay'), 'Exit to Main Menu', 'Exit Game', 'Back']; var difficultyChoices = []; var curSelected:Int = 0; @@ -233,7 +234,25 @@ class PauseSubState extends MusicBeatSubstate menuItems = menuItemsOG; regenMenu(); } + if (menuItems == difficultyChoices) + { + if(menuItems.length - 1 != curSelected && difficultyChoices.contains(daSelected)) { + var name:String = PlayState.SONG.song; + var poop = Highscore.formatSong(name, curSelected); + PlayState.SONG = Song.loadFromJson(poop, name); + PlayState.storyDifficulty = curSelected; + MusicBeatState.resetState(); + FlxG.sound.music.volume = 0; + PlayState.changedDifficulty = true; + PlayState.chartingMode = false; + return; + } + + menuItems = menuItemsOG; + regenMenu(); + } + if (menuItems == menuItemsOG) { switch (daSelected) { case "Resume": @@ -291,20 +310,51 @@ class PauseSubState extends MusicBeatSubstate FlxTween.tween(FlxG.sound.music, {volume: 1}, 0.8); FlxG.sound.music.time = pauseMusic.time; } - case "Exit to menu": + case "Exit": + menuItems = menuItemsExit; + if (FlxG.random.bool(0.1)) menuItemsExit[0] = 'Exit To Your Mother'; + regenMenu(); + } + } + if (menuItems == menuItemsExit) { + switch(daSelected) { + case "Exit to Story Menu", "Exit to Freeplay": PlayState.deathCounter = 0; PlayState.seenCutscene = false; WeekData.loadTheFirstEnabledMod(); if(PlayState.isStoryMode) { MusicBeatState.switchState(new StoryMenuState()); - } else { + } else if (!PlayState.isStoryMode) { MusicBeatState.switchState(new FreeplayState()); } PlayState.cancelMusicFadeTween(); FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic)); PlayState.changedDifficulty = false; PlayState.chartingMode = false; + case "Exit to Main Menu": + PlayState.deathCounter = 0; + PlayState.seenCutscene = false; + + WeekData.loadTheFirstEnabledMod(); + if(PlayState.isStoryMode) { + MusicBeatState.switchState(new MainMenuState()); + } + PlayState.cancelMusicFadeTween(); + FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic)); + PlayState.changedDifficulty = false; + PlayState.chartingMode = false; + case "Exit Game": + trace ("Exiting game..."); + openfl.system.System.exit(0); + case "Back": + menuItems = menuItemsOG; + regenMenu(); + case "Exit to your Mother": + trace ("YO MAMA"); + var aLittleCrashing:FlxSprite = null; + aLittleCrashing.destroy(); + } } } } @@ -341,6 +391,7 @@ class PauseSubState extends MusicBeatSubstate override function destroy() { pauseMusic.destroy(); + if (PlayState != null) MusicBeatState.windowNameSuffix = " - " + PlayState.SONG.song + " " + (PlayState.isStoryMode ? "(Story Mode)" : "(Freeplay)"); super.destroy(); } diff --git a/source/PlayState.hx b/source/PlayState.hx index 4007b68ca08..0d0d38606f3 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2188,7 +2188,7 @@ class PlayState extends MusicBeatState dadGroup.destroy(); boyfriendGroup.destroy(); } - if (ClientPrefs.scoreTxtSize > 0 && scoreTxt != null) scoreTxt.size = ClientPrefs.scoreTxtSize; + if (ClientPrefs.scoreTxtSize > 0 && scoreTxt != null && !ClientPrefs.showcaseMode && !ClientPrefs.hideScore) scoreTxt.size = ClientPrefs.scoreTxtSize; if (!ClientPrefs.hideScore) updateScore(); judgementCounter = new FlxText(0, FlxG.height / 2 - (ClientPrefs.hudType != 'Box Funkin' || ClientPrefs.hudType != "Mic'd Up" ? 80 : 350), 0, "", 20); @@ -7209,11 +7209,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi if(FlxTransitionableState.skipNextTransIn) { CustomFadeTransition.nextCamera = null; } - if (ClientPrefs.resultsScreen) - openSubState(new ResultsScreenSubState([marvs, sicks, goods, bads, shits], Std.int(campaignScore), songMisses, - Highscore.floorDecimal(ratingPercent * 100, 2), ratingName + (' [' + ratingFC + '] '))); - else - MusicBeatState.switchState(new StoryMenuState()); + MusicBeatState.switchState(new StoryMenuState()); //removed results screen from story mode because for some reason it opens the screen after the first song even if the story playlist's length is greater than 0?? // if () if(!ClientPrefs.getGameplaySetting('practice', false) && !ClientPrefs.getGameplaySetting('botplay', false)) { @@ -8297,6 +8293,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT } callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); + if (!ClientPrefs.hideScore && scoreTxtUpdateFrame == 0 && scoreTxt != null) updateScore(); } function noteMissPress(direction:Int = 1):Void //You pressed a key when there was no notes to press for this key @@ -8347,6 +8344,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT vocals.volume = 0; } callOnLuas('noteMissPress', [direction]); + if (!ClientPrefs.hideScore && scoreTxtUpdateFrame == 0 && scoreTxt != null) updateScore(); } var hitsound:FlxSound; diff --git a/source/TitleState.hx b/source/TitleState.hx index 4597205fcb3..978b1caf034 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -89,6 +89,8 @@ class TitleState extends MusicBeatState Paths.clearStoredMemory(); Paths.clearUnusedMemory(); + MusicBeatState.windowNameSuffix = " - Title Screen"; + #if android FlxG.android.preventDefaultKeys = [BACK]; #end diff --git a/source/options/BaseOptionsMenu.hx b/source/options/BaseOptionsMenu.hx index 85340e79a98..45264312032 100644 --- a/source/options/BaseOptionsMenu.hx +++ b/source/options/BaseOptionsMenu.hx @@ -172,7 +172,7 @@ class BaseOptionsMenu extends MusicBeatSubstate if(usesCheckbox) { - if(controls.ACCEPT) + if(controls.ACCEPT #if android || virtualPad.buttonA.justPressed #end) { FlxG.sound.play(Paths.sound('scrollMenu')); curOption.setValue((curOption.getValue() == true) ? false : true); diff --git a/source/options/OptionsState.hx b/source/options/OptionsState.hx index baa201f7e07..39bd94fbfd7 100644 --- a/source/options/OptionsState.hx +++ b/source/options/OptionsState.hx @@ -41,18 +41,39 @@ class OptionsState extends MusicBeatState function openSelectedSubstate(label:String) { switch(label) { case 'Note Colors': + #if android + removeVirtualPad(); + #end openSubState(new options.NotesSubState()); case 'Controls': + #if android + removeVirtualPad(); + #end openSubState(new options.ControlsSubState()); case 'Graphics': + #if android + removeVirtualPad(); + #end openSubState(new options.GraphicsSettingsSubState()); case 'Visuals and UI': + #if android + removeVirtualPad(); + #end openSubState(new options.VisualsUISubState()); case 'Gameplay': + #if android + removeVirtualPad(); + #end openSubState(new options.GameplaySettingsSubState()); case 'Optimization': + #if android + removeVirtualPad(); + #end openSubState(new options.OptimizationSubState()); case 'Adjust Delay and Combo': + #if android + removeVirtualPad(); + #end LoadingState.loadAndSwitchState(new options.NoteOffsetState()); } }