Small cleanup

This commit is contained in:
Hyper_ 2024-10-14 17:53:57 -03:00 committed by Hyper_
parent 799e8436eb
commit a1e91510fd

View file

@ -3669,8 +3669,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
}
}
var stackedNotes = NoteDataFilter.listStackedNotes(currentSongChartNoteData, STACK_NOTE_THRESHOLD);
// Add events that are now visible.
for (eventData in currentSongChartEventData)
{
@ -3743,6 +3741,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
member.kill();
}
// Gather stacked notes to render later
var stackedNotes = NoteDataFilter.listStackedNotes(currentSongChartNoteData, STACK_NOTE_THRESHOLD);
// Readd selection squares for selected notes.
// Recycle selection squares if possible.
for (noteSprite in renderedNotes.members)
@ -3805,22 +3806,19 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
var stepLength = noteSprite.noteData.getStepLength();
selectionSquare.height = (stepLength <= 0) ? GRID_SIZE : ((stepLength + 1) * GRID_SIZE);
}
else
// TODO: Move this to a function like isNoteSelected does
else if (doesNoteStack(noteSprite.noteData, stackedNotes))
{
// TODO: Move this to a function like isNoteSelected does
if (noteSprite.noteData != null && stackedNotes.contains(noteSprite.noteData))
{
// TODO: Maybe use another way to display these notes
var selectionSquare:ChartEditorSelectionSquareSprite = renderedSelectionSquares.recycle(buildSelectionSquare);
// TODO: Maybe use another way to display these notes
var selectionSquare:ChartEditorSelectionSquareSprite = renderedSelectionSquares.recycle(buildSelectionSquare);
// Set the position and size (because we might be recycling one with bad values).
selectionSquare.noteData = noteSprite.noteData;
selectionSquare.eventData = null;
selectionSquare.x = noteSprite.x;
selectionSquare.y = noteSprite.y;
selectionSquare.width = selectionSquare.height = GRID_SIZE;
selectionSquare.color = FlxColor.RED;
}
// Set the position and size (because we might be recycling one with bad values).
selectionSquare.noteData = noteSprite.noteData;
selectionSquare.eventData = null;
selectionSquare.x = noteSprite.x;
selectionSquare.y = noteSprite.y;
selectionSquare.width = selectionSquare.height = GRID_SIZE;
selectionSquare.color = FlxColor.RED;
}
}
@ -3871,11 +3869,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
// Sort the events DESCENDING. This keeps the sustain behind the associated note.
renderedEvents.sort(FlxSort.byY, FlxSort.DESCENDING); // TODO: .group.insertionSort()
}
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.H)
{
// performCommand(new RemoveNotesCommand(stackedNotes));
}
}
/**
@ -6412,6 +6405,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return note != null && currentNoteSelection.indexOf(note) != -1;
}
function doesNoteStack(note:Null<SongNoteData>, curStackedNotes:Array<SongNoteData>):Bool
{
return note != null && curStackedNotes.contains(note);
}
override function destroy():Void
{
super.destroy();