Skip to content

Commit

Permalink
detect modfolder reload + fix winter horrorland cutscene
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed May 27, 2024
1 parent 930510a commit c3319ab
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 37 deletions.
4 changes: 1 addition & 3 deletions assets/songs/eggnog/cutscene.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
38 changes: 21 additions & 17 deletions assets/songs/winter-horrorland/cutscene.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion source/funkin/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
48 changes: 37 additions & 11 deletions source/funkin/states/options/ModFoldersState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpriteButton>;
var modItemsGrp:TypedGroup<ModItem>;
var sliderPos:Float = 0;

override function create():Void {
// Find changes for reload
var initEnabled:Map<String, Bool>;
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);
Expand All @@ -33,11 +41,12 @@ class ModFoldersState extends MusicBeatState {
modFolderButtons = new TypedGroup<SpriteButton>();
add(modFolderButtons);

var folderOptions:Array<String> = ['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();
Expand Down Expand Up @@ -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);
}

Expand Down
8 changes: 3 additions & 5 deletions source/funkin/substates/PromptSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

0 comments on commit c3319ab

Please sign in to comment.