Skip to content

Commit

Permalink
Hopefully should be good to go now.
Browse files Browse the repository at this point in the history
  • Loading branch information
NotHyper-474 committed Jan 15, 2025
1 parent 7b86f14 commit 77e9cf2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 0 files
4 changes: 2 additions & 2 deletions source/funkin/data/song/SongNoteDataUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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;
}
}
8 changes: 4 additions & 4 deletions source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SongNoteData> = SongNoteDataUtils.concatOverwrite(state.currentSongChartNoteData, addedNotes, removedNotes,
var mergedNotes:Array<SongNoteData> = 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();
Expand All @@ -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.');
Expand All @@ -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 = [];
Expand Down

0 comments on commit 77e9cf2

Please sign in to comment.