1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-29 08:16:58 +00:00

Fix issues with changing BPMs of songs.

This commit is contained in:
EliteMasterEric 2023-10-17 16:57:06 -04:00
parent 6dbf958d75
commit 4e0934dbd1
4 changed files with 45 additions and 10 deletions

View file

@ -580,8 +580,7 @@ class BaseCharacter extends Bopper
public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void
{ {
FlxG.watch.addQuick('playAnim(${characterName})', name); // FlxG.watch.addQuick('playAnim(${characterName})', name);
// trace('playAnim(${characterName}): ${name}');
super.playAnimation(name, restart, ignoreOther, reversed); super.playAnimation(name, restart, ignoreOther, reversed);
} }
} }

View file

@ -667,8 +667,6 @@ class ChartEditorDialogHandler
timeChanges[0].bpm = event.value; timeChanges[0].bpm = event.value;
} }
Conductor.forceBPM(event.value);
newSongMetadata.timeChanges = timeChanges; newSongMetadata.timeChanges = timeChanges;
}; };
@ -677,6 +675,8 @@ class ChartEditorDialogHandler
dialogContinue.onClick = (_event) -> { dialogContinue.onClick = (_event) -> {
state.songMetadata.set(targetVariation, newSongMetadata); state.songMetadata.set(targetVariation, newSongMetadata);
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
dialog.hideDialog(DialogButton.APPLY); dialog.hideDialog(DialogButton.APPLY);
} }
@ -696,6 +696,8 @@ class ChartEditorDialogHandler
var charData:SongCharacterData = state.currentSongMetadata.playData.characters; var charData:SongCharacterData = state.currentSongMetadata.playData.characters;
var hasClearedVocals:Bool = false;
charIdsForVocals.push(charData.player); charIdsForVocals.push(charData.player);
charIdsForVocals.push(charData.opponent); charIdsForVocals.push(charData.opponent);
@ -715,6 +717,7 @@ class ChartEditorDialogHandler
if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog'; if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog';
dialogNoVocals.onClick = function(_event) { dialogNoVocals.onClick = function(_event) {
// Dismiss // Dismiss
ChartEditorAudioHandler.stopExistingVocals(state);
dialog.hideDialog(DialogButton.APPLY); dialog.hideDialog(DialogButton.APPLY);
}; };
@ -738,6 +741,12 @@ class ChartEditorDialogHandler
trace('Selected file: $pathStr'); trace('Selected file: $pathStr');
var path:Path = new Path(pathStr); var path:Path = new Path(pathStr);
if (!hasClearedVocals)
{
hasClearedVocals = true;
ChartEditorAudioHandler.stopExistingVocals(state);
}
if (ChartEditorAudioHandler.loadVocalsFromPath(state, path, charKey, instId)) if (ChartEditorAudioHandler.loadVocalsFromPath(state, path, charKey, instId))
{ {
// Tell the user the load was successful. // Tell the user the load was successful.
@ -788,6 +797,11 @@ class ChartEditorDialogHandler
if (selectedFile != null && selectedFile.bytes != null) if (selectedFile != null && selectedFile.bytes != null)
{ {
trace('Selected file: ' + selectedFile.name); trace('Selected file: ' + selectedFile.name);
if (!hasClearedVocals)
{
hasClearedVocals = true;
ChartEditorAudioHandler.stopExistingVocals(state);
}
if (ChartEditorAudioHandler.loadVocalsFromBytes(state, selectedFile.bytes, charKey, instId)) if (ChartEditorAudioHandler.loadVocalsFromBytes(state, selectedFile.bytes, charKey, instId))
{ {
// Tell the user the load was successful. // Tell the user the load was successful.

View file

@ -1897,6 +1897,16 @@ class ChartEditorState extends HaxeUIState
handleViewKeybinds(); handleViewKeybinds();
handleTestKeybinds(); handleTestKeybinds();
handleHelpKeybinds(); handleHelpKeybinds();
#if debug
handleQuickWatch();
#end
}
function handleQuickWatch():Void
{
FlxG.watch.addQuick('scrollPosInPixels', scrollPositionInPixels);
FlxG.watch.addQuick('playheadPosInPixels', playheadPositionInPixels);
} }
/** /**
@ -3342,6 +3352,7 @@ class ChartEditorState extends HaxeUIState
if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER) if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER)
{ {
var minimal = FlxG.keys.pressed.SHIFT; var minimal = FlxG.keys.pressed.SHIFT;
ChartEditorToolboxHandler.hideAllToolboxes(this);
testSongInPlayState(minimal); testSongInPlayState(minimal);
} }
} }
@ -4153,14 +4164,13 @@ class ChartEditorState extends HaxeUIState
*/ */
function moveSongToScrollPosition():Void function moveSongToScrollPosition():Void
{ {
// Update the songPosition in the Conductor.
var targetPos = scrollPositionInMs;
Conductor.update(targetPos);
// Update the songPosition in the audio tracks. // Update the songPosition in the audio tracks.
if (audioInstTrack != null) audioInstTrack.time = scrollPositionInMs + playheadPositionInMs; if (audioInstTrack != null) audioInstTrack.time = scrollPositionInMs + playheadPositionInMs;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.time = scrollPositionInMs + playheadPositionInMs; if (audioVocalTrackGroup != null) audioVocalTrackGroup.time = scrollPositionInMs + playheadPositionInMs;
// Update the songPosition in the Conductor.
Conductor.update(audioInstTrack.time);
// We need to update the note sprites because we changed the scroll position. // We need to update the note sprites because we changed the scroll position.
noteDisplayDirty = true; noteDisplayDirty = true;
} }

View file

@ -136,6 +136,18 @@ class ChartEditorToolboxHandler
} }
} }
public static function rememberOpenToolboxes(state:ChartEditorState):Void {}
public static function openRememberedToolboxes(state:ChartEditorState):Void {}
public static function hideAllToolboxes(state:ChartEditorState):Void
{
for (toolbox in state.activeToolboxes.values())
{
toolbox.hideDialog(DialogButton.CANCEL);
}
}
public static function minimizeToolbox(state:ChartEditorState, id:String):Void public static function minimizeToolbox(state:ChartEditorState, id:String):Void
{ {
var toolbox:Null<CollapsibleDialog> = state.activeToolboxes.get(id); var toolbox:Null<CollapsibleDialog> = state.activeToolboxes.get(id);
@ -634,9 +646,9 @@ class ChartEditorToolboxHandler
timeChanges[0].bpm = event.value; timeChanges[0].bpm = event.value;
} }
Conductor.forceBPM(event.value);
state.currentSongMetadata.timeChanges = timeChanges; state.currentSongMetadata.timeChanges = timeChanges;
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
}; };
inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm; inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm;