fixed everything

highscore would be compatible if the package wasn't changed to KadeDev's own
This commit is contained in:
Lucky56 2021-06-09 00:36:28 +02:00
parent 2d4637cca1
commit fab3e8ecb4
No known key found for this signature in database
GPG Key ID: 19E3875EAD1F8B8F
4 changed files with 41 additions and 19 deletions

View File

@ -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

View File

@ -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';

View File

@ -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());

View File

@ -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("}"))
{