diff --git a/source/SongLoad.hx b/source/SongLoad.hx index bcc2200b3..ff1b94549 100644 --- a/source/SongLoad.hx +++ b/source/SongLoad.hx @@ -148,20 +148,35 @@ class SongLoad if (noteStuff == null) return; + trace(noteStuff); + for (sectionIndex => section in noteStuff) { for (noteIndex => noteDataArray in section.sectionNotes) { + trace(noteDataArray); + var arrayDipshit:Array = cast noteDataArray; // crackhead - // at this point noteStuff[sectionIndex].sectionNotes[noteIndex] is an array because of the cast from the first line in this function - // so this line right here turns it back into the NoteData typedef type because of another bastard cast - noteStuff[sectionIndex].sectionNotes[noteIndex] = cast SongLoad.getDefaultNoteData(); // turn it from an array (because of the cast), back to noteData? yeah that works + trace(arrayDipshit); - noteStuff[sectionIndex].sectionNotes[noteIndex].strumTime = arrayDipshit[0]; - noteStuff[sectionIndex].sectionNotes[noteIndex].noteData = arrayDipshit[1]; - noteStuff[sectionIndex].sectionNotes[noteIndex].sustainLength = arrayDipshit[2]; - noteStuff[sectionIndex].sectionNotes[noteIndex].altNote = arrayDipshit[3]; + if (arrayDipshit != null) + { + // at this point noteStuff[sectionIndex].sectionNotes[noteIndex] is an array because of the cast from the first line in this function + // so this line right here turns it back into the NoteData typedef type because of another bastard cast + noteStuff[sectionIndex].sectionNotes[noteIndex] = cast SongLoad.getDefaultNoteData(); // turn it from an array (because of the cast), back to noteData? yeah that works + + noteStuff[sectionIndex].sectionNotes[noteIndex].strumTime = arrayDipshit[0]; + noteStuff[sectionIndex].sectionNotes[noteIndex].noteData = arrayDipshit[1]; + noteStuff[sectionIndex].sectionNotes[noteIndex].sustainLength = arrayDipshit[2]; + noteStuff[sectionIndex].sectionNotes[noteIndex].altNote = arrayDipshit[3]; + } + else if (noteDataArray != null) + { + noteStuff[sectionIndex].sectionNotes[noteIndex] = cast noteDataArray; + } + else + throw "shit brokey"; // i actually dont know how throw works lol } } } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index da974ae18..8ff7d1370 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -310,21 +310,23 @@ class StoryMenuState extends MusicBeatState PlayState.isStoryMode = true; selectedWeek = true; - var diffic = ""; - - switch (curDifficulty) - { - case 0: - diffic = '-easy'; - case 2: - diffic = '-hard'; - } - - PlayState.storyDifficulty = curDifficulty; - - PlayState.SONG = SongLoad.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase()); + PlayState.SONG = SongLoad.loadFromJson(PlayState.storyPlaylist[0].toLowerCase(), PlayState.storyPlaylist[0].toLowerCase()); PlayState.storyWeek = curWeek; PlayState.campaignScore = 0; + + PlayState.storyDifficulty = curDifficulty; + SongLoad.curDiff = switch (curDifficulty) + { + case 0: + 'easy'; + case 1: + 'normal'; + case 2: + 'hard'; + default: + 'normal'; + }; + new FlxTimer().start(1, function(tmr:FlxTimer) { LoadingState.loadAndSwitchState(new PlayState(), true);