From 6f676a5896ffdbfd2db818aceae8302393e4ef83 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 10 Jun 2023 02:56:03 -0400 Subject: [PATCH 1/2] Added new "Mods" story menu section (hidden when no mods are installed) --- source/funkin/ui/story/Level.hx | 5 +++- source/funkin/ui/story/LevelProp.hx | 4 ++- source/funkin/ui/story/StoryMenuState.hx | 31 +++++++++++++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/source/funkin/ui/story/Level.hx b/source/funkin/ui/story/Level.hx index 3ff0a5321..83682fec9 100644 --- a/source/funkin/ui/story/Level.hx +++ b/source/funkin/ui/story/Level.hx @@ -156,7 +156,10 @@ class Level implements IRegistryEntry for (propIndex in 0..._data.props.length) { var propData = _data.props[propIndex]; - var propSprite:LevelProp = LevelProp.build(propData); + + var propSprite:Null = LevelProp.build(propData); + if (propSprite == null) continue; + propSprite.x += FlxG.width * 0.25 * propIndex; props.push(propSprite); } diff --git a/source/funkin/ui/story/LevelProp.hx b/source/funkin/ui/story/LevelProp.hx index a474b363c..4dce7bfb3 100644 --- a/source/funkin/ui/story/LevelProp.hx +++ b/source/funkin/ui/story/LevelProp.hx @@ -16,8 +16,10 @@ class LevelProp extends Bopper playAnimation('confirm', true, true); } - public static function build(propData:LevelPropData):Null + public static function build(propData:Null):Null { + if (propData == null) return null; + var isAnimated:Bool = propData.animations.length > 0; var prop:LevelProp = new LevelProp(propData.danceEvery); diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index b61f1bdee..1dc59f3ec 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -52,6 +52,11 @@ class StoryMenuState extends MusicBeatState */ var scoreText:FlxText; + /** + * The mode text at the top-middle. + */ + var modeText:FlxText; + /** * The list of songs on the left. */ @@ -146,16 +151,22 @@ class StoryMenuState extends MusicBeatState updateProps(); - scoreText = new FlxText(10, 10, 0, 'HIGH SCORE: 42069420'); - scoreText.setFormat("VCR OSD Mono", 32); - add(scoreText); - tracklistText = new FlxText(FlxG.width * 0.05, levelBackground.x + levelBackground.height + 100, 0, "Tracks", 32); tracklistText.setFormat("VCR OSD Mono", 32); tracklistText.alignment = CENTER; tracklistText.color = 0xFFe55777; add(tracklistText); + scoreText = new FlxText(10, 10, 0, 'HIGH SCORE: 42069420'); + scoreText.setFormat("VCR OSD Mono", 32); + add(scoreText); + + modeText = new FlxText(10, 10, 0, 'Base Game Levels [TAB to switch]'); + modeText.setFormat("VCR OSD Mono", 32); + modeText.screenCenter(X); + modeText.visible = hasModdedLevels(); + add(modeText); + levelTitleText = new FlxText(FlxG.width * 0.7, 10, 0, 'LEVEL 1'); levelTitleText.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT); levelTitleText.alpha = 0.7; @@ -256,7 +267,7 @@ class StoryMenuState extends MusicBeatState displayingModdedLevels = moddedLevels; buildLevelTitles(); - changeLevel(0); + changeLevel(999999); // Jump past the end of the list to the beginning. changeDifficulty(0); } @@ -268,6 +279,9 @@ class StoryMenuState extends MusicBeatState scoreText.text = 'LEVEL SCORE: ${Math.round(highScoreLerp)}'; + modeText.text = displayingModdedLevels ? 'Mods [TAB to switch]' : 'Base Game [TAB to switch]'; + modeText.screenCenter(X); + levelTitleText.text = currentLevel.getTitle(); levelTitleText.x = FlxG.width - (levelTitleText.width + 10); // Right align. @@ -322,7 +336,7 @@ class StoryMenuState extends MusicBeatState changeDifficulty(-1); } - if (FlxG.keys.justPressed.TAB) + if (FlxG.keys.justPressed.TAB && modeText.visible) { switchMode(!displayingModdedLevels); } @@ -342,6 +356,11 @@ class StoryMenuState extends MusicBeatState } } + function hasModdedLevels():Bool + { + return LevelRegistry.instance.listModdedLevelIds().length > 0; + } + /** * Changes the selected level. * @param change +1 (down), -1 (up) From d1333b9b24284ecea21b8f0444e2d00fab53b446 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 27 Jun 2023 12:45:41 -0400 Subject: [PATCH 2/2] new hxcodec stuff --- hmm.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hmm.json b/hmm.json index f45a94b08..dc403a5ab 100644 --- a/hmm.json +++ b/hmm.json @@ -68,8 +68,8 @@ "name": "hxCodec", "type": "git", "dir": null, - "ref": "c42ab99", - "url": "https://github.com/polybiusproxy/hxCodec" + "ref": "a56f4b4", + "url": "https://github.com/FunkinCrew/hxCodec" }, { "name": "hxcpp",