diff --git a/source/AdminOptionsMenu.hx b/source/AdminOptionsMenu.hx new file mode 100644 index 0000000..582c46f --- /dev/null +++ b/source/AdminOptionsMenu.hx @@ -0,0 +1,150 @@ +package; + +import flixel.tweens.FlxTween; +import flixel.tweens.FlxEase; +import Controls.KeyboardScheme; +import Controls.Control; +import flash.text.TextField; +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.addons.display.FlxGridOverlay; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.input.keyboard.FlxKey; +import flixel.math.FlxMath; +import flixel.text.FlxText; +import flixel.util.FlxColor; +import lime.utils.Assets; +import flixel.util.FlxTimer; +#if desktop +import Discord.DiscordClient; +#end + +class AdminOptionsMenu extends MusicBeatState +{ + var selector:FlxText; + var curSelected:Int = 0; + + var controlsStrings:Array = []; + + private var grpControls:FlxTypedGroup; + + override function create() + { + #if desktop + DiscordClient.changePresence("In the Admin Options Menu", null); + #end + var menuBG:FlxSprite = new FlxSprite(); + menuBG.color = 0xff373737; + menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); + menuBG.updateHitbox(); + menuBG.antialiasing = true; + menuBG.loadGraphic(MainMenuState.randomizeBG()); + add(menuBG); + + controlsStrings = CoolUtil.coolStringFile( + (FlxG.save.data.adminMode ? 'Admin Mode ON' : 'Admin Mode OFF') + + "\n" + (FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF') + + "\n" + (FlxG.save.data.practiceMode ? 'Practice Mode ON' : 'Practice Mode OFF') + ); + + grpControls = new FlxTypedGroup(); + add(grpControls); + + for (i in 0...controlsStrings.length) + { + var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false); + controlLabel.screenCenter(X); + controlLabel.itemType = 'Vertical'; + controlLabel.isMenuItem = true; + controlLabel.targetY = i; + grpControls.add(controlLabel); + // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! + } + + super.create(); + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + if (controls.BACK) + { + FlxG.save.flush(); + FlxG.switchState(new OptionsMenu()); + } + if (controls.UP_P) + changeSelection(-1); + if (controls.DOWN_P) + changeSelection(1); + + if (controls.ACCEPT) + { + grpControls.remove(grpControls.members[curSelected]); + switch(curSelected) + { + case 0: + FlxG.save.data.adminMode = !FlxG.save.data.adminMode; + updateGroupControls((FlxG.save.data.adminMode ? 'Admin Mode ON' : 'Admin Mode OFF'), 1, 'Vertical'); + case 1: + FlxG.save.data.botplay = !FlxG.save.data.botplay; + updateGroupControls(FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF', 13, 'Vertical'); + case 2: + FlxG.save.data.practiceMode = !FlxG.save.data.practiceMode; + updateGroupControls(FlxG.save.data.practiceMode ? 'Practice Mode ON' : 'Practice Mode OFF', 13, 'Vertical'); + } + } + } + + var isSettingControl:Bool = false; + + override function beatHit() + { + super.beatHit(); + FlxTween.tween(FlxG.camera, {zoom:1.05}, 0.3, {ease: FlxEase.quadOut, type: BACKWARD}); + } + function updateGroupControls(controlText:String, yIndex:Int, controlTextItemType:String) + { + var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, controlText, true, false); + ctrl.screenCenter(X); + ctrl.isMenuItem = true; + ctrl.targetY = curSelected - yIndex; + ctrl.itemType = controlTextItemType; + grpControls.add(ctrl); + } + + function changeSelection(change:Int = 0) + { + #if !switch + // NGio.logEvent('Fresh'); + #end + + FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); + + curSelected += change; + + if (curSelected < 0) + curSelected = grpControls.length - 1; + if (curSelected >= grpControls.length) + curSelected = 0; + + // selector.y = (70 * curSelected) + 30; + + var bullShit:Int = 0; + + for (item in grpControls.members) + { + item.targetY = bullShit - curSelected; + bullShit++; + + item.alpha = 0.6; + // item.setGraphicSize(Std.int(item.width * 0.8)); + + if (item.targetY == 0) + { + item.alpha = 1; + // item.setGraphicSize(Std.int(item.width)); + } + } + } +} \ No newline at end of file diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 19248bc..1c1cf87 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -41,7 +41,7 @@ class OptionsMenu extends MusicBeatState ]; var curSongBarOptionSelected:Int; public static var onPlayState:Bool = false; - + override function create() { #if desktop @@ -94,7 +94,6 @@ class OptionsMenu extends MusicBeatState + "\n" + (FlxG.save.data.disableFps ? LanguageManager.getTextString('option_enable_fps') : LanguageManager.getTextString('option_disable_fps')) + "\n" + (CompatTool.save.data.compatMode ? LanguageManager.getTextString('option_enable_compat') : LanguageManager.getTextString('option_disable_compat')) + "\n" + (FlxG.save.data.modchart ? 'Mod Chart OFF' : 'Mod Chart ON') - + "\n" + (FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF') ); grpControls = new FlxTypedGroup(); @@ -212,12 +211,16 @@ class OptionsMenu extends MusicBeatState updateGroupControls(CompatTool.save.data.compatMode ? LanguageManager.getTextString('option_enable_compat') : LanguageManager.getTextString('option_disable_compat'), 11, 'Vertical'); case 12: if (!awaitingExploitation) FlxG.save.data.modchart = !FlxG.save.data.modchart; - updateGroupControls(FlxG.save.data.modchart ? 'Mod Chart OFF' : 'Mod Chart ON', 12, 'Vertical'); - case 13: - FlxG.save.data.botplay = !FlxG.save.data.botplay; - updateGroupControls(FlxG.save.data.botplay ? 'Bot Play ON' : 'Bot Play OFF', 13, 'Vertical'); + updateGroupControls(FlxG.save.data.modchart ? 'Mod Chart OFF' : 'Mod Chart ON', 12, 'Vertical'); } } + + if (FlxG.keys.justPressed.SEVEN) + { + FlxG.save.flush(); + CompatTool.save.flush(); + FlxG.switchState(new AdminOptionsMenu()); + } } var isSettingControl:Bool = false; diff --git a/source/PlayState.hx b/source/PlayState.hx index b86598a..09b6944 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -293,6 +293,8 @@ class PlayState extends MusicBeatState var bfTween:ColorTween; + var adminMode:Bool; + var tweenTime:Float; var songPosBar:FlxBar; @@ -464,6 +466,8 @@ class PlayState extends MusicBeatState barType = FlxG.save.data.songBarOption; + adminMode = FlxG.save.data.adminMode; + resetShader(); if (FreeplayState.isaCustomSong) { @@ -2256,6 +2260,14 @@ class PlayState extends MusicBeatState } function startCountdown():Void { + if (SONG.song.toLowerCase() == 'cheating' || SONG.song.toLowerCase() == 'unfairness' || SONG.song.toLowerCase() == 'exploitation') + { + if(FlxG.save.data.botplay || FlxG.save.data.practiceMode && !adminMode) + { + FlxG.switchState(new SusState()); // hehe get jumpscared non-admins + } + } + inCutscene = false; generateStaticArrows(0); @@ -3813,7 +3825,7 @@ class PlayState extends MusicBeatState } } - #if debug + if (adminMode) { if (FlxG.keys.justPressed.THREE) { if(FlxTransitionableState.skipNextTransIn) @@ -3829,7 +3841,8 @@ class PlayState extends MusicBeatState DiscordClient.changePresence("Chart Editor", null, null, true); #end } - #end + } + // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); // FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight); @@ -3884,27 +3897,23 @@ class PlayState extends MusicBeatState iconP1.changeState('normal'); } - #if debug + if (adminMode) { if (FlxG.keys.justPressed.FOUR) { trace('DUMP LOL:\nDAD POSITION: ${dad.getPosition()}\nBOYFRIEND POSITION: ${boyfriend.getPosition()}\nGF POSITION: ${gf.getPosition()}\nCAMERA POSITION: ${camFollow.getPosition()}'); } - /*if (FlxG.keys.justPressed.FIVE) + if (FlxG.keys.justPressed.FIVE) { FlxG.switchState(new CharacterDebug(dad.curCharacter)); } - if (FlxG.keys.justPressed.SEMICOLON) - { - FlxG.switchState(new CharacterDebug(boyfriend.curCharacter)); - } - if (FlxG.keys.justPressed.COMMA) + if (FlxG.keys.justPressed.NINE) { FlxG.switchState(new CharacterDebug(gf.curCharacter)); } if (FlxG.keys.justPressed.EIGHT) FlxG.switchState(new AnimationDebug(dad.curCharacter)); if (FlxG.keys.justPressed.SIX) - FlxG.switchState(new AnimationDebug(boyfriend.curCharacter));*/ + FlxG.switchState(new AnimationDebug(boyfriend.curCharacter)); if (FlxG.keys.justPressed.TWO) //Go 10 seconds into the future :O { FlxG.sound.music.pause(); @@ -3945,9 +3954,7 @@ class PlayState extends MusicBeatState vocals.play(); boyfriend.stunned = false; } - /*if (FlxG.keys.justPressed.THREE) - FlxG.switchState(new AnimationDebug(gf.curCharacter));*/ - #end + } if (startingSong) { @@ -3997,7 +4004,7 @@ class PlayState extends MusicBeatState FlxG.watch.addQuick("beatShit", curBeat); FlxG.watch.addQuick("stepShit", curStep); - if (health <= 0 && !botPlay) + if (health <= 0 && !botPlay && !FlxG.save.data.practiceMode) { if(!perfectMode) { @@ -4324,10 +4331,10 @@ class PlayState extends MusicBeatState if (!inCutscene && !botPlay) keyShit(); - #if debug + if (adminMode) { if (FlxG.keys.justPressed.ONE) endSong(); - #end + } if (updatevels) { @@ -4566,7 +4573,7 @@ class PlayState extends MusicBeatState FlxG.sound.music.volume = 0; vocals.volume = 0; - if (SONG.validScore && !botPlay && !(!modchartoption && (SONG.song.toLowerCase() == 'cheating' || SONG.song.toLowerCase() == 'unfairness' || SONG.song.toLowerCase() == 'kabunga' || localFunny == CharacterFunnyEffect.Exbungo || localFunny == CharacterFunnyEffect.Recurser || SONG.song.toLowerCase() == 'exploitation'))) + if (SONG.validScore && !FlxG.save.data.practiceMode && !botPlay && !(!modchartoption && (SONG.song.toLowerCase() == 'cheating' || SONG.song.toLowerCase() == 'unfairness' || SONG.song.toLowerCase() == 'kabunga' || localFunny == CharacterFunnyEffect.Exbungo || localFunny == CharacterFunnyEffect.Recurser || SONG.song.toLowerCase() == 'exploitation'))) { trace("score is valid"); @@ -4588,7 +4595,7 @@ class PlayState extends MusicBeatState } #end - if (!botPlay) { + if (!botPlay || !FlxG.save.data.practiceMode) { // Song Character Unlocks (Story Mode) if (isStoryMode) { @@ -4637,7 +4644,7 @@ class PlayState extends MusicBeatState FlxG.save.data.songsCompleted = new Array(); } completedSongs = FlxG.save.data.songsCompleted; - if (!botPlay) completedSongs.push(storyPlaylist[0]); + if (!botPlay || !FlxG.save.data.practiceMode) completedSongs.push(storyPlaylist[0]); for (i in 0...mustCompleteSongs.length) { if (!completedSongs.contains(mustCompleteSongs[i])) @@ -4727,13 +4734,13 @@ class PlayState extends MusicBeatState // if () StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true; - if (SONG.validScore && !botPlay) + if (SONG.validScore && !botPlay && !FlxG.save.data.practiceMode) { Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty, characteroverride == "none" || characteroverride == "bf" ? "bf" : characteroverride); } - if (!botPlay) FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked; + if (!botPlay && !FlxG.save.data.practiceMode) FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked; FlxG.save.flush(); } else @@ -4810,7 +4817,7 @@ class PlayState extends MusicBeatState FlxG.save.data.songsCompletedCanon = new Array(); } completedSongs = FlxG.save.data.songsCompletedCanon; - if (!botPlay) completedSongs.push(curSong); + if (!botPlay || !FlxG.save.data.practiceMode) completedSongs.push(curSong); for (i in 0...mustCompleteSongs.length) { if (!completedSongs.contains(mustCompleteSongs[i])) diff --git a/source/SaveDataHandler.hx b/source/SaveDataHandler.hx index 664502b..85c1fef 100644 --- a/source/SaveDataHandler.hx +++ b/source/SaveDataHandler.hx @@ -61,5 +61,16 @@ class SaveDataHandler if (FlxG.save.data.songBarOption == null) FlxG.save.data.songBarOption = 'ShowTime'; + + if (FlxG.save.data.adminMode == null) { + #if debug + FlxG.save.data.adminMode = true; + #else + FlxG.save.data.adminMode = false; + #end + } + + if (FlxG.save.data.practiceMode == null) + FlxG.save.data.practiceMode = false; } } \ No newline at end of file diff --git a/source/TitleState.hx b/source/TitleState.hx index b5bb453..89c9785 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -318,15 +318,6 @@ class TitleState extends MusicBeatState pressedEnter = true; #end } - - #if debug - if (FlxG.keys.justPressed.S) - { - PlayState.SONG = Song.loadFromJson("bonus-song"); - //PlayState.formoverride = 'shaggy'; - LoadingState.loadAndSwitchState(new PlayState()); - } - #end if (FlxG.keys.justPressed.ALT) { @@ -349,9 +340,9 @@ class TitleState extends MusicBeatState new FlxTimer().start(2, function(tmr:FlxTimer) { - #if debug + /* #if debug FlxG.save.data.exploitationState = null; - #end + #end */ FlxG.switchState(FlxG.save.data.alreadyGoneToWarningScreen && FlxG.save.data.exploitationState != 'playing' ? new MainMenuState() : new OutdatedSubState()); }); }