improvements to the chart editor

This commit is contained in:
KadeDev 2021-03-21 22:40:40 -07:00
parent 4958c23050
commit 43e12a89bf
2 changed files with 40 additions and 12 deletions

View File

@ -77,7 +77,7 @@ class ChartingState extends MusicBeatState
var curSelectedNote:Array<Dynamic>; var curSelectedNote:Array<Dynamic>;
var tempBpm:Int = 0; var tempBpm:Int = 0;
var gridBlackLine:FlxSprite;
var vocals:FlxSound; var vocals:FlxSound;
var leftIcon:HealthIcon; var leftIcon:HealthIcon;
@ -104,7 +104,7 @@ class ChartingState extends MusicBeatState
leftIcon.setPosition(0, -100); leftIcon.setPosition(0, -100);
rightIcon.setPosition(gridBG.width / 2, -100); rightIcon.setPosition(gridBG.width / 2, -100);
var gridBlackLine:FlxSprite = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
add(gridBlackLine); add(gridBlackLine);
curRenderedNotes = new FlxTypedGroup<Note>(); curRenderedNotes = new FlxTypedGroup<Note>();
@ -221,7 +221,7 @@ class ChartingState extends MusicBeatState
stepperSpeed.value = _song.speed; stepperSpeed.value = _song.speed;
stepperSpeed.name = 'song_speed'; stepperSpeed.name = 'song_speed';
var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 1, 1, 1, 339, 0); var stepperBPM:FlxUINumericStepper = new FlxUINumericStepper(10, 65, 0.1, 1, 1.0, 5000.0, 1);
stepperBPM.value = Conductor.bpm; stepperBPM.value = Conductor.bpm;
stepperBPM.name = 'song_bpm'; stepperBPM.name = 'song_bpm';
@ -331,7 +331,7 @@ class ChartingState extends MusicBeatState
var tab_group_note = new FlxUI(null, UI_box); var tab_group_note = new FlxUI(null, UI_box);
tab_group_note.name = 'Note'; tab_group_note.name = 'Note';
stepperSusLength = new FlxUINumericStepper(10, 10, Conductor.stepCrochet / 2, 0, 0, Conductor.stepCrochet * 16); stepperSusLength = new FlxUINumericStepper(10, 10, Conductor.stepCrochet / 2, 0, 0, Conductor.stepCrochet * 16 * 4);
stepperSusLength.value = 0; stepperSusLength.value = 0;
stepperSusLength.name = 'note_susLength'; stepperSusLength.name = 'note_susLength';
@ -416,26 +416,39 @@ class ChartingState extends MusicBeatState
FlxG.log.add(wname); FlxG.log.add(wname);
if (wname == 'section_length') if (wname == 'section_length')
{ {
if (nums.value <= 4)
nums.value = 4;
_song.notes[curSection].lengthInSteps = Std.int(nums.value); _song.notes[curSection].lengthInSteps = Std.int(nums.value);
updateGrid(); updateGrid();
} }
else if (wname == 'song_speed') else if (wname == 'song_speed')
{ {
if (nums.value <= 0)
nums.value = 0;
_song.speed = nums.value; _song.speed = nums.value;
} }
else if (wname == 'song_bpm') else if (wname == 'song_bpm')
{ {
if (nums.value <= 0)
nums.value = 1;
tempBpm = Std.int(nums.value); tempBpm = Std.int(nums.value);
Conductor.mapBPMChanges(_song); Conductor.mapBPMChanges(_song);
Conductor.changeBPM(Std.int(nums.value)); Conductor.changeBPM(Std.int(nums.value));
} }
else if (wname == 'note_susLength') else if (wname == 'note_susLength')
{ {
if (curSelectedNote == null)
return;
if (nums.value <= 0)
nums.value = 0;
curSelectedNote[2] = nums.value; curSelectedNote[2] = nums.value;
updateGrid(); updateGrid();
} }
else if (wname == 'section_bpm') else if (wname == 'section_bpm')
{ {
if (nums.value <= 0.1)
nums.value = 0.1;
_song.notes[curSection].bpm = Std.int(nums.value); _song.notes[curSection].bpm = Std.int(nums.value);
updateGrid(); updateGrid();
} }
@ -509,7 +522,8 @@ class ChartingState extends MusicBeatState
} }
else else
{ {
trace('tryin to delete note...'); trace('tryin to delete note');
trace(note.noteData);
deleteNote(note); deleteNote(note);
} }
} }
@ -667,7 +681,9 @@ class ChartingState extends MusicBeatState
+ " / " + " / "
+ Std.string(FlxMath.roundDecimal(FlxG.sound.music.length / 1000, 2)) + Std.string(FlxMath.roundDecimal(FlxG.sound.music.length / 1000, 2))
+ "\nSection: " + "\nSection: "
+ curSection; + curSection
+ "\nCurStep: "
+ curStep;
super.update(elapsed); super.update(elapsed);
} }
@ -734,6 +750,7 @@ class ChartingState extends MusicBeatState
if (_song.notes[sec] != null) if (_song.notes[sec] != null)
{ {
trace('naw im not null');
curSection = sec; curSection = sec;
updateGrid(); updateGrid();
@ -759,6 +776,8 @@ class ChartingState extends MusicBeatState
updateGrid(); updateGrid();
updateSectionUI(); updateSectionUI();
} }
else
trace('bro wtf I AM NULL');
} }
function copySection(?sectionNum:Int = 1) function copySection(?sectionNum:Int = 1)
@ -811,6 +830,14 @@ class ChartingState extends MusicBeatState
function updateGrid():Void function updateGrid():Void
{ {
remove(gridBG);
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * _song.notes[curSection].lengthInSteps);
add(gridBG);
remove(gridBlackLine);
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
add(gridBlackLine);
while (curRenderedNotes.members.length > 0) while (curRenderedNotes.members.length > 0)
{ {
curRenderedNotes.remove(curRenderedNotes.members[0], true); curRenderedNotes.remove(curRenderedNotes.members[0], true);
@ -911,11 +938,15 @@ class ChartingState extends MusicBeatState
function deleteNote(note:Note):Void function deleteNote(note:Note):Void
{ {
for (i in _song.notes[curSection].sectionNotes) trace(_song.notes[curSection].sectionNotes);
for (n in 0..._song.notes[curSection].sectionNotes.length)
{ {
if (i[0] == note.strumTime && i[1] % 4 == note.noteData) var i = _song.notes[curSection].sectionNotes[n];
if (i == null)
continue;
if (i[0] == note.strumTime + 1 && i[1] % 4 == note.noteData)
{ {
FlxG.log.add('FOUND EVIL NUMBER'); trace('GAMING');
_song.notes[curSection].sectionNotes.remove(i); _song.notes[curSection].sectionNotes.remove(i);
} }
} }

View File

@ -16,9 +16,6 @@ class KadeEngineData
if (FlxG.save.data.accuracyDisplay == null) if (FlxG.save.data.accuracyDisplay == null)
FlxG.save.data.accuracyDisplay = true; FlxG.save.data.accuracyDisplay = true;
if (FlxG.save.data.accuracyDisplay == null)
FlxG.save.data.accuracyDisplay = true;
if (FlxG.save.data.offset == null) if (FlxG.save.data.offset == null)
FlxG.save.data.offset = 0; FlxG.save.data.offset = 0;