From 7958c49007a8f323c00eb4f1d9c23ad49881d73e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 3 Feb 2022 10:32:29 -0500 Subject: [PATCH] charting editor diff selector in progress --- source/SongLoad.hx | 11 +++++++++++ source/charting/ChartingState.hx | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/source/SongLoad.hx b/source/SongLoad.hx index 7d1a8861b..55601394e 100644 --- a/source/SongLoad.hx +++ b/source/SongLoad.hx @@ -96,11 +96,19 @@ class SongLoad } } + checkAndCreateNotemap(curDiff); + songShit = songData.noteMap[diff]; return songShit; } + public static function checkAndCreateNotemap(diff:String):Void + { + if (songData.noteMap[diff] == null) + songData.noteMap[diff] = []; + } + public static function getSpeed(?diff:String):Float { if (diff == null) @@ -120,6 +128,9 @@ class SongLoad speedShit = songData.speed.hard; } + if (songData.speedMap[diff] == null) + songData.speedMap[diff] = 1; + speedShit = songData.speedMap[diff]; return speedShit; diff --git a/source/charting/ChartingState.hx b/source/charting/ChartingState.hx index d9a19e5cc..c52326083 100644 --- a/source/charting/ChartingState.hx +++ b/source/charting/ChartingState.hx @@ -250,6 +250,13 @@ class ChartingState extends MusicBeatState }); player2DropDown.selectedLabel = _song.player2; + var difficultyDropDown = new FlxUIDropDownMenu(10, 230, FlxUIDropDownMenu.makeStrIdLabelArray(_song.difficulties, true), function(diff:String) + { + SongLoad.curDiff = _song.difficulties[Std.parseInt(diff)]; + SongLoad.checkAndCreateNotemap(SongLoad.curDiff); + }); + difficultyDropDown.selectedLabel = SongLoad.curDiff; + var tab_group_song = new FlxUI(null, UI_box); tab_group_song.name = "Song"; tab_group_song.add(UI_songTitle); @@ -265,6 +272,7 @@ class ChartingState extends MusicBeatState tab_group_song.add(stepperSpeed); tab_group_song.add(player1DropDown); tab_group_song.add(player2DropDown); + tab_group_song.add(difficultyDropDown); UI_box.addGroup(tab_group_song); UI_box.scrollFactor.set(); @@ -582,6 +590,9 @@ class ChartingState extends MusicBeatState playheadTest.y = CoolUtil.coolLerp(playheadTest.y, FlxMath.remapToRange(Conductor.songPosition, 0, FlxG.sound.music.length, 0, FlxG.height), 0.5); + trace(_song.noteMap.toString()); + trace(SongLoad.songData.noteMap.toString()); + trace(SongLoad.curDiff); var strumLinePos:Float = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * SongLoad.getSong()[curSection].lengthInSteps)); if (FlxG.sound.music != null)