1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-03-21 09:29:41 +00:00

Fix crashing, broken countdown, broken miss muting in song preview

This commit is contained in:
EliteMasterEric 2023-08-04 17:25:13 -04:00
parent a0a8d47216
commit b9c25d6ed9
5 changed files with 40 additions and 13 deletions

View file

@ -31,7 +31,10 @@ class Countdown
{
countdownStep = BEFORE;
var cancelled:Bool = propagateCountdownEvent(countdownStep);
if (cancelled) return false;
if (cancelled)
{
return false;
}
// Stop any existing countdown.
stopCountdown();
@ -67,7 +70,10 @@ class Countdown
// Event handling bullshit.
var cancelled:Bool = propagateCountdownEvent(countdownStep);
if (cancelled) pauseCountdown();
if (cancelled)
{
pauseCountdown();
}
if (countdownStep == AFTER)
{

View file

@ -952,7 +952,7 @@ class PlayState extends MusicBeatSubState
{
// If there is a substate which requires the game to continue,
// then make this a condition.
var shouldPause = true;
var shouldPause = (Std.isOfType(subState, PauseSubState) || Std.isOfType(subState, GameOverSubState));
if (shouldPause)
{
@ -966,6 +966,7 @@ class PlayState extends MusicBeatSubState
// Pause the countdown.
Countdown.pauseCountdown();
}
else {}
super.openSubState(subState);
}
@ -1672,7 +1673,8 @@ class PlayState extends MusicBeatSubState
}
FlxG.sound.music.onComplete = endSong;
FlxG.sound.music.play(false, startTimestamp);
FlxG.sound.music.play();
FlxG.sound.music.time = startTimestamp;
trace('Playing vocals...');
add(vocals);
vocals.play();
@ -2627,6 +2629,7 @@ class PlayState extends MusicBeatSubState
else
{
FlxG.sound.music.pause();
vocals.pause();
remove(vocals);
}

View file

@ -235,8 +235,8 @@ class BaseCharacter extends Bopper
// Then reapply animOffsets...
// applyAnimationOffsets(getCurrentAnimation());
// Make sure we are playing the idle animation
this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song.
// Make sure we are playing the idle animation
// ...then update the hitbox so that this.width and this.height are correct.
this.updateHitbox();

View file

@ -40,7 +40,7 @@ class ChartEditorNotePreview extends FlxSprite
*/
function buildBackground():Void
{
makeGraphic(WIDTH, 0, BG_COLOR);
makeGraphic(WIDTH, previewHeight, BG_COLOR);
}
/**

View file

@ -1247,7 +1247,8 @@ class ChartEditorState extends HaxeUIState
var height:Int = FlxG.height - MENU_BAR_HEIGHT - GRID_TOP_PAD - 200;
notePreview = new ChartEditorNotePreview(height);
notePreview.y = MENU_BAR_HEIGHT + GRID_TOP_PAD;
add(notePreview);
// TODO: Re-enable.
// add(notePreview);
}
function buildSpectrogram(target:FlxSound):Void
@ -3496,14 +3497,23 @@ class ChartEditorState extends HaxeUIState
* @param charKey Character to load the vocal track for.
* @return Success or failure.
*/
public function loadVocalsFromAsset(path:String, charKey:String = 'default'):Bool
public function loadVocalsFromAsset(path:String, charType:CharacterType = OTHER):Bool
{
var vocalTrack:FlxSound = FlxG.sound.load(path, 1.0, false);
if (vocalTrack != null)
{
audioVocalTrackGroup.add(vocalTrack);
audioVocalTrackData.set(charKey, Assets.getBytes(path));
switch (charType)
{
case CharacterType.BF:
audioVocalTrackGroup.addPlayerVoice(vocalTrack);
audioVocalTrackData.set(currentSongCharacterPlayer, Assets.getBytes(path));
case CharacterType.DAD:
audioVocalTrackGroup.addOpponentVoice(vocalTrack);
audioVocalTrackData.set(currentSongCharacterOpponent, Assets.getBytes(path));
default:
audioVocalTrackGroup.add(vocalTrack);
audioVocalTrackData.set('default', Assets.getBytes(path));
}
return true;
}
@ -3565,9 +3575,17 @@ class ChartEditorState extends HaxeUIState
loadInstrumentalFromAsset(Paths.inst(songId));
var voiceList:Array<String> = song.getDifficulty(selectedDifficulty).buildVoiceList();
for (voicePath in voiceList)
if (voiceList.length == 2)
{
loadVocalsFromAsset(voicePath);
loadVocalsFromAsset(voiceList[0], BF);
loadVocalsFromAsset(voiceList[1], DAD);
}
else
{
for (voicePath in voiceList)
{
loadVocalsFromAsset(voicePath);
}
}
NotificationManager.instance.addNotification(