diff --git a/Project.xml b/Project.xml index 567c8b3..18d46ff 100644 --- a/Project.xml +++ b/Project.xml @@ -2,12 +2,12 @@ - + - - + + - + diff --git a/README.md b/README.md index 506f8e8..10c075f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # Friday Night Funkin' - Vs. Foxa / Foxa Engine Not a Psych fork again... - -And no, we will NOT do Story Edition 3.0, since we're already now taking a break from FNF. Cry about it. - ## Story You and your girlfriend go down an alleyway, searching for the famous "Whitmore". However, a pink fox blocks your way! She seems to be trying to protect someone... And she does not want you to rap battle him! Sing 5 or more songs with her, maybe even a 6th one too? diff --git a/assets/shared/images/freeplaysections/vanilla.png b/assets/shared/images/freeplaysections/vanilla.png new file mode 100644 index 0000000..158f987 Binary files /dev/null and b/assets/shared/images/freeplaysections/vanilla.png differ diff --git a/assets/shared/weeks/tutorial.json b/assets/shared/weeks/tutorial.json index 3190bbe..dad9f9b 100644 --- a/assets/shared/weeks/tutorial.json +++ b/assets/shared/weeks/tutorial.json @@ -16,5 +16,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": false + "hideFreeplay": false, + "sections": ["Vanilla"] } diff --git a/assets/shared/weeks/week1.json b/assets/shared/weeks/week1.json index ba12393..a9dce1f 100644 --- a/assets/shared/weeks/week1.json +++ b/assets/shared/weeks/week1.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week2.json b/assets/shared/weeks/week2.json index 1ea611e..20a04a7 100644 --- a/assets/shared/weeks/week2.json +++ b/assets/shared/weeks/week2.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week3.json b/assets/shared/weeks/week3.json index b143a4e..1947d47 100644 --- a/assets/shared/weeks/week3.json +++ b/assets/shared/weeks/week3.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week4.json b/assets/shared/weeks/week4.json index f11fbd2..0a16a4e 100644 --- a/assets/shared/weeks/week4.json +++ b/assets/shared/weeks/week4.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week5.json b/assets/shared/weeks/week5.json index 2effd4b..a15b24c 100644 --- a/assets/shared/weeks/week5.json +++ b/assets/shared/weeks/week5.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week6.json b/assets/shared/weeks/week6.json index 0293489..0a22547 100644 --- a/assets/shared/weeks/week6.json +++ b/assets/shared/weeks/week6.json @@ -18,5 +18,6 @@ "startUnlocked": true, "hideStoryMode": true, - "hideFreeplay": true + "hideFreeplay": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/assets/shared/weeks/week7.json b/assets/shared/weeks/week7.json index fda5836..b7560e3 100644 --- a/assets/shared/weeks/week7.json +++ b/assets/shared/weeks/week7.json @@ -44,5 +44,6 @@ ], "hideStoryMode": true, "weekBefore": "week6", - "startUnlocked": true + "startUnlocked": true, + "sections": ["Vanilla"] } \ No newline at end of file diff --git a/example_mods/Vs.Foxa 3.0/weeks/Covers.json b/example_mods/Vs.Foxa 3.0/weeks/Covers.json index 922c4bc..4574e9e 100644 --- a/example_mods/Vs.Foxa 3.0/weeks/Covers.json +++ b/example_mods/Vs.Foxa 3.0/weeks/Covers.json @@ -42,5 +42,6 @@ ], "hideStoryMode": true, "weekBefore": "tutorial", - "startUnlocked": true + "startUnlocked": true, + "sections":["Covers"] } \ No newline at end of file diff --git a/example_mods/Vs.Foxa 3.0/weeks/Foxa.json b/example_mods/Vs.Foxa 3.0/weeks/Foxa.json index 931a2d6..3803386 100644 --- a/example_mods/Vs.Foxa 3.0/weeks/Foxa.json +++ b/example_mods/Vs.Foxa 3.0/weeks/Foxa.json @@ -1,5 +1,5 @@ { - "storyName": "Before The Blitz (Feat. Foxa)", + "storyName": "Before The Blitz (ft. Foxa)", "difficulties": "", "hideFreeplay": false, "weekBackground": "Foxa", @@ -63,5 +63,6 @@ ] ], "hideStoryMode": false, - "weekName": "Foxa" + "weekName": "Foxa", + "sections": ["Foxa"] } \ No newline at end of file diff --git a/example_mods/Vs.Foxa 3.0/weeks/Sacrifice.json b/example_mods/Vs.Foxa 3.0/weeks/Sacrifice.json index 6734c1e..3391713 100644 --- a/example_mods/Vs.Foxa 3.0/weeks/Sacrifice.json +++ b/example_mods/Vs.Foxa 3.0/weeks/Sacrifice.json @@ -2,7 +2,7 @@ "storyName": "this is just a freeplay week", "difficulties": "", "hideFreeplay": false, - "weekBackground": "whitty", + "weekBackground": "Foxa", "weekBefore": "Foxa", "freeplayColor": [ 146, @@ -23,9 +23,10 @@ ] ], "weekCharacters": [ - "fox", - "bf", - "gf" + "", + "", + "" ], - "weekName": "Bonus Song" + "weekName": "Bonus Song", + "sections": ["Foxa"] } \ No newline at end of file diff --git a/source/Main.hx b/source/Main.hx index 682eebd..b946d1a 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -5,7 +5,6 @@ import android.content.Context; #end import flixel.graphics.FlxGraphic; import flixel.FlxGame; -import flixel.FlxState; import haxe.io.Path; import openfl.Assets; import openfl.Lib; @@ -18,6 +17,8 @@ import states.TitleState; import flixel.math.FlxMath; import flixel.util.FlxColor; import lime.app.Application; +import haxe.EnumFlags; +import haxe.Exception; #if linux import lime.graphics.Image; @@ -137,9 +138,12 @@ class Main extends Sprite FlxG.mouse.visible = false; #end - #if CRASH_HANDLER + #if (CRASH_HANDLER && !hl) Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash); #end + #if (CRASH_HANDLER && hl) + hl.Api.setErrorHandler(onCrash); + #end #if desktop DiscordClient.start(); @@ -201,7 +205,6 @@ class Main extends Sprite fpsVar.textColor = color; } - static function resetSpriteCache(sprite:Sprite):Void { @:privateAccess { sprite.__cacheBitmap = null; @@ -234,8 +237,13 @@ class Main extends Sprite // Code was entirely made by sqirra-rng for their fnf engine named "Izzy Engine", big props to them!!! // very cool person for real they don't get enough credit for their work #if CRASH_HANDLER - function onCrash(e:UncaughtErrorEvent):Void + function onCrash(e:Dynamic):Void { + var message:String = ""; + if ((e is UncaughtErrorEvent)) + message = e.error; + else message = try Std.string(e) catch(_:Exception) "Unknown"; + var errMsg:String = ""; var path:String; var callStack:Array = CallStack.exceptionStack(true); @@ -257,7 +265,7 @@ class Main extends Sprite } } - errMsg += "\nUncaught Error: " + e.error + "\nPlease report this error to the GitHub page: https://github.com/TheBeepSheepTeam/VsFoxa\n\n> Crash Handler written by: sqirra-rng"; + errMsg += '\nUncaught Error: $message\nPlease report this error to the GitHub page: https://github.com/TheBeepSheepTeam/VsFoxa\n\n> Crash Handler written by: sqirra-rng'; if (!FileSystem.exists("./crash/")) FileSystem.createDirectory("./crash/"); @@ -267,7 +275,14 @@ class Main extends Sprite Sys.println(errMsg); Sys.println("Crash dump saved in " + Path.normalize(path)); - Application.current.window.alert(errMsg, "Error!"); + #if hl + var flags:EnumFlags = new EnumFlags(); + flags.set(IsError); + hl.UI.dialog("Vs. Foxa: Error!", errMsg, flags); + #else + Application.current.window.alert(errMsg, "Vs. Foxa: Error!"); + #end + DiscordClient.shutdown(); Sys.exit(1); } diff --git a/source/backend/ArrayUtil.hx b/source/backend/ArrayUtil.hx new file mode 100644 index 0000000..d593673 --- /dev/null +++ b/source/backend/ArrayUtil.hx @@ -0,0 +1,57 @@ +package backend; + +class ArrayUtil { + /** + * Gets the index of a possible new element of an Array of T using an efficient algorithm. + * @param array Array of T to check in + * @param getVal Function that returns the position value of T + * @return Index + */ + public static inline function binarySearch(array:Array, val:Float, getVal:T -> Float):Int { + if (array.length <= 0) return 0; // if the array is empty, it should be equal to zero (the beginning) + if (getVal(array[0]) > val) return 0; // in case its the minimum + if (getVal(array[array.length - 1]) < val) return array.length; // in case its the maximum + + // binary search + var iMin:Int = 0; + var iMax:Int = array.length - 1; + + var i:Int = 0; + var mid:Float; + while(iMin <= iMax) { + i = Math.floor((iMin + iMax) / 2); + mid = getVal(array[i]); + if (mid < val) iMin = i + 1 + else if (mid > val) iMax = i - 1; + else { + iMin = i; + break; + } + } + return iMin; + } + + /** + * Adds to a sorted array, using binary search. + * @param array Array to add to + * @param val Value to add + * @param getVal Function that returns the value that needs to be sorted + */ + public static inline function addSorted(array:Array, val:T, getVal:T->Float) { + if (val != null) array.insert(binarySearch(array, getVal(val), getVal), val); + } + + inline public static function dynamicArray(v:T, len:Int):Array return [for (_ in 0...len) v]; + + public static function sortByAlphabet(arr:Array):Array { + arr.sort((a:String, b:String) -> { + a = a.toUpperCase(); + b = b.toUpperCase(); + + if (a < b) return -1; + else if (a > b) return 1; + else return 0; + }); + return arr; + } +} \ No newline at end of file diff --git a/source/backend/CoolUtil.hx b/source/backend/CoolUtil.hx index c79387c..e23fb04 100644 --- a/source/backend/CoolUtil.hx +++ b/source/backend/CoolUtil.hx @@ -75,25 +75,11 @@ class CoolUtil return colorNum != null ? colorNum : FlxColor.WHITE; } - /** - * Returns a `FlxColor` by receiving an array with integer values, - * automatically fixes the array if fields are missing, - * format: [Red, Green, Blue, Alpha]. - * @param colors Your base color array. - * @param defColors The default colors that should be used in the event of an error. - **/ - inline public static function colorFromArray(colors: Array, ?defColors: Array) { + inline public static function colorFromArray(colors:Array, ?defColors:Array) { colors = fixRGBColorArray(colors, defColors); return FlxColor.fromRGB(colors[0], colors[1], colors[2], colors[3]); } - inline public static function fixRGBColorArray(colors: Array, ?defColors: Array) { - // helper function used on characters n such - final endResult: Array = (defColors != null && defColors.length > 2) ? defColors : [255, 255, 255, 255]; // Red, Green, Blue, Alpha - for (i in 0...endResult.length) if (colors[i] > -1) endResult[i] = colors[i]; - return endResult; - } - inline public static function listFromString(string:String):Array { var daList:Array = string.trim().split('\n'); @@ -101,6 +87,21 @@ class CoolUtil return daList; } + public static function removeDuplicates(string:Array):Array { + var tempArray:Array = new Array(); + var lastSeen:String = null; + string.sort(function(str1:String, str2:String) { + return (str1 == str2) ? 0 : (str1 > str2) ? 1 : -1; + }); + for (str in string) { + if (str != lastSeen) { + tempArray.push(str); + } + lastSeen = str; + } + return tempArray; + } + public static function floorDecimal(value:Float, decimals:Int):Float { if(decimals < 1) return Math.floor(value); @@ -112,6 +113,13 @@ class CoolUtil return newValue / tempMult; } + inline public static function fixRGBColorArray(colors:Array, ?defColors:Array) { + // helper function used on characters n such + final endResult:Array = (defColors != null && defColors.length > 2) ? defColors : [255, 255, 255, 255]; // Red, Green, Blue, Alpha + for (i in 0...endResult.length) if (colors[i] > -1) endResult[i] = colors[i]; + return endResult; + } + inline public static function dominantColor(sprite:flixel.FlxSprite):Int { final countByColor:Map = []; diff --git a/source/backend/WeekData.hx b/source/backend/WeekData.hx index f9ebdeb..17c1621 100644 --- a/source/backend/WeekData.hx +++ b/source/backend/WeekData.hx @@ -22,6 +22,7 @@ typedef WeekFile = // -- FREEPLAY MENU SPECIFIC -- // var freeplayColor:Array; var hideFreeplay:Bool; + var sections:Array; } class WeekData { @@ -45,6 +46,7 @@ class WeekData { // -- FREEPLAY MENU SPECIFIC -- // public var freeplayColor:Array; public var hideFreeplay:Bool; + public var sections:Array; public var fileName:String; @@ -66,7 +68,8 @@ class WeekData { hiddenUntilUnlocked: false, hideStoryMode: false, hideFreeplay: false, - difficulties: '' + difficulties: '', + sections: ["Vanilla"] }; } diff --git a/source/backend/system/SystemUtil.hx b/source/backend/system/SystemUtil.hx new file mode 100644 index 0000000..c35461b --- /dev/null +++ b/source/backend/system/SystemUtil.hx @@ -0,0 +1,23 @@ +package backend.system; + +class SystemUtil { + public static function getSysPath(path:String = ""):String { + return Sys.getEnv(switch (path.toLowerCase()) { + case "username": #if windows "USERNAME" #else "USER" #end; + case "userpath": #if windows "USERPROFILE" #else "HOME" #end; + case "temppath" | _: #if windows "TEMP" #else "HOME" #end; + }); + } + + public static function executableFileName() { + var programPath = Sys.programPath().split(#if windows "\\" #else "/" #end); + return programPath[programPath.length - 1]; + } + public static function generateTextFile(fileContent:String, fileName:String) { + #if desktop + var path = '${getSysPath()}/$fileName.txt'; + File.saveContent(path, fileContent); + Sys.command(#if windows "start " #elseif linux "xdg-open " #else "open " #end + path); + #end + } +} \ No newline at end of file diff --git a/source/openfl/display/FPS.hx b/source/openfl/display/FPS.hx index 7de8d19..8df1689 100644 --- a/source/openfl/display/FPS.hx +++ b/source/openfl/display/FPS.hx @@ -149,19 +149,17 @@ class FPS extends TextField private dynamic function updateText():Void { - text = 'FPS: ${currentFPS}\n'; + text = 'FPS: ${currentFPS} ms\n'; #if openfl memoryMegas = cast(System.totalMemory, UInt); - /*if(memoryMegas > memoryTotal) memoryTotal = memoryMegas; - text += "RAM: " + memoryMegas + " MB / " + memoryTotal + " MB";*/ text += 'MEM: ${flixel.util.FlxStringUtil.formatBytes(memoryMegas)}'; #end text += '\nAlleyway Engine (PE 0.7.3)'; #if STORY_EDITION - text += '\nFNF Vs. Foxa 3.0: Story Edition'; + text += '\nFNF Vs. Foxa 3.0b: Story Edition'; #else text += '\nFNF Vs. Foxa 3.0b'; #end diff --git a/source/options/BaseOptionsMenu.hx b/source/options/BaseOptionsMenu.hx index 2186f85..b2757ea 100644 --- a/source/options/BaseOptionsMenu.hx +++ b/source/options/BaseOptionsMenu.hx @@ -478,8 +478,7 @@ class BaseOptionsMenu extends MusicBeatSubstate curSelected = 0; descText.text = optionsArray[curSelected].description; - descText.screenCenter(Y); - descText.y += 270; + descText.screenCenter(Y).y += 270; var bullShit:Int = 0; diff --git a/source/states/FreeplaySectionState.hx b/source/states/FreeplaySectionState.hx new file mode 100644 index 0000000..d4d5b5f --- /dev/null +++ b/source/states/FreeplaySectionState.hx @@ -0,0 +1,200 @@ +package states; + +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; +import flixel.effects.FlxFlicker; +import flixel.FlxG; +import flixel.FlxObject; +import flixel.FlxSprite; +import flixel.FlxCamera; +import flixel.addons.transition.FlxTransitionableState; +import flixel.text.FlxText; +import flixel.util.FlxColor; +import flixel.math.FlxMath; +import backend.WeekData; +import backend.CoolUtil; +import backend.ClientPrefs; +import backend.Conductor; + +/** +* State used to decide which selection of songs should be loaded in `FreeplayState`. +*/ +class FreeplaySectionState extends MusicBeatState +{ + public static var daSection:String = ''; + var counter:Int = 0; + var sectionArray:Array = []; + + var sectionSpr:FlxSprite; + var sectionTxt:FlxText; + + var camGame:FlxCamera; + + var camFollow:FlxObject; + var camFollowPos:FlxObject; + + var bg:FlxSprite; + var transitioning:Bool = false; + + override function create() + { + #if desktop DiscordClient.changePresence("Selecting a Freeplay Section", null); #end + + persistentUpdate = true; + WeekData.reloadWeekFiles(false); + + var doFunnyContinue = false; + + for (i in 0...WeekData.weeksList.length) { + if(weekIsLocked(WeekData.weeksList[i])) continue; + + var leWeek:WeekData = WeekData.weeksLoaded.get(WeekData.weeksList[i]); + if(leWeek.hideFreeplay) continue; + if (leWeek.sections != null) { + var fuck:Int = 0; + for (section in leWeek.sections) { + if (section.toLowerCase() != sectionArray[fuck].toLowerCase()) + sectionArray.push(section); + fuck++; + } + } else doFunnyContinue = true; + if (doFunnyContinue) { + doFunnyContinue = false; + continue; + } + + WeekData.setDirectoryFromWeek(leWeek); + } + sectionArray = CoolUtil.removeDuplicates(sectionArray); + WeekData.reloadWeekFiles(false); + + daSection = sectionArray[0]; + + camGame = new FlxCamera(); + + FlxG.cameras.reset(camGame); + FlxG.cameras.setDefaultDrawTarget(camGame, true); //new EPIC code + + transIn = FlxTransitionableState.defaultTransIn; + transOut = FlxTransitionableState.defaultTransOut; + + persistentUpdate = persistentDraw = true; + + bg = new FlxSprite().loadGraphic(Paths.image('menuDesat')); + bg.scrollFactor.set(); + bg.updateHitbox(); + bg.screenCenter(); + bg.antialiasing = ClientPrefs.data.antialiasing; + add(bg); + + sectionSpr = new FlxSprite().loadGraphic(Paths.image('freeplaysections/' + daSection.toLowerCase())); + sectionSpr.antialiasing = ClientPrefs.data.antialiasing; + sectionSpr.scrollFactor.set(); + sectionSpr.screenCenter(XY); + add(sectionSpr); + + sectionTxt = new FlxText(0, 620, 0, "", 32); + sectionTxt.scrollFactor.set(); + sectionTxt.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER); + sectionTxt.setBorderStyle(OUTLINE, FlxColor.BLACK, 1.5); + sectionTxt.screenCenter(X); + sectionTxt.y += 620; + add(sectionTxt); + + camFollow = new FlxObject(0, 0, 1, 1); + camFollowPos = new FlxObject(0, 0, 1, 1); + add(camFollow); + add(camFollowPos); + + FlxG.camera.follow(camFollowPos, null, 1); + + super.create(); + } + + override function update(elapsed:Float) + { + if (FlxG.sound.music.volume < 0.8) { + FlxG.sound.music.volume += 0.5 * FlxG.elapsed; + } + + if (FlxG.sound.music != null) + Conductor.songPosition = FlxG.sound.music.time; + + if (!transitioning) { + var mult:Float = FlxMath.lerp(1, bg.scale.x, CoolUtil.boundTo(1 - (elapsed * 9), 0, 1)); + bg.scale.set(mult, mult); + bg.updateHitbox(); + var mult:Float = FlxMath.lerp(1, sectionSpr.scale.x, CoolUtil.boundTo(1 - (elapsed * 9), 0, 1)); + sectionSpr.scale.set(mult, mult); + sectionSpr.updateHitbox(); + } + + if (controls.UI_LEFT_P && !transitioning) + { + FlxG.sound.play(Paths.sound('scrollMenu')); + if (counter > 0) + counter -= 1; + else counter = sectionArray.length - 1; + + daSection = sectionArray[counter]; + sectionSpr.loadGraphic(Paths.image('freeplaysections/' + daSection.toLowerCase())); + sectionSpr.scale.set(1.1, 1.1); + sectionSpr.updateHitbox(); + } + + if (controls.UI_RIGHT_P && !transitioning) { + FlxG.sound.play(Paths.sound('scrollMenu')); + if (counter < sectionArray.length - 1) + counter += 1; + else counter = 0; + + daSection = sectionArray[counter]; + sectionSpr.loadGraphic(Paths.image('freeplaysections/' + daSection.toLowerCase())); + sectionSpr.scale.set(1.1, 1.1); + sectionSpr.updateHitbox(); + } + + if ((controls.BACK || FlxG.mouse.justPressedRight) && !transitioning) { + FlxG.sound.play(Paths.sound('cancelMenu')); + FlxG.switchState(() -> new MainMenuState()); + } + + if ((controls.ACCEPT || FlxG.mouse.justPressed) && !transitioning) { + FlxG.sound.play(Paths.sound('confirmMenu')); + transitioning = true; + sectionTxt.visible = false; + FlxTween.tween(sectionSpr, {'scale.x': 1.5, 'scale.y': 1.5}, 0.7, {ease: FlxEase.circOut}); + if (!ClientPrefs.data.flashing) { + /*FlxTween.tween(sectionSpr, {'scale.x': 11, 'scale.y': 11, y: sectionSpr.y + 3000, alpha: 0 }, 0.9, { + ease: FlxEase.expoIn + });*/ + FlxTween.tween(bg, {'scale.x': 0.003, 'scale.y': 0.003, alpha: 0}, 1.1, { + ease: FlxEase.expoIn, onComplete: function(twn:FlxTween) { + FlxG.switchState(() -> new FreeplayState()); + }}); + } else { + FlxFlicker.flicker(sectionSpr, 1, 0.06, true, false, function(_) + { + FlxG.switchState(() -> new FreeplayState()); + }); + } + } + + sectionTxt.text = daSection.toUpperCase(); + sectionTxt.screenCenter(X); + + if(transitioning) { + bg.screenCenter(XY); + } + + var lerpVal:Float = CoolUtil.boundTo(elapsed * 7.5, 0, 1); + camFollowPos.setPosition(FlxMath.lerp(camFollowPos.x, camFollow.x, lerpVal), FlxMath.lerp(camFollowPos.y, camFollow.y, lerpVal)); + + super.update(elapsed); + } + + function weekIsLocked(name:String):Bool { + var leWeek:WeekData = WeekData.weeksLoaded.get(name); + return (!leWeek.startUnlocked && leWeek.weekBefore.length > 0 && (!StoryMenuState.weekCompleted.exists(leWeek.weekBefore) || !StoryMenuState.weekCompleted.get(leWeek.weekBefore))); + } +} \ No newline at end of file diff --git a/source/states/FreeplayState.hx b/source/states/FreeplayState.hx index 8a34728..ce5d7fd 100644 --- a/source/states/FreeplayState.hx +++ b/source/states/FreeplayState.hx @@ -37,10 +37,10 @@ class FreeplayState extends MusicBeatState { var intendedScore:Int = 0; var intendedRating:Float = 0; - private var grpSongs:FlxTypedGroup; - private var curPlaying:Bool = false; + var grpSongs:FlxTypedGroup; + var curPlaying:Bool = false; - private var iconArray:Array = []; + var iconArray:Array = []; var bg:FlxSprite; var intendedColor:Int; @@ -49,6 +49,8 @@ class FreeplayState extends MusicBeatState { var missingTextBG:FlxSprite; var missingText:FlxText; + var section:String = ''; + var bottomString:String; var bottomText:FlxText; var bottomBG:FlxSprite; @@ -60,14 +62,25 @@ class FreeplayState extends MusicBeatState { PlayState.isStoryMode = false; WeekData.reloadWeekFiles(false); - #if desktop - DiscordClient.changePresence("Freeplay Menu", null); - #end + #if desktop DiscordClient.changePresence("Freeplay Menu", null); #end + + section = FreeplaySectionState.daSection; + var doFunnyContinue = false; for (i in 0...WeekData.weeksList.length) { if(weekIsLocked(WeekData.weeksList[i])) continue; var leWeek:WeekData = WeekData.weeksLoaded.get(WeekData.weeksList[i]); + + if (leWeek.sections != null) { + doFunnyContinue = true; + } else doFunnyContinue = true; + + if (doFunnyContinue) { + doFunnyContinue = false; + continue; + } + var leSongs:Array = []; var leChars:Array = []; @@ -291,7 +304,7 @@ class FreeplayState extends MusicBeatState { persistentUpdate = false; if(colorTween != null) colorTween.cancel(); FlxG.sound.play(Paths.sound('cancelMenu')); - FlxG.switchState(() -> new MainMenuState()); + FlxG.switchState(() -> new FreeplaySectionState()); } } diff --git a/source/states/MainMenuState.hx b/source/states/MainMenuState.hx index f7af491..13109d4 100644 --- a/source/states/MainMenuState.hx +++ b/source/states/MainMenuState.hx @@ -284,7 +284,7 @@ class MainMenuState extends MusicBeatState { switch (daChoice) { case 'story_mode': FlxG.switchState(() -> new StoryMenuState()); - case 'freeplay': FlxG.switchState(() -> new FreeplayState()); + case 'freeplay': FlxG.switchState(() -> new FreeplaySectionState()); #if MODS_ALLOWED case 'mods': FlxG.switchState(() -> new ModsMenuState()); #end #if ACHIEVEMENTS_ALLOWED case 'awards': FlxG.switchState(() -> new AchievementsMenuState()); #end case 'credits': FlxG.switchState(() -> new CreditsState()); diff --git a/source/states/editors/ChartingState.hx b/source/states/editors/ChartingState.hx index 478be30..34be9c6 100644 --- a/source/states/editors/ChartingState.hx +++ b/source/states/editors/ChartingState.hx @@ -1303,7 +1303,7 @@ class ChartingState extends MusicBeatState blockPressWhileTypingOnStepper.push(voicesVolume); #if !html5 - sliderRate = new FlxUISlider(this, 'playbackSpeed', 120, 120, 0.5, 3, 150, null, 5, FlxColor.WHITE, FlxColor.BLACK); + sliderRate = new FlxUISlider(this, 'playbackSpeed', 120, 120, 0.5, 3, 150, 15, 5, FlxColor.WHITE, FlxColor.BLACK); sliderRate.nameLabel.text = 'Playback Rate'; tab_group_chart.add(sliderRate); #end