diff --git a/assets/data/characters/.foldercontent b/assets/data/characters/.foldercontent deleted file mode 100644 index 75791fc6..00000000 --- a/assets/data/characters/.foldercontent +++ /dev/null @@ -1,8 +0,0 @@ -bf.xml -gf.xml -dad.xml -gf.xml -mom-car.xml -monster.xml -pico.xml -spooky.xml \ No newline at end of file diff --git a/buildnumber.txt b/buildnumber.txt index 680cc9c3..d36f9fbe 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -263 \ No newline at end of file +267 \ No newline at end of file diff --git a/source/ChartingState.hx b/source/ChartingState.hx index dd9417ef..f6a7ec38 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -176,6 +176,7 @@ class ChartingState extends MusicBeatState add(curRenderedNotes); add(curRenderedSustains); + trace(Paths.getFolderContent('data/characters/')); super.create(); } diff --git a/source/Main.hx b/source/Main.hx index f38e3776..4690acf8 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -28,7 +28,7 @@ class Main extends Sprite var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom). var initialState:Class = TitleState; // The FlxState the game starts with. var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions. - var framerate:Int = 60; // How many frames per second the game should run at. + var framerate:Int = 120; // How many frames per second the game should run at. var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode. var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 26447162..cacf8ecd 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -894,8 +894,8 @@ class PlayState extends MusicBeatState if (camZooming) { - FlxG.camera.zoom = lerp(defaultCamZoom, FlxG.camera.zoom, 0.95); - camHUD.zoom = lerp(1, camHUD.zoom, 0.95); + FlxG.camera.zoom = lerp(FlxG.camera.zoom, defaultCamZoom, 0.05); + camHUD.zoom = lerp(camHUD.zoom, 1, 0.05); } FlxG.watch.addQuick("beatShit", curBeat); diff --git a/source/funkin/mods/LimeLibrarySymbol.hx b/source/funkin/mods/LimeLibrarySymbol.hx new file mode 100644 index 00000000..7e035c2c --- /dev/null +++ b/source/funkin/mods/LimeLibrarySymbol.hx @@ -0,0 +1,25 @@ +package funkin.mods; + +/** + * COPIED DIRECTLY FROM LIME SOURCE CAUSE LIME IS SO FUCKING DUMB!! + */ +class LimeLibrarySymbol +{ + public var library:lime.utils.AssetLibrary; + public var libraryName:String; + public var symbolName:String; + + public inline function new(id:String) + { + var colonIndex = id.indexOf(":"); + libraryName = id.substring(0, colonIndex); + symbolName = id.substring(colonIndex + 1); + library = lime.utils.Assets.getLibrary(libraryName); + } + + public inline function isLocal(?type) + return library.isLocal(symbolName, type); + + public inline function exists(?type) + return library.exists(symbolName, type); +} \ No newline at end of file diff --git a/source/funkin/mods/ModsAssetLibrary.hx b/source/funkin/mods/ModsAssetLibrary.hx index 4660f5c7..11c32e5b 100644 --- a/source/funkin/mods/ModsAssetLibrary.hx +++ b/source/funkin/mods/ModsAssetLibrary.hx @@ -107,6 +107,21 @@ class ModsAssetLibrary extends AssetLibrary { return getAssetPath(); } + public function getFiles(folder:String):Array { + if (!folder.endsWith("/")) folder = folder + "/"; + if (!__parseAsset(folder)) return []; + var path = getAssetPath(); + + try { + var result:Array = []; + for(e in FileSystem.readDirectory(path)) + if (!FileSystem.isDirectory('$path$e')) + result.push(e); + return result; + } + return []; + } + public override function exists(asset:String, type:String):Bool { if(!__parseAsset(asset)) return false; diff --git a/source/funkin/mods/ModsFolder.hx b/source/funkin/mods/ModsFolder.hx index a53bf255..ab6514e1 100644 --- a/source/funkin/mods/ModsFolder.hx +++ b/source/funkin/mods/ModsFolder.hx @@ -4,7 +4,11 @@ import openfl.utils.Assets; import openfl.utils.AssetManifest; import openfl.utils.AssetLibrary; import flixel.graphics.FlxGraphic; + +#if sys import sys.FileSystem; +#end + import flixel.FlxG; import flixel.FlxState; import haxe.io.Path; @@ -139,6 +143,7 @@ class ModsFolder { private static function onStateSwitch(newState:FlxState) { Assets.cache.clear(); + lime.utils.Assets.cache.clear(); if (currentModFolder == null) return; #if sys @@ -146,7 +151,7 @@ class ModsFolder { @:privateAccess for(bmap in FlxG.bitmap._cache) { if (bmap.assetsKey != null) { - var e = new LibrarySymbol(bmap.assetsKey); + var e = new LimeLibrarySymbol(bmap.assetsKey); if (e.library is openfl.utils.AssetLibrary) { @:privateAccess e.library = cast(e.library, openfl.utils.AssetLibrary).__proxy; @@ -166,25 +171,4 @@ class ModsFolder { #end } -} - -class LibrarySymbol -{ - public var library:lime.utils.AssetLibrary; - public var libraryName:String; - public var symbolName:String; - - public inline function new(id:String) - { - var colonIndex = id.indexOf(":"); - libraryName = id.substring(0, colonIndex); - symbolName = id.substring(colonIndex + 1); - library = lime.utils.Assets.getLibrary(libraryName); - } - - public inline function isLocal(?type) - return library.isLocal(symbolName, type); - - public inline function exists(?type) - return library.exists(symbolName, type); } \ No newline at end of file diff --git a/source/funkin/system/Paths.hx b/source/funkin/system/Paths.hx index 7281b047..3cf2ec5b 100644 --- a/source/funkin/system/Paths.hx +++ b/source/funkin/system/Paths.hx @@ -1,5 +1,6 @@ package funkin.system; +import funkin.mods.LimeLibrarySymbol; import flixel.FlxG; import flixel.graphics.frames.FlxAtlasFrames; import openfl.utils.AssetType; @@ -147,23 +148,40 @@ class Paths return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); } - inline static public function getFolderContent(key:String, includeSource:Bool = false, ?library:String):Array { + inline static public function getFolderContent(key:String, includeSource:Bool = true, scanSource:Bool = false):Array { // designed to work both on windows and web - while(key.charAt(key.length-1) == "/") key.substr(0, key.length-1); - var path = getPath('$key/.foldercontent', TEXT, library); + if (!key.endsWith("/")) key = key + "/"; + + if (ModsFolder.currentModFolder == null) + return getFolderContent(key, false, true); + + var libThing = new LimeLibrarySymbol(scanSource ? getPreloadPath(key) : getLibraryPathForce(key, 'mods/${ModsFolder.currentModFolder}')); + var library = libThing.library; + + if (library is openfl.utils.AssetLibrary) { + var lib = cast(libThing.library, openfl.utils.AssetLibrary); + @:privateAccess + if (lib.__proxy != null) library = lib.__proxy; + } + var content:Array = []; - if (OpenFlAssets.exists(path)) { - var text = OpenFlAssets.getText(path); - for(e in text.split("\n")) content.push(e.trim()); + if (library is funkin.mods.ModsAssetLibrary) { + // easy task, can immediatly scan for files! + var lib = cast(library, funkin.mods.ModsAssetLibrary); + content = lib.getFiles(libThing.symbolName); + } else { + // TODO!! } + if (includeSource) { - var path = getPath('$key/.foldercontent', TEXT, library, true); - if (OpenFlAssets.exists(path)) { - var text = OpenFlAssets.getText(path); - for(e in text.split("\n")) content.push(e.trim()); - } + var sourceResult = getFolderContent(key, false, true); + for(e in sourceResult) + if (!content.contains(e)) + content.push(e); } + + return content; } }