From c3319ab6229d235e7e0a0cd723958e9446c0e94c Mon Sep 17 00:00:00 2001 From: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com> Date: Mon, 27 May 2024 23:55:37 +0200 Subject: [PATCH] detect modfolder reload + fix winter horrorland cutscene --- assets/songs/eggnog/cutscene.hx | 4 +- assets/songs/winter-horrorland/cutscene.hx | 38 ++++++++------- source/funkin/states/PlayState.hx | 2 +- .../funkin/states/options/ModFoldersState.hx | 48 ++++++++++++++----- source/funkin/substates/PromptSubstate.hx | 8 ++-- 5 files changed, 63 insertions(+), 37 deletions(-) diff --git a/assets/songs/eggnog/cutscene.hx b/assets/songs/eggnog/cutscene.hx index 7063383f..59f8bb91 100644 --- a/assets/songs/eggnog/cutscene.hx +++ b/assets/songs/eggnog/cutscene.hx @@ -8,9 +8,7 @@ function startCutscene(onEnd) { if (onEnd) { - var blackScreen:FlxSprite = new FlxSprite(-900, -450).makeRect(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.BLACK); - add(blackScreen); - blackScreen.scrollFactor.set(); + State.camGame.visible = false; State.camHUD.visible = false; playSound("Lights_Shut_off"); diff --git a/assets/songs/winter-horrorland/cutscene.hx b/assets/songs/winter-horrorland/cutscene.hx index d4416d98..ef1d4932 100644 --- a/assets/songs/winter-horrorland/cutscene.hx +++ b/assets/songs/winter-horrorland/cutscene.hx @@ -6,29 +6,33 @@ function createPost() function startCutscene() { - var blackScreen:FlxSprite = new FlxSprite(0, 0).makeRect(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.BLACK); - add(blackScreen); - blackScreen.scrollFactor.set(); + State.showUI(false); + State.camGame.visible = false; State.camHUD.visible = false; + //State.visible = false; + + var manager = makeCutsceneManager(); + + manager.pushEvent(0.1, function() { + State.camGame.visible = true; + State.camHUD.visible = true; + playSound("Lights_Turn_On"); - new FlxTimer().start(0.1, function(tmr:FlxTimer) - { - remove(blackScreen); - FlxG.sound.play(Paths.sound('Lights_Turn_On')); State.camFollow.setPosition(500,-1500); State.camGame.focusOn(State.camFollow.getPosition()); State.camGame.zoom = 1.5; + }); - new FlxTimer().start(0.8, function(tmr:FlxTimer) - { - State.camHUD.visible = true; - FlxTween.tween(State.camGame, {zoom: State.defaultCamZoom}, 2.5, { - ease: FlxEase.quadInOut, - onComplete: function(twn:FlxTween) - { - State.startCountdown(); - } - }); + manager.pushEvent(0.9, function () { + State.camHUD.visible = true; + FlxTween.tween(State.camGame, {zoom: State.defaultCamZoom}, 2.5, { + ease: FlxEase.quadInOut, + onComplete: function(twn:FlxTween) + { + State.startCountdown(); + } }); }); + + manager.start(); } \ No newline at end of file diff --git a/source/funkin/states/PlayState.hx b/source/funkin/states/PlayState.hx index b111e948..ee528ace 100644 --- a/source/funkin/states/PlayState.hx +++ b/source/funkin/states/PlayState.hx @@ -119,7 +119,7 @@ class PlayState extends MusicBeatState inPractice = getPref('practice'); validScore = !(getPref('botplay') || inPractice); ghostTapEnabled = getPref('ghost-tap-style') == "on"; - if (getPref('ghost-tap-style') == "dad turn" && SONG.notes[0] != null) + if (getPref('ghost-tap-style') == "dad turn") if (SONG.notes[0] != null) ghostTapEnabled = !SONG.notes[0].mustHitSection; SkinUtil.initSkinData(); diff --git a/source/funkin/states/options/ModFoldersState.hx b/source/funkin/states/options/ModFoldersState.hx index a072b299..3c27de0b 100644 --- a/source/funkin/states/options/ModFoldersState.hx +++ b/source/funkin/states/options/ModFoldersState.hx @@ -6,13 +6,21 @@ import haxe.io.Path; import funkin.util.backend.SongZip; #end -class ModFoldersState extends MusicBeatState { +class ModFoldersState extends MusicBeatState +{ var modFolderButtons:TypedGroup; var modItemsGrp:TypedGroup; var sliderPos:Float = 0; - override function create():Void { + // Find changes for reload + var initEnabled:Map; + var initMusic:String; + + override function create():Void + { FlxG.mouse.visible = true; + initEnabled = ModdingUtil.activeMods.copy(); + initMusic = Paths.musicFolder("freakyMenu"); var bg:FlxSpriteExt = new FlxSpriteExt().loadImage("menuBGBlue"); bg.setScale(1.1); @@ -33,11 +41,12 @@ class ModFoldersState extends MusicBeatState { modFolderButtons = new TypedGroup(); add(modFolderButtons); - var folderOptions:Array = ['Reload', 'Enable', 'Disable']; - var folderCallbacks:Array<()->Void> = [reloadFolders, enableAll, disableAll]; - for (i in 0...folderOptions.length) { - var daButton:SpriteButton = new SpriteButton(975, (150 * i) + 50, folderOptions[i], folderCallbacks[i]); - modFolderButtons.add(daButton); + for (i in 0...3) { + var button:SpriteButton = new SpriteButton(975, (150 * i) + 50, + ["Reload", "Enable", "Disable"][i], + [reloadFolders, enableAll, disableAll][i] + ); + modFolderButtons.add(button); } super.create(); @@ -86,12 +95,29 @@ class ModFoldersState extends MusicBeatState { override function update(elapsed:Float):Void { super.update(elapsed); - if (getKey('BACK', JUST_PRESSED)) { + if (getKey('BACK', JUST_PRESSED)) + { + for (mod => active in initEnabled) + { + // Changed settings, reload mods shit + if (active != ModdingUtil.getModActive(mod)) { + ModdingUtil.reloadMods(); + SkinUtil.setCurSkin(); + NoteUtil.initTypes(); + EventUtil.initEvents(); + + // Mod overrides music + if (Paths.musicFolder("freakyMenu") != initMusic) + CoolUtil.playMusic('freakyMenu'); + + break; + } + } + switchState(new OptionsState()); } - - if(FlxG.mouse.wheel != 0 && (modItemsGrp.length > 3)) { - final limit:Int = Std.int(modItemsGrp.length-3); + else if (modItemsGrp.length > 3) if (FlxG.mouse.wheel != 0) { + final limit:Int = modItemsGrp.length - 3; sliderPos = FlxMath.bound(sliderPos + FlxG.mouse.wheel, -limit, 0); } diff --git a/source/funkin/substates/PromptSubstate.hx b/source/funkin/substates/PromptSubstate.hx index 6d004ad3..2016da19 100644 --- a/source/funkin/substates/PromptSubstate.hx +++ b/source/funkin/substates/PromptSubstate.hx @@ -42,11 +42,9 @@ class PromptSubstate extends MusicBeatSubstate return; } - if (canClick && (acceptRequirement == null ? getKey('ACCEPT', JUST_PRESSED) : acceptRequirement())) { - if (acceptFunction != null) { - acceptFunction(); - close(); - } + if (canClick) if (acceptRequirement != null ? acceptRequirement() : getKey('ACCEPT', JUST_PRESSED)) { + if (acceptFunction != null) acceptFunction(); + close(); } } } \ No newline at end of file