diff --git a/source/Init.hx b/source/Init.hx index f8a31c436..e49e83efe 100644 --- a/source/Init.hx +++ b/source/Init.hx @@ -55,6 +55,12 @@ class Init extends FlxState 'Whether to reduce movements, like icons bouncing or beat zooms in gameplay.', NOT_FORCED ], + 'Stage Darkness' => [ + 0, + 1, + 'Darkens non-ui elements, useful if you find the characters and backgrounds distracting.', + NOT_FORCED + ], 'Display Accuracy' => [true, 0, 'Whether to display your accuracy on screen.', NOT_FORCED], 'Disable Antialiasing' => [ false, @@ -223,6 +229,11 @@ class Init extends FlxState || trueSettings.get("Framerate Cap") > 360) trueSettings.set("Framerate Cap", 30); + if (!Std.isOfType(trueSettings.get("Stage Darkness"), Int) + || trueSettings.get("Stage Darkness") < 0 + || trueSettings.get("Stage Darkness") > 100) + trueSettings.set("Stage Darkness", 0); + // 'hardcoded' ui skins gameSettings.get("UI Skin")[4] = CoolUtil.returnAssetsLibrary('UI'); if (!gameSettings.get("UI Skin")[4].contains(trueSettings.get("UI Skin"))) diff --git a/source/gameFolder/gameObjects/userInterface/menu/Selector.hx b/source/gameFolder/gameObjects/userInterface/menu/Selector.hx index 4a7d1d9e7..eb549288a 100644 --- a/source/gameFolder/gameObjects/userInterface/menu/Selector.hx +++ b/source/gameFolder/gameObjects/userInterface/menu/Selector.hx @@ -19,8 +19,9 @@ class Selector extends FlxTypedSpriteGroup public var options:Array; public var fpsCap:Bool = false; + public var darkBG:Bool = false; - public function new(x:Float = 0, y:Float = 0, word:String, options:Array, fpsCap:Bool = false) + public function new(x:Float = 0, y:Float = 0, word:String, options:Array, fpsCap:Bool = false, darkBG:Bool = false) { // call back the function super(x, y); @@ -33,6 +34,7 @@ class Selector extends FlxTypedSpriteGroup // generate multiple pieces this.fpsCap = fpsCap; + this.darkBG = darkBG; #if html5 // lol heres how we fuck with everyone @@ -51,9 +53,18 @@ class Selector extends FlxTypedSpriteGroup chosenOptionString = Init.trueSettings.get(word); if (fpsCap) + { chosenOptionString = Std.string(Init.trueSettings.get(word)); - optionChosen = new Alphabet(FlxG.width / 2 + ((fpsCap) ? 200 : 0), shiftY + 20, chosenOptionString, ((fpsCap) ? false : true), false); - add(optionChosen); + optionChosen = new Alphabet(FlxG.width / 2 + ((fpsCap) ? 200 : 0), shiftY + 20, chosenOptionString, ((fpsCap) ? false : true), false); + add(optionChosen); + // This is weird... + } + else if (darkBG) + { + chosenOptionString = Std.string(Init.trueSettings.get(word)); + optionChosen = new Alphabet(FlxG.width / 2 + ((darkBG) ? 200 : 0), shiftY + 20, chosenOptionString, ((darkBG) ? false : true), false); + add(optionChosen); + } } public function createSelector(objectX:Float = 0, objectY:Float = 0, word:String, dir:String):FNFSprite diff --git a/source/gameFolder/meta/state/PlayState.hx b/source/gameFolder/meta/state/PlayState.hx index d8e1f2fb6..a10e38e96 100644 --- a/source/gameFolder/meta/state/PlayState.hx +++ b/source/gameFolder/meta/state/PlayState.hx @@ -257,6 +257,12 @@ class PlayState extends MusicBeatState // set song position before beginning Conductor.songPosition = -(Conductor.crochet * 4); + // darken everything but the arrows and ui via a flxsprite + var darknessBG:FlxSprite = new FlxSprite(FlxG.width * -0.5, FlxG.height * -0.5).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); + darknessBG.alpha = Init.trueSettings.get('Stage Darkness') * 0.01; + darknessBG.scrollFactor.set(0, 0); + add(darknessBG); + // strum setup strumLines = new FlxTypedGroup(); @@ -269,7 +275,7 @@ class PlayState extends MusicBeatState // create the game camera camFollow = new FlxObject(0, 0, 1, 1); camFollow.setPosition(camPos.x, camPos.y); - // check if the camera was following someone previouslyw + // check if the camera was following someone previously if (prevCamFollow != null) { camFollow = prevCamFollow; diff --git a/source/gameFolder/meta/state/menus/OptionsMenuState.hx b/source/gameFolder/meta/state/menus/OptionsMenuState.hx index b1cdba2b1..3318caa3c 100644 --- a/source/gameFolder/meta/state/menus/OptionsMenuState.hx +++ b/source/gameFolder/meta/state/menus/OptionsMenuState.hx @@ -43,6 +43,8 @@ class OptionsMenuState extends MusicBeatState If you plug in a value, the script will run when the option is hovered over. */ + // NOTE : Make sure to check Init.hx if you are trying to add options. + #if !html5 Discord.changePresence('OPTIONS MENU', 'Main Menu'); #end @@ -91,6 +93,7 @@ class OptionsMenuState extends MusicBeatState ['Accessibility Settings', null], ['', null], ['Filter', getFromOption], + ["Stage Darkness", getFromOption], ['Reduced Movements', getFromOption], // this shouldn't be get from option, just testing ['', null], @@ -387,7 +390,7 @@ class OptionsMenuState extends MusicBeatState case 1: // selector var selector:Selector = new Selector(10, letter.y, letter.text, Init.gameSettings.get(letter.text)[4], - (letter.text == 'Framerate Cap') ? true : false); + (letter.text == 'Framerate Cap') ? true : false, (letter.text == 'Stage Darkness') ? true : false); extrasMap.set(letter, selector); default: @@ -454,7 +457,8 @@ class OptionsMenuState extends MusicBeatState function updateSelector(selector:Selector, updateBy:Int) { var fps = selector.fpsCap; - if (!fps) + var bgdark = selector.darkBG; + if (!fps && !bgdark) { // get the current option as a number var storedNumber:Int = 0; @@ -483,6 +487,30 @@ class OptionsMenuState extends MusicBeatState Init.trueSettings.set(activeSubgroup.members[curSelection].text, selector.chosenOptionString); Init.saveSettings(); } + else if (bgdark) + { + // lazily hardcoded darkness cap + var originaldark = Init.trueSettings.get(activeSubgroup.members[curSelection].text); + var increase = 5 * updateBy; + if (originaldark + increase < 0) + increase = 0; + // high darkness cap + if (originaldark + increase > 100) + increase = 0; + + if (updateBy == -1) + selector.selectorPlay('left', 'press'); + else + selector.selectorPlay('right', 'press'); + + FlxG.sound.play(Paths.sound('scrollMenu')); + + originaldark += increase; + selector.chosenOptionString = Std.string(originaldark); + selector.optionChosen.text = Std.string(originaldark); + Init.trueSettings.set(activeSubgroup.members[curSelection].text, originaldark); + Init.saveSettings(); + } else { // bro I dont even know if the engine works in html5 why am I even doing this // lazily hardcoded fps cap