Note rendering broken after BPM change fix

This commit is contained in:
Lasercar 2025-03-16 20:18:02 +10:00
parent edb270d15e
commit 116d22b98f

View file

@ -1,6 +1,9 @@
package funkin.ui.debug.charting.commands;
import funkin.data.song.SongData.SongTimeChange;
import funkin.data.song.SongDataUtils;
import funkin.data.song.SongData.SongEventData;
import funkin.data.song.SongData.SongNoteData;
/**
* A command which changes the starting BPM of the song.
@ -34,14 +37,15 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.currentSongMetadata.timeChanges = timeChanges;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
state.notePreviewViewportBoundsDirty = true;
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
// Fix the positions of the notes and events (don't ask me how this works, I have no clue). It just works!
// I considered putting this in updateGridHeight() but I've noticed it gets updated in a lot of places, so I won't.
state.currentSongChartNoteData = SongDataUtils.offsetSongNoteData(state.currentSongChartNoteData, 0);
state.currentSongChartEventData = SongDataUtils.offsetSongEventData(cstate.currentSongChartEventData, 0);
}
public function undo(state:ChartEditorState):Void
@ -58,14 +62,12 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.currentSongMetadata.timeChanges = timeChanges;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
state.notePreviewViewportBoundsDirty = true;
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
state.currentSongChartNoteData = SongDataUtils.offsetSongNoteData(state.currentSongChartNoteData, 0);
state.currentSongChartEventData = SongDataUtils.offsetSongEventData(cstate.currentSongChartEventData, 0);
}
public function shouldAddToHistory(state:ChartEditorState):Bool