Small utility function + Fixes

This commit is contained in:
NeeEoo
2023-10-13 02:02:06 +02:00
parent a620c0ceed
commit b6e8202c3c
2 changed files with 20 additions and 13 deletions
@@ -26,7 +26,7 @@ class CommandLineHandler {
var arg = cmd[i];
if (arg == null) {
Sys.println("[ERROR] You need to specify the mod name");
Sys.exit(0);
Sys.exit(1);
} else {
Main.modToLoad = arg.trim();
}
@@ -35,24 +35,24 @@ class CommandLineHandler {
var arg = cmd[i];
if (arg == null) {
Sys.println("[ERROR] You need to specify the mod folder path");
Sys.exit(0);
Sys.exit(1);
} else if (FileSystem.exists(arg)) {
funkin.backend.assets.ModsFolder.modsPath = arg;
} else {
Sys.println('[ERROR] Mod folder at "${arg}" does not exist.');
Sys.exit(0);
Sys.exit(1);
}
case "-addonsfolder":
i++;
var arg = cmd[i];
if (arg == null) {
Sys.println("[ERROR] You need to specify the addon folder path");
Sys.exit(0);
Sys.exit(1);
} else if (FileSystem.exists(arg)) {
funkin.backend.assets.ModsFolder.addonsPath = arg;
} else {
Sys.println('[ERROR] Addons folder at "${arg}" does not exist.');
Sys.exit(0);
Sys.exit(1);
}
#end
case "-nocolor":
@@ -25,14 +25,21 @@ class GraphicCacheSprite extends FlxSprite {
* @param path Path to the graphic.
*/
public function cache(path:String) {
var graphic = FlxG.bitmap.add(path);
if (graphic != null) {
// make their useCount one time higher to prevent them from auto being cleared from cache
graphic.useCount++;
graphic.destroyOnNoUse = false;
cachedGraphics.push(graphic);
nonRenderedCachedGraphics.push(graphic);
}
cacheGraphic(FlxG.bitmap.add(path));
}
/**
* Caches a graphic.
* @param graphic The FlxGraphic
*/
public function cacheGraphic(graphic:FlxGraphic) {
if (graphic == null) return;
// make their useCount one time higher to prevent them from auto being cleared from cache
graphic.useCount++;
graphic.destroyOnNoUse = false;
cachedGraphics.push(graphic);
nonRenderedCachedGraphics.push(graphic);
}
public override function destroy() {