song load fix lol woops!

This commit is contained in:
Cameron Taylor 2022-01-28 12:20:03 -05:00
parent 71ca1f8d3a
commit b46a276671
2 changed files with 37 additions and 20 deletions

View file

@ -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<Dynamic> = 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
}
}
}

View file

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