diff --git a/source/funkin/MenuCharacter.hx b/source/funkin/MenuCharacter.hx index 14cc4e05f..fd678d2de 100644 --- a/source/funkin/MenuCharacter.hx +++ b/source/funkin/MenuCharacter.hx @@ -13,9 +13,16 @@ class MenuCharacter extends FlxSprite this.character = character; - var tex = Paths.getSparrowAtlas('campaign_menu_UI_characters'); + var suffix:String = character; + + if (character != "darnell" && character != "nene") + suffix = "characters"; + + var tex = Paths.getSparrowAtlas('campaign_menu_UI_' + suffix); frames = tex; + trace(character); + animation.addByPrefix('bf', "BF idle dance white", 24); animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false); animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24); @@ -26,6 +33,8 @@ class MenuCharacter extends FlxSprite animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24); animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24); animation.addByPrefix('tankman', "Tankman Menu BLACK", 24); + animation.addByPrefix('darnell', "Darnell Black Lines To Scale", 24); + animation.addByPrefix('nene', "Nene Black Lines To Scale", 24); // Parent Christmas Idle animation.play(character); diff --git a/source/funkin/MenuItem.hx b/source/funkin/MenuItem.hx index de03c5b69..43c927b37 100644 --- a/source/funkin/MenuItem.hx +++ b/source/funkin/MenuItem.hx @@ -12,10 +12,19 @@ class MenuItem extends FlxSpriteGroup public var week:FlxSprite; public var flashingInt:Int = 0; - public function new(x:Float, y:Float, weekNum:Int = 0) + public function new(x:Float, y:Float, weekNum:Int = 0, weekType:WeekType) { super(x, y); - week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum)); + + var weekStr:String = switch (weekType) + { + case WEEK: + "week"; + case WEEKEND: + "weekend"; + } + + week = new FlxSprite().loadGraphic(Paths.image('storymenu/' + weekStr + weekNum)); add(week); } @@ -46,3 +55,9 @@ class MenuItem extends FlxSpriteGroup week.color = FlxColor.WHITE; } } + +enum abstract WeekType(String) to String +{ + var WEEK; + var WEEKEND; +} diff --git a/source/funkin/StoryMenuState.hx b/source/funkin/StoryMenuState.hx index 346a0de83..cb461b5b5 100644 --- a/source/funkin/StoryMenuState.hx +++ b/source/funkin/StoryMenuState.hx @@ -1,8 +1,5 @@ package funkin; -#if discord_rpc -import Discord.DiscordClient; -#end import flixel.FlxSprite; import flixel.addons.transition.FlxTransitionableState; import flixel.graphics.frames.FlxAtlasFrames; @@ -13,11 +10,17 @@ import flixel.text.FlxText; import flixel.tweens.FlxTween; import flixel.util.FlxColor; import flixel.util.FlxTimer; +import funkin.MenuItem.WeekType; import funkin.play.PlayState; import lime.net.curl.CURLCode; +import openfl.Assets; using StringTools; +#if discord_rpc +import Discord.DiscordClient; +#end + class StoryMenuState extends MusicBeatState { var scoreText:FlxText; @@ -48,7 +51,7 @@ class StoryMenuState extends MusicBeatState ['parents-christmas', 'bf', 'gf'], ['senpai', 'bf', 'gf'], ['tankman', 'bf', 'gf'], - ['pico', 'pico', 'pico'] + ['darnell', 'pico', 'nene'] ]; var weekNames:Array = [ @@ -60,9 +63,12 @@ class StoryMenuState extends MusicBeatState "RED SNOW", "hating simulator ft. moawling", "TANKMAN", - "DARNELL AND NENE" + "Due Debts" ]; + var weekType:Array = [WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEKEND]; + var weekTypeInc:Map = new Map(); + var txtWeekTitle:FlxText; var curWeek:Int = 0; @@ -70,14 +76,17 @@ class StoryMenuState extends MusicBeatState var txtTracklist:FlxText; var grpWeekText:FlxTypedGroup; - var grpWeekCharacters:FlxTypedGroup; + var grpWeekCharacters:Array>; + // var grpWeekCharacters:FlxTypedGroup; var grpLocks:FlxTypedGroup; var difficultySelectors:FlxGroup; var sprDifficulty:FlxSprite; var leftArrow:FlxSprite; var rightArrow:FlxSprite; + var yellowBG:FlxSprite; // not actually, yellow, lol! + var targetColor:Int = 0xFFF9CF51; override function create() { @@ -106,7 +115,10 @@ class StoryMenuState extends MusicBeatState rankText.screenCenter(X); var ui_tex = Paths.getSparrowAtlas('campaign_menu_UI_assets'); - var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51); + yellowBG = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, FlxColor.WHITE); + yellowBG.color = 0xFFF9CF51; + // 0xFF413CAE blue + // 0xFFF9CF51 yello grpWeekText = new FlxTypedGroup(); add(grpWeekText); @@ -114,7 +126,8 @@ class StoryMenuState extends MusicBeatState var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK); add(blackBarThingie); - grpWeekCharacters = new FlxTypedGroup(); + // grpWeekCharacters = new FlxTypedGroup(); + grpWeekCharacters = []; grpLocks = new FlxTypedGroup(); add(grpLocks); @@ -126,11 +139,19 @@ class StoryMenuState extends MusicBeatState for (i in 0...weekData.length) { - var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i); + if (!weekTypeInc.exists(weekType[i])) + weekTypeInc[weekType[i]] = 1; + + if (i == 0 && weekType[i] == WEEK) + weekTypeInc[weekType[i]] = 0; // set week to 0 by default? + + var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, weekTypeInc[weekType[i]], weekType[i]); weekThing.y += ((weekThing.height + 20) * i); weekThing.targetY = i; grpWeekText.add(weekThing); + weekTypeInc[weekType[i]] += 1; + weekThing.screenCenter(X); weekThing.antialiasing = true; // weekThing.updateHitbox(); @@ -148,32 +169,64 @@ class StoryMenuState extends MusicBeatState } } - for (char in 0...3) - { - var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[curWeek][char]); - weekCharacterThing.y += 70; - weekCharacterThing.antialiasing = true; - switch (weekCharacterThing.character) - { - case 'dad': - weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5)); - weekCharacterThing.updateHitbox(); + var sizeChart:Map> = new Map(); - case 'bf': - weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9)); - weekCharacterThing.updateHitbox(); - weekCharacterThing.x -= 80; - case 'gf': - weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5)); - weekCharacterThing.updateHitbox(); - case 'pico': - weekCharacterThing.flipX = true; - case 'parents-christmas': - weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9)); - weekCharacterThing.updateHitbox(); + var sizeTxt:Array = Assets.getText(Paths.file("data/storychardata.txt")).split("\n"); + + for (item in sizeTxt) + { + var items:Array = item.split(" "); + + var stuf:Array = []; + var name:String = items.shift(); + + for (num in items) + stuf.push(Std.parseFloat(num)); + + sizeChart.set(name, stuf); + } + + for (index => week in weekCharacters) + { + grpWeekCharacters.push(new FlxTypedGroup()); + + for (char in 0...week.length) + { + var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[index][char]); + weekCharacterThing.y += 70; + weekCharacterThing.antialiasing = true; + + var size:Float = 0.9; + + switch (char) + { + case 0 | 2: + size = 0.5; + if (char == 0 && weekCharacterThing.character == "pico") + weekCharacterThing.flipX = true; + case 1: + size = 0.9; + weekCharacterThing.x -= 80; + } + + if (sizeChart.exists(weekCharacterThing.character)) + { + var nums:Array = sizeChart[weekCharacterThing.character]; + size = nums[char]; + + // IDK, this might be busted ass null shit? + weekCharacterThing.x += nums[3]; + weekCharacterThing.y += nums[4]; + } + + weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * size)); + weekCharacterThing.updateHitbox(); + + grpWeekCharacters[index].add(weekCharacterThing); + trace("ADD CHARACTER"); } - grpWeekCharacters.add(weekCharacterThing); + trace(grpWeekCharacters[index].toString()); } difficultySelectors = new FlxGroup(); @@ -204,7 +257,13 @@ class StoryMenuState extends MusicBeatState difficultySelectors.add(rightArrow); add(yellowBG); - add(grpWeekCharacters); + for (grp in grpWeekCharacters) + { + add(grp); + // trace("ADDED GRP"); + } + + // add(grpWeekCharacters); txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32); txtTracklist.alignment = CENTER; @@ -223,6 +282,9 @@ class StoryMenuState extends MusicBeatState override function update(elapsed:Float) { // scoreText.setFormat('VCR OSD Mono', 32); + + yellowBG.color = FlxColor.interpolate(yellowBG.color, targetColor, 0.06); + lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.5); scoreText.text = "WEEK SCORE:" + Math.round(lerpScore); @@ -298,7 +360,7 @@ class StoryMenuState extends MusicBeatState FlxG.sound.play(Paths.sound('confirmMenu')); grpWeekText.members[curWeek].startFlashing(); - grpWeekCharacters.members[1].animation.play('bfConfirm'); + grpWeekCharacters[curWeek].members[1].animation.play('bfConfirm'); stopspamming = true; } @@ -394,38 +456,22 @@ class StoryMenuState extends MusicBeatState function updateText() { - grpWeekCharacters.members[0].animation.play(weekCharacters[curWeek][0]); - grpWeekCharacters.members[1].animation.play(weekCharacters[curWeek][1]); - grpWeekCharacters.members[2].animation.play(weekCharacters[curWeek][2]); - txtTracklist.text = "Tracks\n"; - - switch (grpWeekCharacters.members[0].animation.curAnim.name) + switch (weekType[curWeek]) { - case 'parents-christmas': - grpWeekCharacters.members[0].offset.set(200, 200); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 0.99)); - - case 'senpai': - grpWeekCharacters.members[0].offset.set(130, 0); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1.4)); - - case 'mom': - grpWeekCharacters.members[0].offset.set(100, 200); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); - - case 'dad': - grpWeekCharacters.members[0].offset.set(120, 200); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); - case 'tankman': - grpWeekCharacters.members[0].offset.set(60, -20); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); - - default: - grpWeekCharacters.members[0].offset.set(100, 100); - grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1)); - // grpWeekCharacters.members[0].updateHitbox(); + case WEEK: + targetColor = 0xFFF9CF51; + case WEEKEND: + targetColor = 0xFF413CAE; } + for (ind => grp in grpWeekCharacters) + grp.visible = ind == curWeek; + + // grpWeekCharacters.members[0].animation.play(weekCharacters[curWeek][0]); + // grpWeekCharacters.members[1].animation.play(weekCharacters[curWeek][1]); + // grpWeekCharacters.members[2].animation.play(weekCharacters[curWeek][2]); + txtTracklist.text = "Tracks\n"; + var trackNames:Array = weekData[curWeek]; for (i in trackNames) {