songs asset management (waiting for poll to end)

This commit is contained in:
Yoshman29
2023-01-08 22:04:06 +01:00
parent 9c39a047b9
commit 84b2f07c1d
172 changed files with 14 additions and 19 deletions
+4 -3
View File
@@ -505,8 +505,8 @@ class PlayState extends MusicBeatState
detailsText = isStoryMode ? ("Story Mode: " + storyWeek.name) : "Freeplay";
// Checks if cutscene files exists
var cutscenePath = Paths.script('data/cutscenes/${SONG.song.toLowerCase()}');
var endCutscenePath = Paths.script('data/cutscenes/${SONG.song.toLowerCase()}-end');
var cutscenePath = Paths.script('songs/${SONG.song.toLowerCase()}/cutscene');
var endCutscenePath = Paths.script('songs/${SONG.song.toLowerCase()}/cutscene-end');
if (Assets.exists(cutscenePath)) cutscene = cutscenePath;
if (Assets.exists(endCutscenePath)) endCutscene = endCutscenePath;
@@ -549,7 +549,7 @@ class PlayState extends MusicBeatState
// ADD YOUR HARDCODED SCRIPTS HERE!
default:
for(content in [
Paths.getFolderContent('data/charts/${SONG.song.toLowerCase()}/', false, true, !fromMods),
Paths.getFolderContent('songs/${SONG.song.toLowerCase()}/scripts', false, true, !fromMods),
Paths.getFolderContent('data/charts/', false, true, !fromMods)]) {
for(file in content) {
var ext = Path.extension(file).toLowerCase();
@@ -662,6 +662,7 @@ class PlayState extends MusicBeatState
public function startCutscene() {
if (playCutscenes) {
var videoCutscene = Paths.video('${PlayState.SONG.song.toLowerCase()}-cutscene');
var videoCutsceneAlt = Paths.video('${PlayState.SONG.song.toLowerCase()}-cutscene');
persistentUpdate = false;
if (cutscene != null) {
openSubState(new ScriptedCutscene(cutscene, function() {
+1 -1
View File
@@ -300,7 +300,7 @@ class SongMetadata
if (difficulties != null && difficulties.length > 0) {
this.difficulties = difficulties;
} else {
this.difficulties = difficulties = [for(f in Paths.getFolderContent('data/charts/${song.toLowerCase()}/', false, false, fromSource)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
this.difficulties = difficulties = [for(f in Paths.getFolderContent('songs/${song.toLowerCase()}/charts/', false, false, fromSource)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
if (difficulties.length == 3) {
var hasHard = false, hasNormal = false, hasEasy = false;
for(d in difficulties) {
+8 -12
View File
@@ -110,14 +110,14 @@ class Paths
inline static public function voices(song:String, difficulty:String = "normal")
{
var diff = getPath('songs/${song.toLowerCase()}/Voices-$difficulty.$SOUND_EXT', MUSIC, null);
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Voices.$SOUND_EXT', MUSIC, null);
var diff = getPath('songs/${song.toLowerCase()}/audio/Voices-$difficulty.$SOUND_EXT', MUSIC, null);
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/audio/Voices.$SOUND_EXT', MUSIC, null);
}
inline static public function inst(song:String, difficulty:String = "normal")
{
var diff = getPath('songs/${song.toLowerCase()}/Inst-$difficulty.$SOUND_EXT', MUSIC, null);
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null);
var diff = getPath('songs/${song.toLowerCase()}/audio/Inst-$difficulty.$SOUND_EXT', MUSIC, null);
return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/audio/Inst.$SOUND_EXT', MUSIC, null);
}
inline static public function image(key:String, ?library:String, checkForAtlas:Bool = false)
@@ -148,18 +148,14 @@ class Paths
var difficultyEnd = (difficulty == "normal") ? "" : '-$difficulty';
// songs/your-song/charts/hard.json
var p = getPath('songs/$song/charts/$difficulty.json', TEXT, null);
if (OpenFlAssets.exists(p)) return p;
// data/charts/your-song/hard.json
var p = json('charts/$song/$difficulty');
if (OpenFlAssets.exists(p)) return p;
// data/charts/your-song/your-song-hard.json
var p2 = json('charts/$song/$song$difficultyEnd');
if (OpenFlAssets.exists(p2)) return p2;
// data/your-song/your-song-hard.json (default old format)
p2 = json('$song/$song$difficultyEnd');
if (OpenFlAssets.exists(p2)) return p2;
return p; // returns the normal one so that it shows the correct path in the error message.
}