diff --git a/source/funkin/data/song/SongNoteDataUtils.hx b/source/funkin/data/song/SongNoteDataUtils.hx index 5a9a3e8c2a..d005593cf3 100644 --- a/source/funkin/data/song/SongNoteDataUtils.hx +++ b/source/funkin/data/song/SongNoteDataUtils.hx @@ -125,6 +125,7 @@ class SongNoteDataUtils var noteA:SongNoteData = lhs[j]; if (doNotesStack(noteA, noteB, threshold)) { + // Longer hold notes should have priority over shorter hold notes if (noteA.length <= noteB.length) { overwrittenNotes?.push(result[j].clone()); @@ -145,9 +146,8 @@ class SongNoteDataUtils * @param threshold Time difference in milliseconds. * @return Returns `true` if both notes are on the same strumline, have the same direction and their time difference is less than `threshold`. */ - public static function doNotesStack(noteA:SongNoteData, noteB:SongNoteData, threshold:Float = 20):Bool + public static inline function doNotesStack(noteA:SongNoteData, noteB:SongNoteData, threshold:Float = 20):Bool { - // TODO: Make this function inline again when I'm done debugging. return noteA.data == noteB.data && Math.ffloor(Math.abs(noteA.time - noteB.time)) <= threshold; } } diff --git a/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx b/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx index d9c671e890..23bee6071d 100644 --- a/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx @@ -44,10 +44,10 @@ class PasteItemsCommand implements ChartEditorCommand addedEvents = SongDataUtils.offsetSongEventData(currentClipboard.events, Std.int(targetTimestamp)); addedEvents = SongDataUtils.clampSongEventData(addedEvents, 0.0, msCutoff); - var noteConcat:Array = SongNoteDataUtils.concatOverwrite(state.currentSongChartNoteData, addedNotes, removedNotes, + var mergedNotes:Array = SongNoteDataUtils.concatOverwrite(state.currentSongChartNoteData, addedNotes, removedNotes, ChartEditorState.stackNoteThreshold); - state.currentSongChartNoteData = noteConcat; + state.currentSongChartNoteData = mergedNotes; state.currentSongChartEventData = state.currentSongChartEventData.concat(addedEvents); state.currentNoteSelection = addedNotes.copy(); state.currentEventSelection = addedEvents.copy(); @@ -58,7 +58,6 @@ class PasteItemsCommand implements ChartEditorCommand state.sortChartData(); - // FIXME: execute() is reused as a redo function so these messages show up even when not actually pasting if (removedNotes.length > 0) state.warning('Paste Successful', 'However overlapped notes were overwritten.'); else state.success('Paste Successful', 'Successfully pasted clipboard contents.'); @@ -68,7 +67,8 @@ class PasteItemsCommand implements ChartEditorCommand { state.playSound(Paths.sound('chartingSounds/undo')); - state.currentSongChartNoteData = SongDataUtils.subtractNotes(state.currentSongChartNoteData, addedNotes).concat(removedNotes); + state.currentSongChartNoteData = SongDataUtils.subtractNotes(state.currentSongChartNoteData, addedNotes); + state.currentSongChartNoteData = SongNoteDataUtils.concatOverwrite(state.currentSongChartNoteData, removedNotes, ChartEditorState.stackNoteThreshold); state.currentSongChartEventData = SongDataUtils.subtractEvents(state.currentSongChartEventData, addedEvents); state.currentNoteSelection = removedNotes.copy(); state.currentEventSelection = [];