Fix backward comp issues and freeplay

This commit is contained in:
Ralty
2025-08-09 20:00:49 +07:00
parent 88ea51064b
commit ec63be9e77
3 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ typedef WeekCharacter = {
typedef WeekSong = {
var name:String;
var ?hide:Bool;
var ?variation:String;
var hide:Bool;
var ?displayName:String;
}
+11 -5
View File
@@ -60,7 +60,11 @@ class PlayState extends MusicBeatState
/**
* The remaining songs in the Story Mode playlist.
*/
public static var storyPlaylist:Array<WeekSong> = [];
public static var storyPlaylist:Array<String> = [];
/**
* The remaining variations to play with the Story Mode
*/
public static var storyVariations:Array<String> = [];
/**
* The selected difficulty name.
*/
@@ -1733,6 +1737,7 @@ class PlayState extends MusicBeatState
campaignAccuracyTotal += accuracy;
campaignAccuracyCount++;
storyPlaylist.shift();
storyVariations.shift();
if (storyPlaylist.length <= 0) {
FlxG.switchState(new StoryMenuState());
@@ -1752,11 +1757,11 @@ class PlayState extends MusicBeatState
FlxG.save.flush();
}
else {
Logs.infos('Loading next song (${storyPlaylist[0].name.toLowerCase()}/$difficulty/${storyPlaylist[0].variation})', "PlayState");
Logs.infos('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty/${storyVariations[0]})', "PlayState");
registerSmoothTransition();
__loadSong(storyPlaylist[0].name, difficulty, variation);
__loadSong(storyPlaylist[0], difficulty, storyVariations[0]);
FlxG.switchState(new PlayState());
}
}
@@ -2135,14 +2140,15 @@ class PlayState extends MusicBeatState
public static function loadWeek(weekData:WeekData, ?difficulty:String) {
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
storyWeek = weekData;
storyPlaylist = weekData.songs.copy();
storyPlaylist = [for (e in weekData.songs) e.name];
storyVariations = [for (e in weekData.songs) e.variation];
isStoryMode = true;
campaignScore = 0;
campaignMisses = 0;
campaignAccuracyTotal = 0;
campaignAccuracyCount = 0;
chartingMode = coopMode = opponentMode = false;
__loadSong(storyPlaylist[0].name, difficulty, storyPlaylist[0].variation);
__loadSong(storyPlaylist[0], difficulty, storyVariations[0]);
}
/**
+1 -6
View File
@@ -182,11 +182,11 @@ class FreeplayState extends MusicBeatState
coopText = new FlxText(diffText.x, diffText.y + diffText.height + 2, 0, "", 24);
coopText.font = scoreText.font;
coopText.visible = curSong.coopAllowed || curSong.opponentModeAllowed;
add(coopText);
add(scoreText);
changeSelection(0, true);
changeDiff(0, true);
changeCoopMode(0, true);
@@ -470,11 +470,6 @@ class FreeplayState extends MusicBeatState
changeDiff(0, true);
#if PRELOAD_ALL
autoplayElapsed = 0;
songInstPlaying = false;
#end
coopText.visible = curSong.coopAllowed || curSong.opponentModeAllowed;
}