Small Improvements

This commit is contained in:
NeeEoo
2024-04-12 12:14:51 +02:00
parent f3bb4e2f50
commit 308af270eb
5 changed files with 29 additions and 31 deletions
-4
View File
@@ -2,15 +2,11 @@ package funkin.backend.assets;
import flixel.graphics.FlxGraphic; import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxFramesCollection; import flixel.graphics.frames.FlxFramesCollection;
import flixel.system.FlxAssets.FlxGraphicAsset;
import funkin.backend.assets.LimeLibrarySymbol;
import funkin.backend.assets.ModsFolder; import funkin.backend.assets.ModsFolder;
import funkin.backend.scripting.Script; import funkin.backend.scripting.Script;
import haxe.io.Path; import haxe.io.Path;
import lime.utils.AssetLibrary; import lime.utils.AssetLibrary;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets; import openfl.utils.Assets as OpenFlAssets;
using StringTools; using StringTools;
+1 -1
View File
@@ -65,7 +65,7 @@ class Chart {
data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor)); data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor));
if (data.difficulties.length <= 0) { if (data.difficulties.length <= 0) {
data.difficulties = [for(f in Paths.getFolderContent('songs/${songName.toLowerCase()}/charts/', false, !fromMods)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)]; data.difficulties = [for(f in Paths.getFolderContent('songs/${songName.toLowerCase()}/charts/', false, fromMods ? MODS : SOURCE)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
if (data.difficulties.length == 3) { if (data.difficulties.length == 3) {
var hasHard = false, hasNormal = false, hasEasy = false; var hasHard = false, hasNormal = false, hasEasy = false;
for(d in data.difficulties) { for(d in data.difficulties) {
+22 -20
View File
@@ -577,7 +577,7 @@ class PlayState extends MusicBeatState
for(folder in scriptsFolders) { for(folder in scriptsFolders) {
for(file in Paths.getFolderContent(folder, true, fromMods ? MODS : BOTH)) { for(file in Paths.getFolderContent(folder, true, fromMods ? MODS : BOTH)) {
if (folder == 'data/charts/') if (folder == 'data/charts/')
Logs.trace('data/charts/ is deprecrated and will be removed in the future. Please move script $file to songs/', WARNING, DARKYELLOW); Logs.trace('[PlayState] data/charts/ is deprecrated and will be removed in the future. Please move script $file to songs/', WARNING, DARKYELLOW);
addScript(file); addScript(file);
} }
@@ -600,7 +600,7 @@ class PlayState extends MusicBeatState
// PRECACHING // PRECACHING
#if REGION #if REGION
for(content in Paths.getFolderContent('images/game/score/', true, true)) for(content in Paths.getFolderContent('images/game/score/', true, BOTH))
graphicCache.cache(Paths.getPath(content)); graphicCache.cache(Paths.getPath(content));
for(i in 1...4) { for(i in 1...4) {
@@ -758,7 +758,7 @@ class PlayState extends MusicBeatState
SaveWarning.warningFunc = saveWarn; SaveWarning.warningFunc = saveWarn;
SaveWarning.saveFunc = () -> { SaveWarning.saveFunc = () -> {
@:privateAccess Chart.save('${Paths.getAssetsRoot()}/songs/${Charter.__song.toLowerCase()}', @:privateAccess Chart.save('${Paths.getAssetsRoot()}/songs/${Charter.__song.toLowerCase()}',
PlayState.SONG, Charter.__diff.toLowerCase(), {saveMetaInChart: false, prettyPrint: Options.editorPrettyPrint}); SONG, Charter.__diff.toLowerCase(), {saveMetaInChart: false, prettyPrint: Options.editorPrettyPrint});
} }
} }
} }
@@ -799,13 +799,15 @@ class PlayState extends MusicBeatState
return; return;
} }
var songName = SONG.meta.name.toLowerCase();
if (cutsceneScriptPath == null) if (cutsceneScriptPath == null)
cutsceneScriptPath = Paths.script('songs/${SONG.meta.name.toLowerCase()}/${prefix}cutscene'); cutsceneScriptPath = Paths.script('songs/$songName/${prefix}cutscene');
inCutscene = true; inCutscene = true;
var videoCutscene = Paths.video('${PlayState.SONG.meta.name.toLowerCase()}-${prefix}cutscene'); var videoCutscene = Paths.video('$songName-${prefix}cutscene');
var videoCutsceneAlt = Paths.file('songs/${PlayState.SONG.meta.name.toLowerCase()}/${prefix}cutscene.mp4'); var videoCutsceneAlt = Paths.file('songs/$songName/${prefix}cutscene.mp4');
var dialogue = Paths.file('songs/${PlayState.SONG.meta.name.toLowerCase()}/${prefix}dialogue.xml'); var dialogue = Paths.file('songs/$songName/${prefix}dialogue.xml');
persistentUpdate = true; persistentUpdate = true;
var toCall:Void->Void = function() { var toCall:Void->Void = function() {
if(checkSeen) seenCutscene = true; if(checkSeen) seenCutscene = true;
@@ -1224,9 +1226,9 @@ class PlayState extends MusicBeatState
FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false)); FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false));
} }
if (FlxG.keys.justPressed.F5) { if (FlxG.keys.justPressed.F5) {
Logs.trace('Reloading scripts...', WARNING, YELLOW); Logs.trace('[PlayState] Reloading scripts...', WARNING, YELLOW);
scripts.reload(); scripts.reload();
Logs.trace('Song scripts successfully reloaded.', WARNING, GREEN); Logs.trace('[PlayState] Song scripts successfully reloaded.', WARNING, GREEN);
} }
} }
@@ -1486,14 +1488,14 @@ class PlayState extends MusicBeatState
} }
else else
{ {
trace('LOADING NEXT SONG'); // TODO: make this colored
trace(PlayState.storyPlaylist[0].toLowerCase(), difficulty); Logs.trace('[PlayState] Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', VERBOSE);
registerSmoothTransition(); registerSmoothTransition();
FlxG.sound.music.stop(); FlxG.sound.music.stop();
PlayState.__loadSong(PlayState.storyPlaylist[0].toLowerCase(), difficulty); __loadSong(storyPlaylist[0].toLowerCase(), difficulty);
FlxG.switchState(new PlayState()); FlxG.switchState(new PlayState());
} }
@@ -1883,12 +1885,12 @@ class PlayState extends MusicBeatState
* @param opponentMode Whenever opponent mode is on * @param opponentMode Whenever opponent mode is on
* @param coopMode Whenever co-op mode is on. * @param coopMode Whenever co-op mode is on.
*/ */
public static function loadSong(name:String, difficulty:String = "normal", opponentMode:Bool = false, coopMode:Bool = false) { public static function loadSong(_name:String, _difficulty:String = "normal", _opponentMode:Bool = false, _coopMode:Bool = false) {
isStoryMode = false; isStoryMode = false;
PlayState.opponentMode = opponentMode; opponentMode = _opponentMode;
chartingMode = false; chartingMode = false;
PlayState.coopMode = coopMode; coopMode = _coopMode;
__loadSong(name, difficulty); __loadSong(_name, _difficulty);
} }
/** /**
@@ -1896,11 +1898,11 @@ class PlayState extends MusicBeatState
* @param name Song name * @param name Song name
* @param difficulty Song difficulty * @param difficulty Song difficulty
*/ */
public static function __loadSong(name:String, difficulty:String) { public static function __loadSong(_name:String, _difficulty:String) {
PlayState.difficulty = difficulty; difficulty = _difficulty;
PlayState.SONG = Chart.parse(name, difficulty); SONG = Chart.parse(_name, _difficulty);
PlayState.fromMods = PlayState.SONG.fromMods; fromMods = SONG.fromMods;
} }
} }
@@ -78,7 +78,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
}); });
if(error) return false; if(error) return false;
Options.contributors = idk; Options.contributors = idk;
trace('Contributors list Updated!'); Logs.trace('[CreditsCodename] Contributors list Updated!', VERBOSE);
var errorOnMain:Bool = false; var errorOnMain:Bool = false;
var idk2 = GitHub.getOrganizationMembers(author, function(e) { var idk2 = GitHub.getOrganizationMembers(author, function(e) {
@@ -89,7 +89,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
}); });
if(!errorOnMain) { if(!errorOnMain) {
Options.mainDevs = [for(m in idk2) m.id]; Options.mainDevs = [for(m in idk2) m.id];
trace('Main Devs list Updated!'); Logs.trace('[CreditsCodename] Main Devs list Updated!', VERBOSE);
} }
return true; return true;
+4 -4
View File
@@ -26,7 +26,7 @@ class CreditsMain extends TreeMenu {
try { try {
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source))); access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source)));
} catch(e) { } catch(e) {
Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR); Logs.trace('[CreditsMain] Error while parsing credits.xml: ${Std.string(e)}', ERROR);
} }
if (access != null) if (access != null)
@@ -50,7 +50,7 @@ class CreditsMain extends TreeMenu {
/** /**
* XML STUFF * XML STUFF
*/ */
public function parseCreditsFromXML(xml:Access, source:Bool):Array<OptionType> { public function parseCreditsFromXML(xml:Access, source:funkin.backend.assets.AssetsLibraryList.AssetSource):Array<OptionType> {
var credsMenus:Array<OptionType> = []; var credsMenus:Array<OptionType> = [];
for(node in xml.elements) { for(node in xml.elements) {
@@ -58,7 +58,7 @@ class CreditsMain extends TreeMenu {
if (node.name == "github") { if (node.name == "github") {
if (!node.has.user) { if (!node.has.user) {
Logs.trace("A github node requires a user attribute.", WARNING); Logs.trace("[CreditsMain] A github node requires a user attribute.", WARNING);
continue; continue;
} }
@@ -75,7 +75,7 @@ class CreditsMain extends TreeMenu {
)); ));
} else { } else {
if (!node.has.name) { if (!node.has.name) {
Logs.trace("A credit node requires a name attribute.", WARNING); Logs.trace("[CreditsMain] A credit node requires a name attribute.", WARNING);
continue; continue;
} }
var name = node.getAtt("name"); var name = node.getAtt("name");