From af0cabbabe18c972e4dee95f1b9bf4e84c5aa08c Mon Sep 17 00:00:00 2001 From: Fusion243 Date: Sun, 25 Aug 2024 23:43:59 +0100 Subject: [PATCH 1/4] Actually fixed the weekList thing + Other fixes - Changed the grpWeekText.length check to weeksList.length so it doesn't crash anymore. (for real this time) - Fixed the cancelMenu sound not playing when going back from both menus. - Fixed the softlock when you try to load a week with no chart for the first song. --- source/states/FreeplayState.hx | 8 +++++++- source/states/StoryMenuState.hx | 17 +++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/states/FreeplayState.hx b/source/states/FreeplayState.hx index fef3c76a653..ece50412ccd 100644 --- a/source/states/FreeplayState.hx +++ b/source/states/FreeplayState.hx @@ -69,7 +69,10 @@ class FreeplayState extends MusicBeatState persistentUpdate = false; MusicBeatState.switchState(new states.ErrorState("NO WEEKS ADDED FOR FREEPLAY\n\nPress ACCEPT to go to the Week Editor Menu.\nPress BACK to return to Main Menu.", function() MusicBeatState.switchState(new states.editors.WeekEditorState()), - function() MusicBeatState.switchState(new states.MainMenuState()))); + function() { + FlxG.sound.play(Paths.sound('cancelMenu')); + MusicBeatState.switchState(new states.MainMenuState()); + })); return; } @@ -215,7 +218,10 @@ class FreeplayState extends MusicBeatState override function update(elapsed:Float) { if(WeekData.weeksList.length < 1) + { + super.update(elapsed); return; + } if (FlxG.sound.music.volume < 0.7) FlxG.sound.music.volume += 0.5 * FlxG.elapsed; diff --git a/source/states/StoryMenuState.hx b/source/states/StoryMenuState.hx index 5c9380b9b70..b7d44e546b7 100644 --- a/source/states/StoryMenuState.hx +++ b/source/states/StoryMenuState.hx @@ -63,7 +63,11 @@ class StoryMenuState extends MusicBeatState persistentUpdate = false; MusicBeatState.switchState(new states.ErrorState("NO WEEKS ADDED FOR STORY MODE\n\nPress ACCEPT to go to the Week Editor Menu.\nPress BACK to return to Main Menu.", function() MusicBeatState.switchState(new states.editors.WeekEditorState()), - function() MusicBeatState.switchState(new states.MainMenuState()))); + function() { + FlxG.sound.play(Paths.sound('cancelMenu')); + movedBack = true; + MusicBeatState.switchState(new states.MainMenuState()); + })); return; } @@ -196,14 +200,8 @@ class StoryMenuState extends MusicBeatState override function update(elapsed:Float) { - if(grpWeekText.length < 1) + if(WeekData.weeksList.length < 1) { - if (controls.BACK && !movedBack && !selectedWeek) - { - FlxG.sound.play(Paths.sound('cancelMenu')); - movedBack = true; - MusicBeatState.switchState(new MainMenuState()); - } super.update(elapsed); return; } @@ -326,6 +324,9 @@ class StoryMenuState extends MusicBeatState catch(e:Dynamic) { trace('ERROR! $e'); + + FlxG.sound.play(Paths.sound('cancelMenu')); + selectedWeek = false; return; } From a881ea3eca6fc6ff9877b57be776ea50aef74756 Mon Sep 17 00:00:00 2001 From: Fusion243 Date: Mon, 26 Aug 2024 00:07:03 +0100 Subject: [PATCH 2/4] Character scale offset fix - Fixed character animation offsets breaking when the character's scale is changed. --- source/objects/Character.hx | 2 +- source/objects/MenuCharacter.hx | 2 +- source/states/editors/CharacterEditorState.hx | 3 ++- source/states/editors/DialogueCharacterEditorState.hx | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/objects/Character.hx b/source/objects/Character.hx index f8ec03d49e4..2f9da7b0f68 100644 --- a/source/objects/Character.hx +++ b/source/objects/Character.hx @@ -408,7 +408,7 @@ class Character extends FlxSprite if (hasAnimation(AnimName)) { var daOffset = animOffsets.get(AnimName); - offset.set(daOffset[0], daOffset[1]); + offset.set(daOffset[0] * scale.x, daOffset[1] * scale.y); } //else offset.set(0, 0); diff --git a/source/objects/MenuCharacter.hx b/source/objects/MenuCharacter.hx index bf8bbe06b3e..5b5f84cc825 100644 --- a/source/objects/MenuCharacter.hx +++ b/source/objects/MenuCharacter.hx @@ -91,7 +91,7 @@ class MenuCharacter extends FlxSprite scale.set(charFile.scale, charFile.scale); updateHitbox(); } - offset.set(charFile.position[0], charFile.position[1]); + offset.set(charFile.position[0] * scale.x, charFile.position[1] * scale.y); animation.play('idle'); antialiasing = (charFile.antialiasing != false && ClientPrefs.data.antialiasing); diff --git a/source/states/editors/CharacterEditorState.hx b/source/states/editors/CharacterEditorState.hx index febde87da42..fe70eef069e 100644 --- a/source/states/editors/CharacterEditorState.hx +++ b/source/states/editors/CharacterEditorState.hx @@ -320,7 +320,7 @@ class CharacterEditorState extends MusicBeatState implements PsychUIEventHandler spr.scale.set(character.scale.x, character.scale.y); spr.updateHitbox(); - spr.offset.set(character.offset.x, character.offset.y); + spr.offset.set(character.offset.x * spr.scale.x, character.offset.y * spr.scale.y); spr.visible = true; var otherSpr:FlxSprite = (spr == animateGhost) ? ghost : animateGhost; @@ -736,6 +736,7 @@ class CharacterEditorState extends MusicBeatState implements PsychUIEventHandler character.jsonScale = sender.value; character.scale.set(character.jsonScale, character.jsonScale); character.updateHitbox(); + character.playAnim(anims[curAnim].anim, true); updatePointerPos(false); unsavedProgress = true; } diff --git a/source/states/editors/DialogueCharacterEditorState.hx b/source/states/editors/DialogueCharacterEditorState.hx index fc8c6cb2366..b13250759a5 100644 --- a/source/states/editors/DialogueCharacterEditorState.hx +++ b/source/states/editors/DialogueCharacterEditorState.hx @@ -511,8 +511,8 @@ class DialogueCharacterEditorState extends MusicBeatState implements PsychUIEven if(moved) { offsetLoopText.text = 'Loop: ' + animShit.loop_offsets; offsetIdleText.text = 'Idle: ' + animShit.idle_offsets; - ghostLoop.offset.set(animShit.loop_offsets[0], animShit.loop_offsets[1]); - ghostIdle.offset.set(animShit.idle_offsets[0], animShit.idle_offsets[1]); + ghostLoop.offset.set(animShit.loop_offsets[0] * ghostLoop.scale.x, animShit.loop_offsets[1] * ghostLoop.scale.x); + ghostIdle.offset.set(animShit.idle_offsets[0] * ghostLoop.scale.y, animShit.idle_offsets[1] * ghostLoop.scale.y); } } From 14b84716faeace8c81fd4f65b0a1042f851f235d Mon Sep 17 00:00:00 2001 From: Fusion243 Date: Mon, 26 Aug 2024 00:33:27 +0100 Subject: [PATCH 3/4] Fixed openfl.Assets compiling issue - Fixed a compiling issue with MODS_ALLOWED disabled by importing openfl.Assets where it's needed. --- source/options/LanguageSubState.hx | 2 ++ source/states/FreeplayState.hx | 1 + source/states/editors/ChartingState.hx | 1 + source/states/editors/StageEditorState.hx | 1 + 4 files changed, 5 insertions(+) diff --git a/source/options/LanguageSubState.hx b/source/options/LanguageSubState.hx index 0f799d1247a..5c2fdee5919 100644 --- a/source/options/LanguageSubState.hx +++ b/source/options/LanguageSubState.hx @@ -1,5 +1,7 @@ package options; +import openfl.Assets; + class LanguageSubState extends MusicBeatSubstate { #if TRANSLATIONS_ALLOWED diff --git a/source/states/FreeplayState.hx b/source/states/FreeplayState.hx index ece50412ccd..aaf257cb310 100644 --- a/source/states/FreeplayState.hx +++ b/source/states/FreeplayState.hx @@ -1,5 +1,6 @@ package states; +import openfl.Assets; import backend.WeekData; import backend.Highscore; import backend.Song; diff --git a/source/states/editors/ChartingState.hx b/source/states/editors/ChartingState.hx index 11c4f588f6e..9be743c7a67 100644 --- a/source/states/editors/ChartingState.hx +++ b/source/states/editors/ChartingState.hx @@ -1,5 +1,6 @@ package states.editors; +import openfl.Assets as OpenFlAssets; import flixel.FlxSubState; import flixel.util.FlxSave; import flixel.util.FlxSort; diff --git a/source/states/editors/StageEditorState.hx b/source/states/editors/StageEditorState.hx index 8fd7d51f4ea..6a4f927545b 100644 --- a/source/states/editors/StageEditorState.hx +++ b/source/states/editors/StageEditorState.hx @@ -1,5 +1,6 @@ package states.editors; +import openfl.Assets; import backend.StageData; import backend.PsychCamera; import objects.Character; From 5dfded72f1e0f720c27c3d48d8b4a975f7d80bfd Mon Sep 17 00:00:00 2001 From: Fusion243 Date: Mon, 26 Aug 2024 00:34:31 +0100 Subject: [PATCH 4/4] Update Main.hx - Auto delete the mods folder when MODS_ALLOWED is disabled. --- source/Main.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/Main.hx b/source/Main.hx index 5bb4e647920..8d01261e42c 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -132,6 +132,16 @@ class Main extends Sprite } #end + #if !MODS_ALLOWED + final path:String = 'mods'; + if (sys.FileSystem.exists(path) && sys.FileSystem.isDirectory(path)) + { + var entries = sys.FileSystem.readDirectory(path); + for (entry in entries) sys.FileSystem.deleteFile(path + '/' + entry); + FileSystem.deleteDirectory(path); + } + #end + #if linux var icon = Image.fromFile("icon.png"); Lib.current.stage.window.setIcon(icon);