diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 2de5ff2..6f7388d 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -202,16 +202,23 @@ class FreeplayState extends MusicBeatState if (accepted) { - // pre lowercasing the song name + // pre lowercasing the song name (update) var songLowercase = StringTools.replace(songs[curSelected].songName, " ", "-").toLowerCase(); switch (songLowercase) { case 'dad-battle': songLowercase = 'dadbattle'; case 'philly-nice': songLowercase = 'philly'; } + // adjusting the highscore song name to be compatible (update) + // would read original scores if we didn't change packages + var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-"); + switch (songHighscore) { + case 'Dad-Battle': songHighscore = 'Dadbattle'; + case 'Philly-Nice': songHighscore = 'Philly'; + } trace(songLowercase); - var poop:String = Highscore.formatSong(songLowercase, curDifficulty); + var poop:String = Highscore.formatSong(songHighscore, curDifficulty); trace(poop); @@ -233,8 +240,15 @@ class FreeplayState extends MusicBeatState if (curDifficulty > 2) curDifficulty = 0; + // adjusting the highscore song name to be compatible (changeDiff) + var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-"); + switch (songHighscore) { + case 'Dad-Battle': songHighscore = 'Dadbattle'; + case 'Philly-Nice': songHighscore = 'Philly'; + } + #if !switch - intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + intendedScore = Highscore.getScore(songHighscore, curDifficulty); #end switch (curDifficulty) @@ -265,9 +279,17 @@ class FreeplayState extends MusicBeatState curSelected = 0; // selector.y = (70 * curSelected) + 30; + + // adjusting the highscore song name to be compatible (changeSelection) + // would read original scores if we didn't change packages + var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-"); + switch (songHighscore) { + case 'Dad-Battle': songHighscore = 'Dadbattle'; + case 'Philly-Nice': songHighscore = 'Philly'; + } #if !switch - intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + intendedScore = Highscore.getScore(songHighscore, curDifficulty); // lerpScore = 0; #end diff --git a/source/Paths.hx b/source/Paths.hx index 3698dd8..075adbd 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -97,7 +97,7 @@ class Paths inline static public function voices(song:String) { - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + var songLowercase = StringTools.replace(song, " ", "-").toLowerCase(); switch (songLowercase) { case 'dad-battle': songLowercase = 'dadbattle'; case 'philly-nice': songLowercase = 'philly'; @@ -107,7 +107,7 @@ class Paths inline static public function inst(song:String) { - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + var songLowercase = StringTools.replace(song, " ", "-").toLowerCase(); switch (songLowercase) { case 'dad-battle': songLowercase = 'dadbattle'; case 'philly-nice': songLowercase = 'philly'; diff --git a/source/PlayState.hx b/source/PlayState.hx index 54afc54..b5107eb 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2458,8 +2458,16 @@ class PlayState extends MusicBeatState vocals.volume = 0; if (SONG.validScore) { + // adjusting the highscore song name to be compatible + // would read original scores if we didn't change packages + var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-"); + switch (songHighscore) { + case 'Dad-Battle': songHighscore = 'Dadbattle'; + case 'Philly-Nice': songHighscore = 'Philly'; + } + #if !switch - Highscore.saveScore(SONG.song, Math.round(songScore), storyDifficulty); + Highscore.saveScore(songHighscore, Math.round(songScore), storyDifficulty); #end } @@ -2547,7 +2555,7 @@ class PlayState extends MusicBeatState FlxTransitionableState.skipNextTransOut = true; prevCamFollow = camFollow; - PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]); + PlayState.SONG = Song.loadFromJson(nextSongLowercase + difficulty, PlayState.storyPlaylist[0]); FlxG.sound.music.stop(); LoadingState.loadAndSwitchState(new PlayState()); diff --git a/source/Song.hx b/source/Song.hx index 13205e5..2b9a130 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -47,18 +47,10 @@ class Song public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong { trace(jsonInput); - // pre lowercasing the folder name - var folderLowercase = StringTools.replace(folder, " ", "-").toLowerCase(); - switch (folderLowercase) { - case 'dad-battle': folderLowercase = 'dadbattle'; - case 'philly-nice': folderLowercase = 'philly'; - } - // pre lowercasing the jsonInput name - var jsonInputLowercase = folderLowercase + StringTools.replace(jsonInput,folder.toLowerCase(), "").toLowerCase(); - - trace('loading ' + folderLowercase + '/' + jsonInputLowercase); - var rawJson = Assets.getText(Paths.json(folderLowercase + '/' + jsonInputLowercase)).trim(); + trace('loading ' + folder + '/' + jsonInput.toLowerCase()); + + var rawJson = Assets.getText(Paths.json(folder + '/' + jsonInput.toLowerCase())).trim(); while (!rawJson.endsWith("}")) {