From ecae996cc2001c4cdf05da21afdbd4efa56b7774 Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Fri, 19 Apr 2024 19:37:57 +0200 Subject: [PATCH 01/26] Fix Zip Folder mods --- .../backend/assets/ModsFolderLibrary.hx | 2 +- .../funkin/backend/assets/ZipFolderLibrary.hx | 48 ++++++++++++------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/source/funkin/backend/assets/ModsFolderLibrary.hx b/source/funkin/backend/assets/ModsFolderLibrary.hx index 23fa0d43..be052548 100644 --- a/source/funkin/backend/assets/ModsFolderLibrary.hx +++ b/source/funkin/backend/assets/ModsFolderLibrary.hx @@ -89,7 +89,7 @@ class ModsFolderLibrary extends AssetLibrary implements IModsAssetLibrary { return __getFiles(folder, false); public function __getFiles(folder:String, folders:Bool = false) { - if (!folder.endsWith("/")) folder = folder + "/"; + if (!folder.endsWith("/")) folder += "/"; if (!__parseAsset(folder)) return []; var path = getAssetPath(); try { diff --git a/source/funkin/backend/assets/ZipFolderLibrary.hx b/source/funkin/backend/assets/ZipFolderLibrary.hx index 805d05fc..f213403e 100644 --- a/source/funkin/backend/assets/ZipFolderLibrary.hx +++ b/source/funkin/backend/assets/ZipFolderLibrary.hx @@ -31,6 +31,8 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { public var zip:SysZip; public var assets:Map = []; + public var lowerCaseAssets:Map = []; + public var nameMap:Map = []; public function new(zipPath:String, libName:String, ?modName:String) { this.zipPath = zipPath; @@ -43,8 +45,10 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { zip = SysZip.openFromFile(zipPath); zip.read(); - for(entry in zip.entries) - assets[entry.fileName.toLowerCase()] = entry; + for(entry in zip.entries) { + lowerCaseAssets[entry.fileName.toLowerCase()] = assets[entry.fileName.toLowerCase()] = assets[entry.fileName] = entry; + nameMap.set(entry.fileName.toLowerCase(), entry.fileName); + } super(); } @@ -92,6 +96,8 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { } _parsedAsset = _parsedAsset.toLowerCase(); + if(nameMap.exists(_parsedAsset)) + _parsedAsset = nameMap.get(_parsedAsset); return true; } @@ -111,35 +117,45 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary { return '[ZIP]$zipPath/$_parsedAsset'; } + // TODO: rewrite this to 1 function, like ModsFolderLibrary public function getFiles(folder:String):Array { - var content:Array = []; - - if (!folder.endsWith("/")) folder = folder + "/"; + if (!folder.endsWith("/")) folder += "/"; if (!__parseAsset(folder)) return []; + var content:Array = []; + + var checkPath = _parsedAsset.toLowerCase(); + @:privateAccess - for(k=>e in assets) { - if (k.toLowerCase().startsWith(_parsedAsset)) { + for(k=>e in lowerCaseAssets) { + if (k.toLowerCase().startsWith(checkPath)) { + if(nameMap.exists(k)) + k = nameMap.get(k); var fileName = k.substr(_parsedAsset.length); - if (!fileName.contains("/")) - content.push(fileName); + if (!fileName.contains("/") && fileName.length > 0) + content.pushOnce(fileName); } } return content; } public function getFolders(folder:String):Array { - var content:Array = []; - - if (!folder.endsWith("/")) folder = folder + "/"; + if (!folder.endsWith("/")) folder += "/"; if (!__parseAsset(folder)) return []; + var content:Array = []; + + var checkPath = _parsedAsset.toLowerCase(); + @:privateAccess - for(k=>e in assets) { - if (k.toLowerCase().startsWith(_parsedAsset)) { + for(k=>e in lowerCaseAssets) { + if (k.toLowerCase().startsWith(checkPath)) { + if(nameMap.exists(k)) + k = nameMap.get(k); var fileName = k.substr(_parsedAsset.length); - if (fileName.contains("/")) { - var s = fileName.split("/")[0]; + var index = fileName.indexOf("/"); + if (index != -1 && fileName.length > 0) { + var s = fileName.substr(0, index); content.pushOnce(s); } } From 30fbf0c1bcc833d5b18412bffb94c86c5d254090 Mon Sep 17 00:00:00 2001 From: Frakits Date: Tue, 23 Apr 2024 20:22:58 +0300 Subject: [PATCH 02/26] needsvoices is finally removed! --- source/funkin/backend/chart/Chart.hx | 1 - source/funkin/backend/chart/ChartData.hx | 1 - .../funkin/backend/chart/FNFLegacyParser.hx | 3 --- source/funkin/editors/charter/Charter.hx | 4 ++-- .../editors/charter/CharterMetaDataScreen.hx | 9 +------- .../editors/charter/SongCreationScreen.hx | 23 +------------------ source/funkin/game/PlayState.hx | 2 +- 7 files changed, 5 insertions(+), 38 deletions(-) diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index 87302b71..9eabd626 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -56,7 +56,6 @@ class Chart { data.setFieldDefault("name", songName); data.setFieldDefault("beatsPerMeasure", 4); data.setFieldDefault("stepsPerBeat", 4); - data.setFieldDefault("needsVoices", true); data.setFieldDefault("icon", "face"); data.setFieldDefault("difficulties", []); data.setFieldDefault("coopAllowed", false); diff --git a/source/funkin/backend/chart/ChartData.hx b/source/funkin/backend/chart/ChartData.hx index c46164f5..7e6ad795 100644 --- a/source/funkin/backend/chart/ChartData.hx +++ b/source/funkin/backend/chart/ChartData.hx @@ -20,7 +20,6 @@ typedef ChartMetaData = { public var ?displayName:String; public var ?beatsPerMeasure:Float; public var ?stepsPerBeat:Float; - public var ?needsVoices:Bool; public var ?icon:String; public var ?color:Dynamic; public var ?difficulties:Array; diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 59cae28a..1b10c794 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -41,7 +41,6 @@ class FNFLegacyParser { } result.meta.bpm = data.bpm; - result.meta.needsVoices = data.needsVoices.getDefault(true); var camFocusedBF:Bool = false; var altAnims:Bool = false; @@ -145,7 +144,6 @@ class FNFLegacyParser { song: chart.meta.name, notes: null, bpm: chart.meta.bpm, - needsVoices: chart.meta.needsVoices, speed: chart.scrollSpeed, player1: null, @@ -206,7 +204,6 @@ typedef SwagSong = var song:String; var notes:Array; var bpm:Float; - var needsVoices:Bool; var speed:Float; var ?stage:String; var ?noteTypes:Array; diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index ddb6db51..05d35dd7 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -526,7 +526,7 @@ class Charter extends UIState { noteTypes = PlayState.SONG.noteTypes; FlxG.sound.setMusic(FlxG.sound.load(Paths.inst(__song, __diff))); - if (PlayState.SONG.meta.needsVoices != false) // null or true + if (Assets.exists(Paths.voices(__song, __diff))) // null or true vocals = FlxG.sound.load(Paths.voices(__song, __diff)); else vocals = new FlxSound(); @@ -602,7 +602,7 @@ class Charter extends UIState { var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [ {name: "Inst.ogg", sound: FlxG.sound.music}, ]; - if (PlayState.SONG.meta.needsVoices != false) + if (Assets.exists(Paths.voices(__song, __diff))) wavesToGenerate.push({name: "Voices.ogg", sound: vocals}); for (strumLine in strumLines) diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index 900cc721..660e3d89 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -15,7 +15,6 @@ class CharterMetaDataScreen extends UISubstateWindow { public var bpmStepper:UINumericStepper; public var beatsPerMeasureStepper:UINumericStepper; public var stepsPerBeatStepper :UINumericStepper; - public var needsVoicesCheckbox:UICheckbox; public var customPropertiesButtonList:UIButtonList; public var displayNameTextBox:UITextBox; @@ -64,11 +63,6 @@ class CharterMetaDataScreen extends UISubstateWindow { stepsPerBeatStepper = new UINumericStepper(beatsPerMeasureStepper.x + 30 + 24, beatsPerMeasureStepper.y, metadata.stepsPerBeat, 1, 0, 1, null, 54); add(stepsPerBeatStepper); - needsVoicesCheckbox = new UICheckbox(stepsPerBeatStepper.x + 80 + 26, stepsPerBeatStepper.y, "Voices", metadata.needsVoices); - add(needsVoicesCheckbox); - addLabelOn(needsVoicesCheckbox, "Needs Voices"); - needsVoicesCheckbox.y += 6; needsVoicesCheckbox.x += 4; - add(title = new UIText(songNameTextBox.x, songNameTextBox.y + 10 + 46, 0, "Menus Data (Freeplay/Story)", 28)); displayNameTextBox = new UITextBox(title.x, title.y + title.height + 36, metadata.displayName); @@ -97,7 +91,7 @@ class CharterMetaDataScreen extends UISubstateWindow { add(difficulitesTextBox); addLabelOn(difficulitesTextBox, "Difficulties"); - customPropertiesButtonList = new UIButtonList(needsVoicesCheckbox.x + needsVoicesCheckbox.width + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5); + customPropertiesButtonList = new UIButtonList(stepsPerBeatStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5); customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox'); customPropertiesButtonList.cameraSpacing = 0; customPropertiesButtonList.addButton.callback = function() { @@ -161,7 +155,6 @@ class CharterMetaDataScreen extends UISubstateWindow { bpm: bpmStepper.value, beatsPerMeasure: Std.int(beatsPerMeasureStepper.value), stepsPerBeat: Std.int(stepsPerBeatStepper.value), - needsVoices: needsVoicesCheckbox.checked, displayName: displayNameTextBox.label.text, icon: iconTextBox.label.text, color: colorWheel.curColorString, diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 95c682ce..7915cae0 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -19,7 +19,6 @@ class SongCreationScreen extends UISubstateWindow { public var bpmStepper:UINumericStepper; public var beatsPerMeasureStepper:UINumericStepper; public var stepsPerBeatStepper :UINumericStepper; - public var needsVoicesCheckbox:UICheckbox; public var instExplorer:UIFileExplorer; public var voicesExplorer:UIFileExplorer; @@ -83,25 +82,6 @@ class SongCreationScreen extends UISubstateWindow { var voicesUIText:UIText = null; - needsVoicesCheckbox = new UICheckbox(stepsPerBeatStepper.x + 80 + 26, stepsPerBeatStepper.y, "Voices", true); - needsVoicesCheckbox.onChecked = function(checked) { - if (voicesExplorer == null) return; - - if(!checked) { - voicesExplorer.removeFile(); - voicesExplorer.selectable = voicesExplorer.uploadButton.selectable = false; - voicesUIText.text = "Vocal Audio File"; - } else { - voicesExplorer.selectable = voicesExplorer.uploadButton.selectable = true; - voicesUIText.applyMarkup( - "Vocal Audio File $* Required$", - [new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]); - } - } - songDataGroup.add(needsVoicesCheckbox); - addLabelOn(needsVoicesCheckbox, "Needs Voices"); - needsVoicesCheckbox.y += 6; needsVoicesCheckbox.x += 4; - instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Paths.SOUND_EXT, function (res) { var audioPlayer:UIAudioPlayer = new UIAudioPlayer(instExplorer.x + 8, instExplorer.y + 8, res); instExplorer.members.push(audioPlayer); @@ -195,7 +175,7 @@ class SongCreationScreen extends UISubstateWindow { public override function update(elapsed:Float) { if (curPage == 0) { - if (instExplorer.file != null && (needsVoicesCheckbox.checked ? voicesExplorer.file != null : true)) + if (instExplorer.file != null) saveButton.selectable = true; else saveButton.selectable = false; } else @@ -258,7 +238,6 @@ class SongCreationScreen extends UISubstateWindow { bpm: bpmStepper.value, beatsPerMeasure: Std.int(beatsPerMeasureStepper.value), stepsPerBeat: Std.int(stepsPerBeatStepper.value), - needsVoices: needsVoicesCheckbox.checked, displayName: displayNameTextBox.label.text, icon: iconTextBox.label.text, color: colorWheel.curColorString, diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index a4de7511..5b601944 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -988,7 +988,7 @@ class PlayState extends MusicBeatState curSong = songData.meta.name.toLowerCase(); inst = FlxG.sound.load(Paths.inst(SONG.meta.name, difficulty)); - if (SONG.meta.needsVoices != false) // null or true + if (Assets.exists(Paths.voices(SONG.meta.name, difficulty))) // null or true vocals = FlxG.sound.load(Paths.voices(SONG.meta.name, difficulty)); else vocals = new FlxSound(); From d519db011a14aac0ddfc052089836c6b445f7f44 Mon Sep 17 00:00:00 2001 From: Frakits Date: Wed, 24 Apr 2024 21:12:52 +0300 Subject: [PATCH 03/26] added rows to alphabet --- source/funkin/menus/ui/Alphabet.hx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index a1859d0f..bd98a1d2 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -126,12 +126,16 @@ class Alphabet extends FlxSpriteGroup doSplitWords(); var xPos:Float = 0; - for (character in splitWords) + var curRow:Int = 0; + for (i=>character in splitWords) { if (lastSprite != null) xPos = lastSprite.x + lastSprite.width - x; + if (xPosResetted && !(xPosResetted = false)) xPos = 0; + var letter:AlphaCharacter = new AlphaCharacter(xPos, 0); + letter.row = curRow; if (isBold) letter.createBold(character); else @@ -145,6 +149,11 @@ class Alphabet extends FlxSpriteGroup add(letter); lastSprite = letter; + if (_finalText.fastCodeAt(i) == "\n".code) + { + xPosResetted = true; + curRow += 1; + } } } @@ -251,6 +260,8 @@ class AlphaCharacter extends FlxSprite animation.addByPrefix(letter, boldAnims[letter], 24); animation.play(letter); updateHitbox(); + + y += row * height; } public function createLetter(letter:String):Void From ea52e25251089eed0edc92ef237b93916919e73d Mon Sep 17 00:00:00 2001 From: swordcube <49110074+swordcube@users.noreply.github.com> Date: Fri, 26 Apr 2024 06:22:10 -0500 Subject: [PATCH 04/26] guys we should probably check if frames isn't null First --- source/funkin/backend/assets/Paths.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/assets/Paths.hx b/source/funkin/backend/assets/Paths.hx index 125d4d93..d7567b82 100644 --- a/source/funkin/backend/assets/Paths.hx +++ b/source/funkin/backend/assets/Paths.hx @@ -177,7 +177,7 @@ class Paths public static function getFrames(key:String, assetsPath:Bool = false, ?library:String) { if (tempFramesCache.exists(key)) { var frames = tempFramesCache[key]; - if (frames.parent != null && frames.parent.bitmap != null && frames.parent.bitmap.readable) + if (frames != null && frames.parent != null && frames.parent.bitmap != null && frames.parent.bitmap.readable) return frames; else tempFramesCache.remove(key); @@ -325,4 +325,4 @@ class ScriptPathInfo { this.file = file; this.library = library; } -} \ No newline at end of file +} From e2cd53d4ffe89360e56a3107ec5ba7151394e7b0 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 27 Apr 2024 14:34:25 +0300 Subject: [PATCH 05/26] fixed Voices crash in charter --- source/funkin/editors/charter/Charter.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 05d35dd7..ddb30083 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -602,7 +602,7 @@ class Charter extends UIState { var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [ {name: "Inst.ogg", sound: FlxG.sound.music}, ]; - if (Assets.exists(Paths.voices(__song, __diff))) + if (sys.FileSystem.exists(Paths.voices(__song, __diff))) //for some reason Assets.exists returns true regardless if the file actually exists wavesToGenerate.push({name: "Voices.ogg", sound: vocals}); for (strumLine in strumLines) From b2c4cc3777e634e76c83f477661156fee464e690 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 27 Apr 2024 14:40:56 +0300 Subject: [PATCH 06/26] dgf --- source/funkin/editors/charter/Charter.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index ddb30083..e67b59ba 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -602,7 +602,7 @@ class Charter extends UIState { var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [ {name: "Inst.ogg", sound: FlxG.sound.music}, ]; - if (sys.FileSystem.exists(Paths.voices(__song, __diff))) //for some reason Assets.exists returns true regardless if the file actually exists + if (@:privateAccess vocals._sound != null) //for some reason Assets.exists returns true regardless if the file actually exists wavesToGenerate.push({name: "Voices.ogg", sound: vocals}); for (strumLine in strumLines) From b79dbe4a74516c2ba8e43dff6bd236d377fd25f5 Mon Sep 17 00:00:00 2001 From: swordcube Date: Sat, 27 Apr 2024 08:14:01 -0500 Subject: [PATCH 07/26] Fix the pause menu crashing if a custom camera is not set --- source/funkin/menus/PauseSubState.hx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index 870725bd..882e3cbc 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -170,16 +170,17 @@ class PauseSubState extends MusicBeatSubstate } override function destroy() { - if(FlxG.cameras.list.contains(camera)) - FlxG.cameras.remove(camera, true); + if(camera != FlxG.camera) { + if(FlxG.cameras.list.contains(camera)) + FlxG.cameras.remove(camera, true); + } pauseScript.call("destroy"); pauseScript.destroy(); - if (pauseMusic != null) - @:privateAccess { - FlxG.sound.destroySound(pauseMusic); - } - + if(pauseMusic != null) { + @:privateAccess + FlxG.sound.destroySound(pauseMusic); + } super.destroy(); } From 3aac53873e1327a7a308cf866514a13f7dbf9c6a Mon Sep 17 00:00:00 2001 From: swordcube Date: Sat, 27 Apr 2024 08:23:30 -0500 Subject: [PATCH 08/26] fix it but MORE. suggestion by ne_eo --- source/funkin/menus/PauseSubState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index 882e3cbc..53dc65bb 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -170,7 +170,7 @@ class PauseSubState extends MusicBeatSubstate } override function destroy() { - if(camera != FlxG.camera) { + if(camera != FlxG.camera && _cameras != null) { if(FlxG.cameras.list.contains(camera)) FlxG.cameras.remove(camera, true); } From 7e66ee81e24204cd152de20046fa1500bb9d204b Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Sat, 27 Apr 2024 19:47:27 +0200 Subject: [PATCH 09/26] Better imports --- source/funkin/backend/scripting/HScript.hx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/scripting/HScript.hx b/source/funkin/backend/scripting/HScript.hx index 962db9e2..5c8d66d7 100644 --- a/source/funkin/backend/scripting/HScript.hx +++ b/source/funkin/backend/scripting/HScript.hx @@ -64,7 +64,13 @@ class HScript extends Script { } private function importFailedCallback(cl:Array):Bool { - var assetsPath = 'assets/source/${cl.join("/")}'; + if(_importFailedCallback(cl, "") || _importFailedCallback(cl, "source/")) { + return true; + } + return false; + } + private function _importFailedCallback(cl:Array, prefix:String):Bool { + var assetsPath = 'assets/$prefix${cl.join("/")}'; for(hxExt in ["hx", "hscript", "hsc", "hxs"]) { var p = '$assetsPath.$hxExt'; if (__importedPaths.contains(p)) From 2d7a87f9dad540889eb29071122831bc3dad9a44 Mon Sep 17 00:00:00 2001 From: swordcube Date: Mon, 29 Apr 2024 17:04:31 -0500 Subject: [PATCH 10/26] Fixed PR #288 --- source/funkin/menus/ui/Alphabet.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index bd98a1d2..663fa1b1 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -50,7 +50,7 @@ class Alphabet extends FlxSpriteGroup // TODO: fix this shit refreshing public function refreshAlphabetXML(path:String) { - AlphaCharacter.__alphaPath = path; + AlphaCharacter.__alphaPath = Paths.getAssetsRoot() + path; try { var xml = new Access(Xml.parse(Assets.getText(path)).firstElement()); AlphaCharacter.boldAnims = []; @@ -85,7 +85,7 @@ class Alphabet extends FlxSpriteGroup isBold = bold; var alphabetPath = Paths.xml("alphabet"); - if (alphabetPath != AlphaCharacter.__alphaPath) { + if (Paths.getAssetsRoot() + alphabetPath != AlphaCharacter.__alphaPath) { refreshAlphabetXML(alphabetPath); } #if MOD_SUPPORT else { From 31f9dd1aa55f8245fd742fcdfa3dd7913a798ecf Mon Sep 17 00:00:00 2001 From: swordcube <49110074+swordcube@users.noreply.github.com> Date: Fri, 3 May 2024 18:52:41 -0500 Subject: [PATCH 11/26] lunar i Might just end yoy... --- source/funkin/backend/chart/FNFLegacyParser.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 1b10c794..3bd0dfad 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -131,7 +131,7 @@ class FNFLegacyParser { if ((swagSection.mustHitSection && strumLine.type == OPPONENT) || (!swagSection.mustHitSection && strumLine.type == PLAYER)) sectionNote[1] += 4; - swagSection.sectionNotes.push(note); + swagSection.sectionNotes.push(sectionNote); } } From d36bd692d88a70dde867386f29497e012310fce6 Mon Sep 17 00:00:00 2001 From: "Rodney, An Imaginative Person" <59747809+RodneyAnImaginativePerson@users.noreply.github.com> Date: Fri, 31 May 2024 10:46:43 -0400 Subject: [PATCH 12/26] Why? (#289) it makes sense to, ya know- USE VARS FOR THE REASON THEY WERE MADE --- source/funkin/game/GameOverSubstate.hx | 2 +- source/funkin/menus/PauseSubState.hx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/funkin/game/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx index 4868b130..66b37968 100644 --- a/source/funkin/game/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -108,7 +108,7 @@ class GameOverSubstate extends MusicBeatSubstate if (controls.BACK) { if (PlayState.chartingMode && Charter.undos.unsaved) - PlayState.instance.saveWarn(false); + game.saveWarn(false); else { PlayState.resetSongInfos(); if (Charter.instance != null) Charter.instance.__clearStatics(); diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index edc0cb61..2366990c 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -106,7 +106,7 @@ class PauseSubState extends MusicBeatSubstate pauseScript.call("postCreate"); - PlayState.instance.updateDiscordPresence(); + game.updateDiscordPresence(); } override function update(elapsed:Float) @@ -146,7 +146,7 @@ class PauseSubState extends MusicBeatSubstate close(); case "Restart Song": parentDisabler.reset(); - PlayState.instance.registerSmoothTransition(); + game.registerSmoothTransition(); FlxG.resetState(); case "Change Controls": persistentDraw = false; @@ -157,7 +157,7 @@ class PauseSubState extends MusicBeatSubstate FlxG.switchState(new funkin.editors.charter.Charter(PlayState.SONG.meta.name, PlayState.difficulty, false)); case "Exit to menu": if (PlayState.chartingMode && Charter.undos.unsaved) - PlayState.instance.saveWarn(false); + game.saveWarn(false); else { PlayState.resetSongInfos(); if (Charter.instance != null) Charter.instance.__clearStatics(); From 718efbc5d795024975afa93fa74d2ecaceeb991d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Fri, 31 May 2024 17:13:29 +0200 Subject: [PATCH 13/26] fixing macos --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e6646418..819a3af0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -7,7 +7,7 @@ jobs: build: name: Mac OS Build permissions: write-all - runs-on: macos-latest + runs-on: macos-13 steps: - name: Pulling the new commit uses: actions/checkout@v2 From 4ad59150b42ebdf00134c4aece71b62f6f857129 Mon Sep 17 00:00:00 2001 From: ~ Care <126361810+usb-port-2@users.noreply.github.com> Date: Fri, 31 May 2024 16:17:59 +0100 Subject: [PATCH 14/26] Fixed typo (#283) --- source/funkin/game/Character.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 8efd1a50..f36088e8 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -158,7 +158,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset // [ true ][ false ][ true ] // [ false ][ true ][ true ] // [ true ][ true ][ false ] - // bros provided evedince :skull: + // bros provided evidence :skull: if (isPlayer != playerOffsets && switchAnims) { // character is flipped From d7b6fbe510edeb832112ab5adc8ab19dfe97d77f Mon Sep 17 00:00:00 2001 From: "Rodney, An Imaginative Person" <59747809+RodneyAnImaginativePerson@users.noreply.github.com> Date: Fri, 31 May 2024 11:18:38 -0400 Subject: [PATCH 15/26] Update EventsData.hx (#286) --- source/funkin/backend/chart/EventsData.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/chart/EventsData.hx b/source/funkin/backend/chart/EventsData.hx index 16551cb7..d443218a 100644 --- a/source/funkin/backend/chart/EventsData.hx +++ b/source/funkin/backend/chart/EventsData.hx @@ -48,7 +48,7 @@ class EventsData { } ], "Alt Animation Toggle" => [{name: "Enable On Sing Poses", type: TBool, defValue: true}, {name: "Enable On Idle", type: TBool, defValue: true}, {name: "Strumline", type: TStrumLine, defValue: 0}], - "Play Animation" => [{name: "Character", type: TStrumLine, defValue: 0}, {name: "Animation", type: TString, defValue: "animation"}], + "Play Animation" => [{name: "Character", type: TStrumLine, defValue: 0}, {name: "Animation", type: TString, defValue: "animation"}, {name: "Is forced?", type: TBool, defValue: true}], ]; public static var eventsList:Array = defaultEventsList.copy(); From 71b7daabbfc742212f2b35d27b5655561504bf3a Mon Sep 17 00:00:00 2001 From: "Rodney, An Imaginative Person" <59747809+RodneyAnImaginativePerson@users.noreply.github.com> Date: Fri, 31 May 2024 11:19:11 -0400 Subject: [PATCH 16/26] Fixed typo. (#270) * Fixed typo. * Update Assets.hx --- source/funkin/game/StrumLine.hx | 4 ++-- source/openfl/utils/Assets.hx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 68320514..17650a5a 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -30,9 +30,9 @@ class StrumLine extends FlxTypedGroup { */ public var onNoteUpdate:FlxTypedSignalVoid> = new FlxTypedSignalVoid>(); /** - * Signal that triggers whenever a note is being updated. Similar to onNoteUpdate, except strumline specific. + * Signal that triggers whenever a note is being deleted. Similar to onNoteDelete, except strumline specific. * To add a listener, do - * `strumLine.onNoteUpdate.add(function(e:NoteUpdateEvent) {});` + * `strumLine.onNoteDelete.add(function(e:SimpleNoteEvent) {});` */ public var onNoteDelete:FlxTypedSignalVoid> = new FlxTypedSignalVoid>(); /** diff --git a/source/openfl/utils/Assets.hx b/source/openfl/utils/Assets.hx index e08852cd..db92e530 100644 --- a/source/openfl/utils/Assets.hx +++ b/source/openfl/utils/Assets.hx @@ -91,7 +91,7 @@ class Assets @usage var bitmap = new Bitmap (Assets.getBitmapData ("image.png")); @param id The ID or asset path for the bitmap @param useCache (Optional) Whether to allow use of the asset cache (Default: true) - @param useCache Whenever the image should be immediately pushed to GPU. + @param pushToGPU Whenever the image should be immediately pushed to GPU. @return A new BitmapData object **/ public static function getBitmapData(id:String, useCache:Bool = true, pushToGPU:Bool = true):BitmapData From be55696bbefe537f06ad6550b039278ffcbcfb2f Mon Sep 17 00:00:00 2001 From: "Notbeep-,-" <112723428+Itzbeepi77@users.noreply.github.com> Date: Fri, 31 May 2024 22:38:30 +0700 Subject: [PATCH 17/26] Add missing bf anims (#276) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update bf.xml add some missing bf anims * fixed offsets and cleaner bf's xml file --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- assets/data/characters/bf.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/data/characters/bf.xml b/assets/data/characters/bf.xml index 04e2b3c5..245fbffd 100644 --- a/assets/data/characters/bf.xml +++ b/assets/data/characters/bf.xml @@ -11,4 +11,8 @@ - \ No newline at end of file + + + + + From c38039c085ace56ed3dde4378ccf0701e1508e1b Mon Sep 17 00:00:00 2001 From: EstoyAburridowGH <81833766+EstoyAburridowGH@users.noreply.github.com> Date: Fri, 31 May 2024 10:39:57 -0500 Subject: [PATCH 18/26] FunkinParentDisabler: Fix camera not updating its size (#281) --- source/funkin/backend/utils/FunkinParentDisabler.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/FunkinParentDisabler.hx b/source/funkin/backend/utils/FunkinParentDisabler.hx index 37d96277..f0617f5d 100644 --- a/source/funkin/backend/utils/FunkinParentDisabler.hx +++ b/source/funkin/backend/utils/FunkinParentDisabler.hx @@ -41,7 +41,9 @@ class FunkinParentDisabler extends FlxBasic { } } - public override function update(elapsed:Float) {} + public override function update(elapsed:Float) { + @:privateAccess for(c in __cameras) c.updateFlashSpritePosition(); + } public override function draw() {} public function reset() { From 1ac2e7f53390a9e92aa2a1fea94d147ed50d3694 Mon Sep 17 00:00:00 2001 From: Karim Akra <144803230+KarimAkra@users.noreply.github.com> Date: Fri, 31 May 2024 19:08:23 +0300 Subject: [PATCH 19/26] Made main menu shows the current keybind key for opening mods select menu (#271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Controls.hx * done * fixin a smol typo --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/system/Controls.hx | 9 +++++++-- source/funkin/menus/MainMenuState.hx | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/funkin/backend/system/Controls.hx b/source/funkin/backend/system/Controls.hx index 9dbae1f1..a09da1c7 100644 --- a/source/funkin/backend/system/Controls.hx +++ b/source/funkin/backend/system/Controls.hx @@ -430,13 +430,18 @@ class Controls extends FlxActionSet return byName[name].check(); } + public function getKeyName(control:Control):String + { + return getDialogueName(getActionFromControl(control)); + } + public function getDialogueName(action:FlxActionDigital):String { var input = action.inputs[0]; return switch input.device { - case KEYBOARD: return '[${(input.inputID : FlxKey)}]'; - case GAMEPAD: return '(${(input.inputID : FlxGamepadInputID)})'; + case KEYBOARD: return '${(input.inputID : FlxKey)}'; + case GAMEPAD: return '${(input.inputID : FlxGamepadInputID)}'; case device: throw 'unhandled device: $device'; } } diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index b17e9db6..31b09402 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -74,7 +74,7 @@ class MainMenuState extends MusicBeatState FlxG.camera.follow(camFollow, null, 0.06); - var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n'); + var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n'); versionShit.y -= versionShit.height; versionShit.scrollFactor.set(); add(versionShit); From e6e06038d5db0cad7fc601e46045c41f0b6b82e0 Mon Sep 17 00:00:00 2001 From: idk what a git repo is <138817584+what-is-a-git@users.noreply.github.com> Date: Fri, 31 May 2024 12:19:55 -0400 Subject: [PATCH 20/26] fix alphabet stuff from #284 (#288) * fix the dumb * gotta remove the import oops Fixes #284 --- source/funkin/menus/ui/Alphabet.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index d4c3db47..48075fa7 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -50,7 +50,7 @@ class Alphabet extends FlxSpriteGroup // TODO: fix this shit refreshing public function refreshAlphabetXML(path:String) { - AlphaCharacter.__alphaPath = path; + AlphaCharacter.__alphaPath = Paths.getAssetsRoot() + path; try { var xml = new Access(Xml.parse(Assets.getText(path)).firstElement()); AlphaCharacter.boldAnims = []; @@ -85,7 +85,7 @@ class Alphabet extends FlxSpriteGroup isBold = bold; var alphabetPath = Paths.xml("alphabet"); - if (alphabetPath != AlphaCharacter.__alphaPath) { + if (Paths.getAssetsRoot() + alphabetPath != AlphaCharacter.__alphaPath) { refreshAlphabetXML(alphabetPath); } #if MOD_SUPPORT else { From b682bcfb0b610ead51dbfe8805080d6b7b4a4ebf Mon Sep 17 00:00:00 2001 From: "Rodney, An Imaginative Person" <59747809+RodneyAnImaginativePerson@users.noreply.github.com> Date: Fri, 31 May 2024 12:53:50 -0400 Subject: [PATCH 21/26] Make No and Alt anim notes also effect miss anims (#285) :P --- assets/data/notes/Alt Anim Note.hx | 3 ++- assets/data/notes/No Anim Note.hx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/data/notes/Alt Anim Note.hx b/assets/data/notes/Alt Anim Note.hx index 08acea42..b44b1398 100644 --- a/assets/data/notes/Alt Anim Note.hx +++ b/assets/data/notes/Alt Anim Note.hx @@ -1 +1,2 @@ -function onNoteHit(event) if (event.noteType == "Alt Anim Note") event.animSuffix = "-alt"; \ No newline at end of file +function onNoteHit(event) if (event.noteType == "Alt Anim Note") event.animSuffix = "-alt"; +function onPlayerMiss(event) if (event.noteType == "Alt Anim Note") event.animSuffix = "-alt"; \ No newline at end of file diff --git a/assets/data/notes/No Anim Note.hx b/assets/data/notes/No Anim Note.hx index 31eb0c63..206d4f96 100644 --- a/assets/data/notes/No Anim Note.hx +++ b/assets/data/notes/No Anim Note.hx @@ -1 +1,2 @@ -function onNoteHit(event) if (event.noteType == "No Anim Note") event.animCancelled = true; \ No newline at end of file +function onNoteHit(event) if (event.noteType == "No Anim Note") event.animCancelled = true; +function onPlayerMiss(event) if (event.noteType == "No Anim Note") event.animCancelled = true; \ No newline at end of file From f259d626cfec591ef04c00429b37df16fb7f9857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Fri, 31 May 2024 19:40:28 +0200 Subject: [PATCH 22/26] better characters' suffix anims --- source/funkin/game/Character.hx | 22 +++++++++++++++++++--- source/funkin/game/PlayState.hx | 4 ++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index f36088e8..f902d39a 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -53,6 +53,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset public var shadowFrame:CharacterShadowFrame; public var idleSuffix:String = ""; + public var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"]; // Not making these inline so theyre editable through scripts! - Nex + public inline function getCameraPosition() { var midpoint = getMidpoint(); @@ -65,11 +67,25 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset return new FlxPoint(event.x, event.y); } + public inline function getSingAnim(direction:Int, suffix:String = ""):String + { + return anims[direction] + suffix; + } + + /** + * Like `playSingAnim` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part. + */ + public function playSafeSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) + { + var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); + script.call("onPlaySafeSingAnim", [event]); + if (!event.cancelled) + playSingAnim(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame); + } + public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) { - var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"]; - - var event = EventManager.get(DirectionAnimEvent).recycle(anims[direction] + suffix, direction, suffix, Context, Reversed, Frame, Force); + var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); script.call("onPlaySingAnim", [event]); if (!event.cancelled) playAnim(event.animName, event.force, event.context, event.reversed, event.frame); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index f585e89f..fdbe0444 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1572,7 +1572,7 @@ class PlayState extends MusicBeatState if (char == null) continue; if(event.stunned) char.stunned = true; - char.playSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); + char.playSafeSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); } } @@ -1653,7 +1653,7 @@ class PlayState extends MusicBeatState if (!event.animCancelled) for(char in event.characters) if (char != null) - char.playSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); + char.playSafeSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); if (event.note.__strum != null) { if (!event.strumGlowCancelled) event.note.__strum.press(event.note.strumTime); From 4d2c36e2d42ccb40fed5ec38157163152a3755ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Fri, 31 May 2024 20:38:00 +0200 Subject: [PATCH 23/26] making certain scripts break less --- source/funkin/game/Character.hx | 18 +++++++++--------- source/funkin/game/PlayState.hx | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index f902d39a..69afc69e 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -73,20 +73,20 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } /** - * Like `playSingAnim` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part. + * Like `playSingAnimUnsafe` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part. */ - public function playSafeSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) - { - var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); - script.call("onPlaySafeSingAnim", [event]); - if (!event.cancelled) - playSingAnim(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame); - } - public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); script.call("onPlaySingAnim", [event]); + if (!event.cancelled) + playSingAnimUnsafe(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame); + } + + public function playSingAnimUnsafe(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) + { + var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); + script.call("onPlaySingAnimUnsafe", [event]); if (!event.cancelled) playAnim(event.animName, event.force, event.context, event.reversed, event.frame); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index fdbe0444..f585e89f 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1572,7 +1572,7 @@ class PlayState extends MusicBeatState if (char == null) continue; if(event.stunned) char.stunned = true; - char.playSafeSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); + char.playSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); } } @@ -1653,7 +1653,7 @@ class PlayState extends MusicBeatState if (!event.animCancelled) for(char in event.characters) if (char != null) - char.playSafeSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); + char.playSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); if (event.note.__strum != null) { if (!event.strumGlowCancelled) event.note.__strum.press(event.note.strumTime); From bf0a6a9bbe48bc5eb6df56077b66ecac7cbbcedd Mon Sep 17 00:00:00 2001 From: syrup <123270096+maplesyruppppppp@users.noreply.github.com> Date: Fri, 7 Jun 2024 06:32:05 -0500 Subject: [PATCH 24/26] FPS Counter offset fix for Options/Credits menu (#307) * pixel note splashes * tyy!! * pixel secret notesplashes * the fix itself lol --- source/funkin/options/OptionsMenu.hx | 3 --- source/funkin/options/TreeMenu.hx | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index f9232e13..497bfd9b 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -1,6 +1,5 @@ package funkin.options; -import funkin.backend.system.framerate.Framerate; import funkin.options.type.Checkbox; import haxe.xml.Access; import funkin.options.type.*; @@ -48,8 +47,6 @@ class OptionsMenu extends TreeMenu { bg.antialiasing = true; add(bg); - Framerate.offset.y = 60; - main = new OptionsScreen("Options", "Select a category to continue.", [for(o in mainOptions) new TextOption(o.name, o.desc, function() { if (o.substate != null) { persistentUpdate = false; diff --git a/source/funkin/options/TreeMenu.hx b/source/funkin/options/TreeMenu.hx index ac027134..b0651fd2 100644 --- a/source/funkin/options/TreeMenu.hx +++ b/source/funkin/options/TreeMenu.hx @@ -7,6 +7,7 @@ import flixel.tweens.FlxTween; import funkin.menus.MainMenuState; import flixel.util.typeLimit.OneOfTwo; import funkin.options.type.OptionType; +import funkin.backend.system.framerate.Framerate; class TreeMenu extends UIState { public var main:OptionsScreen; @@ -97,6 +98,8 @@ class TreeMenu extends UIState { var menuChangeTween:FlxTween; public override function update(elapsed:Float) { super.update(elapsed); + + Framerate.offset.y = pathBG.height; // in case path gets so long it goes offscreen pathLabel.x = lerp(pathLabel.x, Math.max(0, FlxG.width - 4 - pathLabel.width), 0.125); From 1fffb487197c619bb8bae08c736ce868b5eb4df8 Mon Sep 17 00:00:00 2001 From: Kolziak <53307233+Kolziak@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:38:00 +0200 Subject: [PATCH 25/26] Mall fix (why was it like that) (#311) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Mall fix (why was it like that) * smol canon change --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- assets/data/stages/mall.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/assets/data/stages/mall.xml b/assets/data/stages/mall.xml index 3552cf27..3565f1be 100644 --- a/assets/data/stages/mall.xml +++ b/assets/data/stages/mall.xml @@ -1,21 +1,21 @@ - + - + - + - - + + + + + + + - - - - - - \ No newline at end of file + From 8d0a38419de5ac4cccb5f08c47ea0acc3c6ded85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:45:04 +0200 Subject: [PATCH 26/26] resolved the attrib +h crash in a cool way B) okay this was very funny to add --- source/funkin/backend/system/MainState.hx | 5 +- source/funkin/backend/utils/CoolUtil.hx | 39 ++++++++++----- source/funkin/backend/utils/NativeAPI.hx | 48 +++++++++++++++++-- source/funkin/backend/utils/native/Windows.hx | 17 +++++++ 4 files changed, 90 insertions(+), 19 deletions(-) diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index 885da7b0..d7238eec 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -66,9 +66,6 @@ class MainState extends FlxState { betaWarningShown = true; } - #if sys - sys.FileSystem.createDirectory('./.temp/'); - #if windows new funkin.backend.utils.native.HiddenProcess("attrib +h .temp"); #end - #end + CoolUtil.safeSetAttribute('./.temp/', HIDDEN); } } \ No newline at end of file diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index 4817bf5d..8cf268e6 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -1,5 +1,8 @@ package funkin.backend.utils; +#if sys +import sys.FileSystem; +#end import flixel.text.FlxText; import funkin.backend.utils.XMLUtil.TextFormat; import flixel.util.typeLimit.OneOfTwo; @@ -62,18 +65,15 @@ class CoolUtil */ @:noUsing public static function deleteFolder(delete:String) { #if sys - if (!sys.FileSystem.exists(delete)) return; - var files:Array = sys.FileSystem.readDirectory(delete); + if (!FileSystem.exists(delete)) return; + var files:Array = FileSystem.readDirectory(delete); for(file in files) { - if (sys.FileSystem.isDirectory(delete + "/" + file)) { + if (FileSystem.isDirectory(delete + "/" + file)) { deleteFolder(delete + "/" + file); - sys.FileSystem.deleteDirectory(delete + "/" + file); + FileSystem.deleteDirectory(delete + "/" + file); } else { - try { - sys.FileSystem.deleteFile(delete + "/" + file); - } catch(e) { - Logs.trace("Could not delete " + delete + "/" + file, WARNING); - } + try FileSystem.deleteFile(delete + "/" + file) + catch(e) Logs.trace("Could not delete " + delete + "/" + file, WARNING); } } #end @@ -98,6 +98,22 @@ class CoolUtil #end } + /** + * Sets an attribute to a file or a folder adding eventual missing folders in the path + * (WARNING: Only works on `windows`. On other platforms the return code it's always going to be `0` but still creates eventual missing folders if the platforms allows it to). + * @param path Path to the file or folder + * @param attrib The attribute to set (WARNING: There are some non settable attributes, such as the `COMPRESSED` one) + * @param useAbsol If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) + * @return The result code: 0 means that it failed setting + */ + @:noUsing public static inline function safeSetAttribute(path:String, attrib:NativeAPI.FileAttribute, useAbsol:Bool = true) { + addMissingFolders(Path.directory(path)); + + var result = NativeAPI.setFileAttribute(path, attrib, useAbsol); + if(result == 0) Logs.trace('Failed to set attribute to $path with a code of: $result', WARNING); + return result; + } + /** * Creates eventual missing folders to the specified `path` * @@ -113,9 +129,8 @@ class CoolUtil for (folder in folders) { currentPath += folder + "/"; - if (!sys.FileSystem.exists(currentPath)) { - sys.FileSystem.createDirectory(currentPath); - } + if (!FileSystem.exists(currentPath)) + FileSystem.createDirectory(currentPath); } #end return path; diff --git a/source/funkin/backend/utils/NativeAPI.hx b/source/funkin/backend/utils/NativeAPI.hx index a651645e..495403dc 100644 --- a/source/funkin/backend/utils/NativeAPI.hx +++ b/source/funkin/backend/utils/NativeAPI.hx @@ -29,6 +29,30 @@ class NativeAPI { #end } + /** + * Gets the specified file's (or folder) attribute. + */ + public static function getFileAttribute(path:String, useAbsol:Bool = true):FileAttribute { + #if windows + if(useAbsol) path = sys.FileSystem.absolutePath(path); + return Windows.getFileAttribute(path); + #else + return NORMAL; + #end + } + + /** + * Sets the specified file's (or folder) attribute. If it fails, the return value is `0`. + */ + public static function setFileAttribute(path:String, attrib:FileAttribute, useAbsol:Bool = true):Int { + #if windows + if(useAbsol) path = sys.FileSystem.absolutePath(path); + return Windows.setFileAttribute(path, attrib); + #else + return 0; + #end + } + public static function setDarkMode(title:String, enable:Bool) { #if windows Windows.setDarkMode(title, enable); @@ -61,15 +85,13 @@ class NativeAPI { var fg = cast(foregroundColor, Int); var bg = cast(backgroundColor, Int); Windows.setConsoleColors((bg * 16) + fg); - #else - #if sys + #elseif sys Sys.print("\x1b[0m"); if(foregroundColor != NONE) Sys.print("\x1b[" + Std.int(consoleColorToANSI(foregroundColor)) + "m"); if(backgroundColor != NONE) Sys.print("\x1b[" + Std.int(consoleColorToANSI(backgroundColor) + 10) + "m"); #end - #end } public static function consoleColorToANSI(color:ConsoleColor) { @@ -115,6 +137,26 @@ class NativeAPI { } } +enum abstract FileAttribute(Int) { + // Settables + var ARCHIVE = 0x20; + var HIDDEN = 0x2; + var NORMAL = 0x80; + var NOT_CONTENT_INDEXED = 0x2000; + var OFFLINE = 0x1000; + var READONLY = 0x1; + var SYSTEM = 0x4; + var TEMPORARY = 0x100; + + // Non Settables + var COMPRESSED = 0x800; + var DEVICE = 0x40; + var DIRECTORY = 0x10; + var ENCRYPTED = 0x4000; + var REPARSE_POINT = 0x400; + var SPARSE_FILE = 0x200; +} + enum abstract ConsoleColor(Int) { var BLACK = 0; var DARKBLUE = 1; diff --git a/source/funkin/backend/utils/native/Windows.hx b/source/funkin/backend/utils/native/Windows.hx index 07312d8d..5b03b904 100644 --- a/source/funkin/backend/utils/native/Windows.hx +++ b/source/funkin/backend/utils/native/Windows.hx @@ -1,6 +1,7 @@ package funkin.backend.utils.native; #if windows +import funkin.backend.utils.NativeAPI.FileAttribute; import funkin.backend.utils.NativeAPI.MessageBoxIcon; @:buildXml(' @@ -153,6 +154,22 @@ class Windows { public static function allocConsole() { } + @:functionCode(' + return GetFileAttributes(path); + ') + public static function getFileAttribute(path:String):FileAttribute + { + return NORMAL; + } + + @:functionCode(' + return SetFileAttributes(path, attrib); + ') + public static function setFileAttribute(path:String, attrib:FileAttribute):Int + { + return 0; + } + @:functionCode(' HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);