diff --git a/assets/shared/data/editors/character.xml b/assets/shared/data/editors/character.xml index 1b425565..1ebf5a72 100644 --- a/assets/shared/data/editors/character.xml +++ b/assets/shared/data/editors/character.xml @@ -47,7 +47,7 @@ - diff --git a/assets/shared/music/ke_freakyMenu.ogg b/assets/shared/music/ke_freakyMenu.ogg deleted file mode 100644 index a3ac889c..00000000 Binary files a/assets/shared/music/ke_freakyMenu.ogg and /dev/null differ diff --git a/source/kec/backend/WeekData.hx b/source/kec/backend/WeekData.hx index 9d00e8e8..14a34d0f 100644 --- a/source/kec/backend/WeekData.hx +++ b/source/kec/backend/WeekData.hx @@ -13,7 +13,7 @@ class Week { public static function loadJSONFile(week:String):WeekData { - var rawJson = Paths.loadJSON('weeks/$week'); + var rawJson = Paths.loadJSON('data/weeks/$week'); return parseWeek(rawJson); } diff --git a/source/kec/backend/util/Paths.hx b/source/kec/backend/util/Paths.hx index e29b28fa..5a3b3d87 100644 --- a/source/kec/backend/util/Paths.hx +++ b/source/kec/backend/util/Paths.hx @@ -89,7 +89,7 @@ class Paths // MISC public static function video(file:String) - return getPath('videos/$file'); + return 'assets/videos/$file'; // GRAPHICS @@ -105,8 +105,7 @@ class Paths if (!OpenFlAssets.exists(img, IMAGE)) { Debug.logWarn("Couldn't Find Asset At " + img); - path = 'missingMod'; - img = getPath('images/missingMod.png'); + // shouldn't override it because flixel will handle it for you incase it's an atlas return null; } if (graphics.exists(path)) diff --git a/source/kec/objects/MenuButton.hx b/source/kec/objects/MenuButton.hx new file mode 100644 index 00000000..632c8f96 --- /dev/null +++ b/source/kec/objects/MenuButton.hx @@ -0,0 +1,83 @@ +package kec.objects; + +/** + * A Multipurpose Button Useful For Many Menus. + + Author : TheRealJake_12 + */ +class MenuButton extends FlxSprite +{ + public var onClick:() -> Void; + public var onRelease:() -> Void; + public var onHover:() -> Void; + public var onExit:() -> Void; + public var blockInput:Bool = false; + public var targSize:Float = 1.0; + + private var _hoverCheck:Bool = false; + + /** + * An All Purpose Button Used For Main Menu. + * @param x The Starting X Position. + * @param y The Starting Y Position. + * @param image The Image To Load. Has To Be In The `shared/images` Folder. Can Load Any Subfolders From There. + * @param atlas If It Should Look For A SparrowAtlas Instead + */ + public function new(x:Float, y:Float, image:String = "", ?atlas:Bool = false) + { + super(x, y); + + onClick = function() + { + }; + onRelease = function() + { + }; + onHover = function() + { + }; + onExit = function() + { + }; + loadImage(image, atlas); + } + + public function loadImage(path:String, atlas:Bool) + { + switch (atlas) + { + case true: + frames = Paths.getSparrowAtlas(path); + case false: + loadGraphic(Paths.image(path)); + } + } + + override function update(elapsed:Float) + { + super.update(elapsed); + if (blockInput) + return; + + final lerp = CoolUtil.smoothLerp(scale.x, targSize, elapsed, 0.2); + scale.set(lerp, lerp); + + if (FlxG.mouse.overlaps(this) && !_hoverCheck) + { + _hoverCheck = true; + onHover(); + } + else if (!FlxG.mouse.overlaps(this) && _hoverCheck) + { + _hoverCheck = false; + onExit(); + } + if (FlxG.mouse.overlaps(this)) + { + if (FlxG.mouse.justPressed) + onClick(); + else if (FlxG.mouse.justReleased) + onRelease(); + } + } +} diff --git a/source/kec/objects/MenuCharacter.hx b/source/kec/objects/MenuCharacter.hx index f468251a..95f8fc5d 100644 --- a/source/kec/objects/MenuCharacter.hx +++ b/source/kec/objects/MenuCharacter.hx @@ -45,7 +45,7 @@ class MenuCharacter extends FlxSprite visible = false; dontPlayAnim = true; default: - var jsonPath:String = 'menuCharacters/' + character; + var jsonPath:String = 'data/menuCharacters/' + character; var charJson:MenuCharData = cast Paths.loadJSON(jsonPath); var frameRate = charJson.frameRate == null ? 24 : charJson.frameRate; diff --git a/source/kec/states/FreeplayState.hx b/source/kec/states/FreeplayState.hx index 696ec8b1..b1f56e04 100644 --- a/source/kec/states/FreeplayState.hx +++ b/source/kec/states/FreeplayState.hx @@ -258,7 +258,7 @@ class FreeplayState extends MusicBeatState if (!Constants.freakyPlaying) { - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); Constants.freakyPlaying = true; Conductor.bpm = 102; } diff --git a/source/kec/states/MainMenuState.hx b/source/kec/states/MainMenuState.hx index c79a84cb..4c3fce81 100644 --- a/source/kec/states/MainMenuState.hx +++ b/source/kec/states/MainMenuState.hx @@ -16,10 +16,11 @@ import polymod.Polymod; class MainMenuState extends MusicBeatState { - public static var curSelected:Int = 0; + public var curSelected:Int = 0; - var menuItems:FlxTypedGroup; - final colorArray:Array = [ + private final optionShit:Array = ['story mode', 'freeplay', 'donate', 'discord', 'options']; + + private final colorArray:Array = [ FlxColor.fromRGB(148, 0, 211), FlxColor.fromRGB(75, 0, 130), FlxColor.fromRGB(0, 0, 200), @@ -29,22 +30,12 @@ class MainMenuState extends MusicBeatState FlxColor.fromRGB(160, 0, 0) ]; - public var logo:FlxSprite; - - public static var myBalls:FlxText; - - private var camGame:FlxCamera; - - #if !switch - var optionShit:Array = ['story mode', 'freeplay', 'donate', 'discord', 'options']; - #else - var optionShit:Array = ['story mode', 'freeplay']; - #end - var magenta:FlxBackdrop; var bg:FlxBackdrop; - var camFollow:FlxObject; - var camFollowPos:FlxObject; + var logo:FlxSprite; + var menuItems:FlxTypedGroup; + + var myBalls:FlxText; override function create() { @@ -66,17 +57,11 @@ class MainMenuState extends MusicBeatState if (!Constants.freakyPlaying) { - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); Constants.freakyPlaying = true; Conductor.bpm = 102; - kec.backend.chart.TimingStruct.clearTimings(); - curTiming = null; } - if (!FlxG.save.data.watermark) - optionShit.remove('discord'); - camGame = new FlxCamera(); - transIn = FlxTransitionableState.defaultTransIn; transOut = FlxTransitionableState.defaultTransOut; @@ -88,17 +73,8 @@ class MainMenuState extends MusicBeatState bg.screenCenter(); bg.velocity.set(240, 0); bg.moves = true; - bg.antialiasing = FlxG.save.data.antialiasing; add(bg); - camFollow = new FlxObject(0, 0, 1, 1); - camFollowPos = new FlxObject(0, 0, 1, 1); - // add(camFollow); - // add(camFollowPos); - - FlxG.cameras.reset(camGame); - FlxG.cameras.setDefaultDrawTarget(camGame, true); - magenta = new FlxBackdrop(Paths.image('menuDesat'), X, 0, 0); magenta.setGraphicSize(Std.int(magenta.width * 1.175)); magenta.updateHitbox(); @@ -106,27 +82,24 @@ class MainMenuState extends MusicBeatState magenta.visible = false; magenta.moves = true; magenta.velocity.set(240, 0); - magenta.antialiasing = FlxG.save.data.antialiasing; magenta.color = 0xFFfd719b; add(magenta); menuItems = new FlxTypedGroup(); add(menuItems); - for (i in 0...optionShit.length) + for (num => i in optionShit) { - var offset:Float = 108 - (Math.max(optionShit.length, 4) - 4) * 80; var menuItem:FlxSprite = new FlxSprite(0, 0); - menuItem.frames = Paths.getSparrowAtlas('mainmenu/menu_' + optionShit[i]); - menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24); - menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24); + menuItem.frames = Paths.getSparrowAtlas('mainmenu/menu_' + i); + menuItem.animation.addByPrefix('idle', i + " basic", 24); + menuItem.animation.addByPrefix('selected', i + " white", 24); menuItem.animation.play('idle'); - menuItem.ID = i; + menuItem.ID = num; menuItems.add(menuItem); - menuItem.scrollFactor.set(0, 0.25); menuItem.antialiasing = FlxG.save.data.antialiasing; - switch (i) + switch (num) { case 0: menuItem.setPosition(130, 50); @@ -145,10 +118,9 @@ class MainMenuState extends MusicBeatState logo.frames = Paths.getSparrowAtlas("KECLogoOrange"); logo.scale.set(0.7, 0.7); logo.animation.addByPrefix("bump", "logo bumpin", 24); - logo.antialiasing = FlxG.save.data.antialiasing; logo.updateHitbox(); - var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, Constants.keVer + (FlxG.save.data.watermarks ? " / " + Constants.kecVer + "" : ""), 12); + var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, '${Constants.keVer} / ${Constants.kecVer}', 12); versionShit.scrollFactor.set(); versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE_FAST, FlxColor.BLACK); add(versionShit); @@ -160,9 +132,6 @@ class MainMenuState extends MusicBeatState add(logo); changeItem(); - - controls.setKeyboardScheme(KeyboardScheme.Duo(true), true); - tweenColorShit(); super.create(); @@ -178,132 +147,114 @@ class MainMenuState extends MusicBeatState if (FlxG.sound.music != null) Conductor.songPosition = FlxG.sound.music.time; - if (!selectedSomethin) - { - if (FlxG.keys.justPressed.UP || controls.UP_P) - { - changeItem(-1); - } + super.update(elapsed); - if (FlxG.keys.justPressed.DOWN || controls.DOWN_P) - { - changeItem(1); - } + if (selectedSomethin) + return; + if (FlxG.keys.justPressed.UP || controls.UP_P) + changeItem(-1); - if (controls.BACK || FlxG.mouse.justPressedRight) - { - selectedSomethin = true; - FlxG.sound.play(Paths.sound('cancelMenu')); - MusicBeatState.switchState(new TitleState()); - } + if (FlxG.keys.justPressed.DOWN || controls.DOWN_P) + changeItem(1); - if (FlxG.keys.justPressed.F7) - { - PlayState.storyDifficulty = 1; - PlayState.SONG = Song.loadFromJson('salvation', ''); - PlayState.isStoryMode = false; - PlayState.isSM = false; - MusicBeatState.switchState(new PlayState()); - } + if (controls.BACK || FlxG.mouse.justPressedRight) + { + selectedSomethin = true; + FlxG.sound.play(Paths.sound('cancelMenu')); + MusicBeatState.switchState(new TitleState()); + } - #if FEATURE_MODCORE - if (FlxG.keys.justPressed.M) - { - MusicBeatState.switchState(new ModMenuState()); - } - #end + if (FlxG.keys.justPressed.F7) + { + PlayState.storyDifficulty = 1; + PlayState.SONG = Song.loadFromJson('salvation', ''); + PlayState.isStoryMode = false; + PlayState.isSM = false; + MusicBeatState.switchState(new PlayState()); + } + + #if FEATURE_MODCORE + if (FlxG.keys.justPressed.M) + MusicBeatState.switchState(new ModMenuState()); + #end - var shiftMult:Int = 1; + final shiftMult:Int = 1; - #if !mobile - if (FlxG.mouse.overlaps(menuItems, FlxG.camera)) + #if !mobile + if (FlxG.mouse.overlaps(menuItems, FlxG.camera)) + { + menuItems.forEach(function(daSprite:FlxSprite) { - menuItems.forEach(function(daSprite:FlxSprite) + if (FlxG.mouse.overlaps(daSprite) && curSelected != daSprite.ID) { - if (FlxG.mouse.overlaps(daSprite) && curSelected != daSprite.ID) - { - curSelected = daSprite.ID; - changeItem(); - } - }); - } + curSelected = daSprite.ID; + changeItem(); + } + }); + } - if (FlxG.mouse.wheel != 0) - { - changeItem(-shiftMult * FlxG.mouse.wheel); - } - #end + if (FlxG.mouse.wheel != 0) + changeItem(-shiftMult * FlxG.mouse.wheel); + #end - if (FlxG.keys.justPressed.SEVEN) - { - MusicBeatState.switchState(new SelectEditorsState()); - } + if (FlxG.keys.justPressed.SEVEN) + MusicBeatState.switchState(new SelectEditorsState()); - if (FlxG.mouse.overlaps(menuItems, FlxG.camera) && FlxG.mouse.justPressed || controls.ACCEPT) + if (FlxG.mouse.overlaps(menuItems, FlxG.camera) && FlxG.mouse.justPressed || controls.ACCEPT) + { + if (optionShit[curSelected] == 'donate') + fancyOpenURL("https://ninja-muffin24.itch.io/funkin"); + else if (optionShit[curSelected] == 'discord') + fancyOpenURL("https://discord.gg/TKCzG5rVGf"); + else { - if (optionShit[curSelected] == 'donate') - fancyOpenURL("https://ninja-muffin24.itch.io/funkin"); - else if (optionShit[curSelected] == 'discord') - fancyOpenURL("https://discord.gg/TKCzG5rVGf"); - else - { - selectedSomethin = true; - FlxG.sound.play(Paths.sound('confirmMenu')); + selectedSomethin = true; + FlxG.sound.play(Paths.sound('confirmMenu')); - if (FlxG.save.data.flashing) - FlxFlicker.flicker(magenta, 1.1, 0.15, false); + if (FlxG.save.data.flashing) + FlxFlicker.flicker(magenta, 1.1, 0.15, false); - menuItems.forEach(function(spr:FlxSprite) + menuItems.forEach(function(spr:FlxSprite) + { + if (curSelected == spr.ID) { - if (curSelected != spr.ID) - { - FlxTween.tween(spr, {alpha: 0}, 1.3, { - ease: FlxEase.quadOut, - onComplete: function(twn:FlxTween) - { - spr.kill(); - } + if (FlxG.save.data.flashing) + FlxFlicker.flicker(spr, 0.75, 0.06, false, false, function(flick:FlxFlicker) + { + goToState(); }); - } else - { - if (FlxG.save.data.flashing) - { - FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker) - { - goToState(); - }); - } - else + FlxTimer.wait(0.75, function() { - new FlxTimer().start(1, function(tmr:FlxTimer) - { - goToState(); - }); - } + goToState(); + }); + return; + } + + createTween(spr, {alpha: 0}, 1.3, { + ease: FlxEase.quadOut, + onComplete: function(twn:FlxTween) + { + spr.kill(); } }); - } + }); } } - - super.update(elapsed); } function goToState() { var daChoice:String = optionShit[curSelected]; + switch (daChoice) { - switch (daChoice) - { - case 'story mode': - MusicBeatState.switchState(new StoryMenuState()); - case 'freeplay': - MusicBeatState.switchState(new FreeplayState()); - case 'options': - FlxTransitionableState.skipNextTransOut = true; - MusicBeatState.switchState(new OptionsDirect()); - } + case 'story mode': + MusicBeatState.switchState(new StoryMenuState()); + case 'freeplay': + MusicBeatState.switchState(new FreeplayState()); + case 'options': + FlxTransitionableState.skipNextTransOut = true; + MusicBeatState.switchState(new OptionsDirect()); } } diff --git a/source/kec/states/MusicBeatState.hx b/source/kec/states/MusicBeatState.hx index a66afa4f..1f96f062 100644 --- a/source/kec/states/MusicBeatState.hx +++ b/source/kec/states/MusicBeatState.hx @@ -10,6 +10,7 @@ import kec.backend.util.NoteStyleHelper; import kec.states.FreeplayState; import kec.substates.CustomFadeTransition; import kec.substates.MusicBeatSubstate; +import flixel.util.typeLimit.NextState; class MusicBeatState extends FlxTransitionableState { @@ -303,17 +304,13 @@ class MusicBeatState extends FlxTransitionableState } public static function resetState() - { FlxG.resetState(); - } public inline static function getState():MusicBeatState return cast(FlxG.state, MusicBeatState); private function setFirstTiming() - { curTiming = TimingStruct.getTimingAtTimestamp(0); - } public function changeTime(time:Float) { diff --git a/source/kec/states/SelectEditorsState.hx b/source/kec/states/SelectEditorsState.hx index dd705594..294f7cd0 100644 --- a/source/kec/states/SelectEditorsState.hx +++ b/source/kec/states/SelectEditorsState.hx @@ -45,7 +45,7 @@ class SelectEditorsState extends MusicBeatState if (!Constants.freakyPlaying) { - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); Constants.freakyPlaying = true; Conductor.bpm = 102; } diff --git a/source/kec/states/StoryMenuState.hx b/source/kec/states/StoryMenuState.hx index add13c08..639f22d8 100644 --- a/source/kec/states/StoryMenuState.hx +++ b/source/kec/states/StoryMenuState.hx @@ -100,7 +100,7 @@ class StoryMenuState extends MusicBeatState if (!Constants.freakyPlaying) { - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); Constants.freakyPlaying = true; Conductor.bpm = 102; } diff --git a/source/kec/states/TitleState.hx b/source/kec/states/TitleState.hx index 07ab8305..973de79d 100644 --- a/source/kec/states/TitleState.hx +++ b/source/kec/states/TitleState.hx @@ -7,6 +7,7 @@ import kec.objects.Alphabet; class TitleState extends MusicBeatState { private static var seenBefore:Bool = false; + private var clickedBefore:Bool = false; private var danceLeft:Bool = false; @@ -63,7 +64,7 @@ class TitleState extends MusicBeatState { Paths.clearCache(); - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); FlxG.sound.music.fadeIn(10, 0, 0.7); if (seenBefore) show(); @@ -131,7 +132,7 @@ class TitleState extends MusicBeatState private function show() { - seenBefore = true; + seenBefore = true; deleteText(); remove(textGroup); remove(jake); @@ -159,7 +160,7 @@ class TitleState extends MusicBeatState private function decide() { - switch(seenBefore) + switch (seenBefore) { case false: show(); diff --git a/source/kec/states/editors/ChartingState.hx b/source/kec/states/editors/ChartingState.hx index a3fc461f..a4cf68fa 100644 --- a/source/kec/states/editors/ChartingState.hx +++ b/source/kec/states/editors/ChartingState.hx @@ -67,6 +67,7 @@ class ChartingState extends MusicBeatState public static var instance:ChartingState = null; var ui:TabView; + var entireUI:VBox; var menu:MenuBar; var box:ContinuousHBox; @@ -373,7 +374,14 @@ class ChartingState extends MusicBeatState add(iconP1); add(iconP2); + + entireUI = new VBox(); menuBarShit(); + entireUI.addComponent(menu); + var tempSpacer = new Spacer(); + tempSpacer.height = 420; + entireUI.addComponent(tempSpacer); + entireUI.addComponent(ui); addTabs(); addAssetUI(); @@ -392,8 +400,8 @@ class ChartingState extends MusicBeatState add(notetypetext); add(helpText); - add(ui); - add(menu); + add(entireUI); + selectBox = new FlxSprite(0, 0).makeGraphic(1, 1, FlxColor.fromRGB(173, 216, 230)); selectBox.visible = false; selectBox.alpha = 0.4; @@ -401,9 +409,6 @@ class ChartingState extends MusicBeatState id = Lib.setInterval(backupChart, 5 * 60 * 1000); - ui.x = 0; - ui.y = 420; - #if FEATURE_DISCORD kec.backend.Discord.changePresence("Chart Editor", "Charting : " + SONG.songName, null, true); #end @@ -989,7 +994,7 @@ class ChartingState extends MusicBeatState gfs = null; noteStyles = null; noteTypes = null; - + // I hate having things run in update all the time but fuck it songShit(); backupChart(); @@ -2165,8 +2170,8 @@ class ChartingState extends MusicBeatState vbox2.addComponent(eventSave); vbox2.addComponent(eventRemove); vbox2.addComponent(eventPos); - uiGrid.addComponent(vbox); - uiGrid.addComponent(vbox2); + grid.addComponent(vbox); + grid.addComponent(vbox2); box5.addComponent(grid); // dfjk diff --git a/source/kec/states/editors/StageDebugState.hx b/source/kec/states/editors/StageDebugState.hx index f44fe566..a70871cc 100644 --- a/source/kec/states/editors/StageDebugState.hx +++ b/source/kec/states/editors/StageDebugState.hx @@ -680,7 +680,7 @@ class StageDebugState extends UIState if (FlxG.keys.justPressed.ESCAPE) { FlxG.sound.music.stop(); - FlxG.sound.playMusic(Paths.music(FlxG.save.data.watermark ? "freakyMenu" : "ke_freakyMenu")); + FlxG.sound.playMusic(Paths.music("freakyMenu")); Constants.freakyPlaying = true; Conductor.bpm = 102; if (!fromEditor)