From 342782c3d379d67127d1ef8acc5662fdfc370ae6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 28 Mar 2024 22:33:50 -0400 Subject: [PATCH 1/3] Fix issue with pink screen when moving from PlayState->Freeplay->Main Menu --- source/funkin/play/GameOverSubState.hx | 4 ++-- source/funkin/play/PauseSubState.hx | 3 ++- source/funkin/play/PlayState.hx | 17 ++++------------- source/funkin/play/ResultState.hx | 2 +- source/funkin/ui/freeplay/FreeplayState.hx | 19 +++++++++++++++++-- source/funkin/ui/mainmenu/MainMenuState.hx | 5 ++--- source/funkin/ui/title/TitleState.hx | 12 ------------ 7 files changed, 28 insertions(+), 34 deletions(-) diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index a1796e912..652ba1484 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -238,11 +238,11 @@ class GameOverSubState extends MusicBeatSubState } else if (PlayStatePlaylist.isStoryMode) { - FlxG.switchState(() -> new StoryMenuState()); + openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker))); } else { - FlxG.switchState(() -> new FreeplayState()); + openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(sticker))); } } diff --git a/source/funkin/play/PauseSubState.hx b/source/funkin/play/PauseSubState.hx index f16aa00d8..471f8cf02 100644 --- a/source/funkin/play/PauseSubState.hx +++ b/source/funkin/play/PauseSubState.hx @@ -12,6 +12,7 @@ import flixel.tweens.FlxTween; import flixel.util.FlxColor; import funkin.audio.FunkinSound; import funkin.data.song.SongRegistry; +import funkin.ui.freeplay.FreeplayState; import funkin.graphics.FunkinSprite; import funkin.play.cutscene.VideoCutscene; import funkin.play.PlayState; @@ -658,7 +659,7 @@ class PauseSubState extends MusicBeatSubState } else { - state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new funkin.ui.freeplay.FreeplayState(null, sticker))); + state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker))); } } diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index fd6463bb1..678f2430e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2785,18 +2785,6 @@ class PlayState extends MusicBeatSubState if (targetSongId == null) { - FunkinSound.playMusic('freakyMenu', - { - overrideExisting: true, - restartTrack: false - }); - - // transIn = FlxTransitionableState.defaultTransIn; - // transOut = FlxTransitionableState.defaultTransOut; - - // TODO: Rework week unlock logic. - // StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true; - if (currentSong.validScore) { NGio.unlockMedal(60961); @@ -3205,7 +3193,10 @@ class PlayState extends MusicBeatSubState // Don't go back in time to before the song started. targetTimeMs = Math.max(0, targetTimeMs); - FlxG.sound.music.time = targetTimeMs; + if (FlxG.sound.music != null) + { + FlxG.sound.music.time = targetTimeMs; + } handleSkippedNotes(); SongEventRegistry.handleSkippedEvents(songEvents, Conductor.instance.songPosition); diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 821f4ba3c..12f395d0f 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -365,7 +365,7 @@ class ResultState extends MusicBeatSubState } else { - openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new FreeplayState(null, sticker))); + openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker))); } } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 6cb0d1d9a..40081b2ec 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -145,7 +145,7 @@ class FreeplayState extends MusicBeatSubState stickerSubState = stickers; } - super(); + super(FlxColor.TRANSPARENT); } override function create():Void @@ -899,7 +899,7 @@ class FreeplayState extends MusicBeatSubState if (Type.getClass(FlxG.state) == MainMenuState) { - FlxG.state.persistentUpdate = true; + FlxG.state.persistentUpdate = false; FlxG.state.persistentDraw = true; } @@ -1201,6 +1201,21 @@ class FreeplayState extends MusicBeatSubState grpCapsules.members[curSelected].selected = true; } } + + /** + * Build an instance of `FreeplayState` that is above the `MainMenuState`. + * @return The MainMenuState with the FreeplayState as a substate. + */ + public static function build(?params:FreeplayStateParams, ?stickers:StickerSubState):MusicBeatState + { + var result = new MainMenuState(); + result.persistentUpdate = false; + result.persistentDraw = true; + + result.openSubState(new FreeplayState(params, stickers)); + + return result; + } } /** diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index a8c2039ab..df81cf6f2 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -56,7 +56,8 @@ class MainMenuState extends MusicBeatState playMenuMusic(); } - persistentUpdate = persistentDraw = true; + persistentUpdate = false; + persistentDraw = true; var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); bg.scrollFactor.x = 0; @@ -311,8 +312,6 @@ class MainMenuState extends MusicBeatState // Open the debug menu, defaults to ` / ~ if (controls.DEBUG_MENU) { - this.persistentUpdate = false; - this.persistentDraw = false; FlxG.state.openSubState(new DebugMenuSubState()); } diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index 1a4e13ab1..7bd4a84af 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -290,18 +290,6 @@ class TitleState extends MusicBeatState // do controls.PAUSE | controls.ACCEPT instead? var pressedEnter:Bool = FlxG.keys.justPressed.ENTER; - if (FlxG.onMobile) - { - for (touch in FlxG.touches.list) - { - if (touch.justPressed) - { - FlxG.switchState(() -> new FreeplayState()); - pressedEnter = true; - } - } - } - var gamepad:FlxGamepad = FlxG.gamepads.lastActive; if (gamepad != null) From ddb41c9ef7d8c08e5100253216979dfdc6c14ef7 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 28 Mar 2024 23:13:47 -0400 Subject: [PATCH 2/3] Increase AFK timer, and add SFX over it --- assets | 2 +- source/funkin/ui/freeplay/DJBoyfriend.hx | 29 ++++++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/assets b/assets index 15c3f16c7..04605b7e3 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 15c3f16c7ec162b7c8d86421b624d74501b9616f +Subproject commit 04605b7e3ab7556b395476aa31b8853ff5243c6f diff --git a/source/funkin/ui/freeplay/DJBoyfriend.hx b/source/funkin/ui/freeplay/DJBoyfriend.hx index 33f264301..5f1144fab 100644 --- a/source/funkin/ui/freeplay/DJBoyfriend.hx +++ b/source/funkin/ui/freeplay/DJBoyfriend.hx @@ -27,8 +27,8 @@ class DJBoyfriend extends FlxAtlasSprite var gotSpooked:Bool = false; - static final SPOOK_PERIOD:Float = 10.0; - static final TV_PERIOD:Float = 10.0; + static final SPOOK_PERIOD:Float = 120.0; + static final TV_PERIOD:Float = 180.0; // Time since dad last SPOOKED you. var timeSinceSpook:Float = 0; @@ -43,7 +43,14 @@ class DJBoyfriend extends FlxAtlasSprite switch (name) { case "Boyfriend DJ watchin tv OG": - if (number == 85) runTvLogic(); + if (number == 80) + { + FunkinSound.playOnce(Paths.sound('remote_click')); + } + if (number == 85) + { + runTvLogic(); + } default: } }; @@ -219,19 +226,17 @@ class DJBoyfriend extends FlxAtlasSprite if (cartoonSnd == null) { // tv is OFF, but getting turned on - // Eric got FUCKING TROLLED there is no `tv_on` or `channel_switch` sound! - // FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() { - // }); - loadCartoon(); + FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() { + loadCartoon(); + }); } else { // plays it smidge after the click - // new FlxTimer().start(0.1, function(_) { - // // FunkinSound.playOnce(Paths.sound('channel_switch')); - // }); - cartoonSnd.destroy(); - loadCartoon(); + FunkinSound.playOnce(Paths.sound('channel_switch'), 1.0, function() { + cartoonSnd.destroy(); + loadCartoon(); + }); } // loadCartoon(); From 02b8aa0f1246f4e5c710759668e5f8b9a7fa9d19 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Apr 2024 22:13:38 -0400 Subject: [PATCH 3/3] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 04605b7e3..d7e85ef60 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 04605b7e3ab7556b395476aa31b8853ff5243c6f +Subproject commit d7e85ef60933ca93d47e1db6295aba8aa64fcbdf