An attempt to fix skipping the next song randomly

This commit is contained in:
Ralty
2025-08-07 20:01:23 +07:00
parent 7c8dd987dd
commit 9c7cc22a47
+16 -27
View File
@@ -1689,17 +1689,12 @@ class PlayState extends MusicBeatState
endingSong = true; endingSong = true;
gameAndCharsCall("onSongEnd"); gameAndCharsCall("onSongEnd");
canPause = false; canPause = false;
inst.volume = 0;
vocals.volume = 0;
for (strumLine in strumLines.members) {
strumLine.vocals.volume = 0;
strumLine.vocals.pause();
}
inst.pause();
vocals.pause();
if (validScore) for (strumLine in strumLines.members) strumLine.vocals.stop();
{ inst.stop();
vocals.stop();
if (validScore) {
#if !switch #if !switch
FunkinSave.setSongHighscore(SONG.meta.name, difficulty, { FunkinSave.setSongHighscore(SONG.meta.name, difficulty, {
score: songScore, score: songScore,
@@ -1727,20 +1722,18 @@ class PlayState extends MusicBeatState
* Immediately switches to the next song, or goes back to the Story/Freeplay menu. * Immediately switches to the next song, or goes back to the Story/Freeplay menu.
*/ */
public function nextSong() { public function nextSong() {
if (isStoryMode) if (isStoryMode) {
{
campaignScore += songScore; campaignScore += songScore;
campaignMisses += misses; campaignMisses += misses;
campaignAccuracyTotal += accuracy; campaignAccuracyTotal += accuracy;
campaignAccuracyCount++; campaignAccuracyCount++;
storyPlaylist.shift(); storyPlaylist.shift();
if (storyPlaylist.length <= 0) if (storyPlaylist.length <= 0) {
{
FlxG.switchState(new StoryMenuState()); FlxG.switchState(new StoryMenuState());
if (validScore) if (validScore) {
{ #if !switch
// TODO: more week info saving // TODO: more week info saving
FunkinSave.setWeekHighscore(storyWeek.id, difficulty, { FunkinSave.setWeekHighscore(storyWeek.id, difficulty, {
score: campaignScore, score: campaignScore,
@@ -1749,29 +1742,23 @@ class PlayState extends MusicBeatState
hits: [], hits: [],
date: Date.now().toString() date: Date.now().toString()
}); });
#end
} }
FlxG.save.flush(); FlxG.save.flush();
} }
else else {
{
Logs.infos('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', "PlayState"); Logs.infos('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', "PlayState");
registerSmoothTransition(); registerSmoothTransition();
FlxG.sound.music.stop();
__loadSong(storyPlaylist[0], difficulty); __loadSong(storyPlaylist[0], difficulty);
FlxG.switchState(new PlayState()); FlxG.switchState(new PlayState());
} }
} }
else if (chartingMode)
FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false));
else else
{ FlxG.switchState(new FreeplayState());
if (chartingMode)
FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false));
else
FlxG.switchState(new FreeplayState());
}
} }
public function registerSmoothTransition() { public function registerSmoothTransition() {
@@ -1943,6 +1930,8 @@ class PlayState extends MusicBeatState
} }
if (event.deleteNote) strumLine.deleteNote(note); if (event.deleteNote) strumLine.deleteNote(note);
gameAndCharsEvent("onPostNoteHit", event);
} }
public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void { public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void {