diff --git a/buildnumber.txt b/buildnumber.txt index 0a678c62..bf0a67dc 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1081 \ No newline at end of file +1084 \ No newline at end of file diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 6398bc36..9b4b4334 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -206,11 +206,7 @@ class FreeplayState extends MusicBeatState if (controls.ACCEPT) { - PlayState.SONG = Song.loadFromJson(songs[curSelected].songName, songs[curSelected].difficulties[curDifficulty]); - PlayState.isStoryMode = false; - - // PlayState.storyWeek = songs[curSelected].week; - trace('CUR WEEK' + PlayState.storyWeek); + CoolUtil.loadSong(songs[curSelected].songName, songs[curSelected].difficulties[curDifficulty]); FlxG.switchState(new PlayState()); } } diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index c04c2c01..3ce161f1 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -44,7 +44,7 @@ class PauseSubState extends MusicBeatSubstate levelInfo.updateHitbox(); add(levelInfo); - var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, PlayState.difficulty, 32); + var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, PlayState.difficulty.toUpperCase(), 32); levelDifficulty.scrollFactor.set(); levelDifficulty.setFormat(Paths.font('vcr.ttf'), 32); levelDifficulty.updateHitbox(); diff --git a/source/funkin/menus/StoryMenuState.hx b/source/funkin/menus/StoryMenuState.hx index 3bd13ccf..7721c016 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -1,5 +1,6 @@ package funkin.menus; +import flixel.util.FlxTimer; import flixel.math.FlxPoint; import funkin.system.XMLUtil; import flixel.graphics.frames.FlxFramesCollection; @@ -141,8 +142,8 @@ class StoryMenuState extends MusicBeatState { changeDifficulty((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0)); changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); - if (controls.ACCEPT) { - } + if (controls.ACCEPT) + selectWeek(); } else { for(e in [leftArrow, rightArrow]) e.animation.play('idle'); @@ -186,9 +187,9 @@ class StoryMenuState extends MusicBeatState { FlxTween.tween(diffSprite, {y: leftArrow.y, alpha: 1}, 0.07); } - - intendedScore = Highscore.getWeekScore(weeks[curWeek].name, weeks[curWeek].difficulties[curDifficulty]).score; } + + intendedScore = Highscore.getWeekScore(weeks[curWeek].name, weeks[curWeek].difficulties[curDifficulty]).score; } public function loadXMLs() { @@ -202,6 +203,24 @@ class StoryMenuState extends MusicBeatState { e.offset.put(); } + public function selectWeek() { + canSelect = false; + CoolUtil.playMenuSFX(1); + + for(char in characterSprites) + if (char.animation.exists("confirm")) + char.animation.play("confirm"); + + CoolUtil.loadWeek(weeks[curWeek], weeks[curWeek].difficulties[curDifficulty]); + + + new FlxTimer().start(1, function(tmr:FlxTimer) + { + FlxG.switchState(new PlayState()); + }); + weekSprites.members[curWeek].startFlashing(); + } + public function loadXML(xmlPath:String) { try { var xml = new Access(Xml.parse(Assets.getText(xmlPath)).firstElement()); diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index 72f2f801..a589fe8a 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -1,5 +1,6 @@ package funkin.system; +import funkin.menus.StoryMenuState.WeekData; import flixel.graphics.frames.FlxAtlasFrames; import flixel.system.FlxAssets.FlxGraphicAsset; import flixel.graphics.FlxGraphic; @@ -225,6 +226,22 @@ class CoolUtil } } + public static function loadWeek(weekData:WeekData, difficulty:String = "normal") { + PlayState.storyWeek = weekData; + PlayState.storyPlaylist = [for(e in weekData.songs) e.name]; + PlayState.isStoryMode = true; + PlayState.campaignScore = 0; + __loadSong(PlayState.storyPlaylist[0], difficulty); + } + public static function loadSong(name:String, difficulty:String = "normal") { + PlayState.campaignScore = 0; + PlayState.isStoryMode = false; + __loadSong(name, difficulty); + } + public static function __loadSong(name:String, difficulty:String) { + PlayState.difficulty = difficulty; + PlayState.SONG = Song.loadFromJson(name, difficulty); + } public static function setSpriteSize(sprite:FlxSprite, width:Float, height:Float) { sprite.scale.set(width / sprite.frameWidth, height / sprite.frameHeight); sprite.updateHitbox();