From 8ef380e0b208d75c4e3bdd44ef05c4f4dca2c392 Mon Sep 17 00:00:00 2001 From: EliteMasterEric <ericmyllyoja@gmail.com> Date: Wed, 29 Nov 2023 16:53:08 -0500 Subject: [PATCH] Resolve merge issues --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- .../charting/commands/ChangeStartingBPMCommand.hx | 11 +++++++++-- .../charting/handlers/ChartEditorToolboxHandler.hx | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index b8b7b3bea..a3a8344c8 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -4613,7 +4613,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var prevDifficulty = availableDifficulties[availableDifficulties.length - 1]; selectedDifficulty = prevDifficulty; - Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges); + Conductor.mapTimeChanges(this.currentSongMetadata.timeChanges); refreshDifficultyTreeSelection(); refreshMetadataToolbox(); diff --git a/source/funkin/ui/debug/charting/commands/ChangeStartingBPMCommand.hx b/source/funkin/ui/debug/charting/commands/ChangeStartingBPMCommand.hx index f5f978aa2..3c45c1168 100644 --- a/source/funkin/ui/debug/charting/commands/ChangeStartingBPMCommand.hx +++ b/source/funkin/ui/debug/charting/commands/ChangeStartingBPMCommand.hx @@ -1,5 +1,7 @@ package funkin.ui.debug.charting.commands; +import funkin.data.song.SongData.SongTimeChange; + /** * A command which changes the starting BPM of the song. */ @@ -22,12 +24,12 @@ class ChangeStartingBPMCommand implements ChartEditorCommand if (timeChanges == null || timeChanges.length == 0) { previousBPM = 100; - timeChanges = [new SongTimeChange(0, event.value)]; + timeChanges = [new SongTimeChange(0, targetBPM)]; } else { previousBPM = timeChanges[0].bpm; - timeChanges[0].bpm = event.value; + timeChanges[0].bpm = targetBPM; } state.currentSongMetadata.timeChanges = timeChanges; @@ -51,4 +53,9 @@ class ChangeStartingBPMCommand implements ChartEditorCommand Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges); } + + public function toString():String + { + return 'Change Starting BPM to ${targetBPM}'; + } } diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index b9cae0376..418f57464 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -11,6 +11,7 @@ import funkin.play.character.BaseCharacter.CharacterType; import funkin.play.event.SongEvent; import funkin.data.event.SongEventData; import funkin.data.song.SongData.SongTimeChange; +import funkin.ui.debug.charting.commands.ChangeStartingBPMCommand; import funkin.play.character.BaseCharacter.CharacterType; import funkin.play.character.CharacterData; import funkin.play.character.CharacterData.CharacterDataParser; @@ -611,7 +612,11 @@ class ChartEditorToolboxHandler if (event.value == null || event.value <= 0) return; // Use a command so we can undo/redo this action. - state.performCommand(new ChangeStartingBPMCommand(event.value)); + var startingBPM = state.currentSongMetadata.timeChanges[0].bpm; + if (event.value != startingBPM) + { + state.performCommand(new ChangeStartingBPMCommand(event.value)); + } }; inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm;