From b6f03dd225543053500c7c4ee653cc69674ffec0 Mon Sep 17 00:00:00 2001 From: Kade M Date: Tue, 22 Jun 2021 03:34:09 -0700 Subject: [PATCH] optimization setting --- source/HitGraph.hx | 2 +- source/KadeEngineData.hx | 3 +++ source/Options.hx | 21 ++++++++++++++++++ source/OptionsMenu.hx | 5 +++-- source/PlayState.hx | 40 +++++++++++++++++++++++++--------- source/PlayStateChangeables.hx | 1 + 6 files changed, 59 insertions(+), 13 deletions(-) diff --git a/source/HitGraph.hx b/source/HitGraph.hx index 7b1d383..169d823 100644 --- a/source/HitGraph.hx +++ b/source/HitGraph.hx @@ -237,7 +237,7 @@ class HitGraph extends Sprite /*if (i == 0) gfx.moveTo(graphX, _axis.y + pointY);*/ - gfx.drawRect(graphX + fitX(history[i][2]), pointY,4,4); + gfx.drawRect(fitX(history[i][2]), pointY,4,4); gfx.endFill(); } diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index f69fb5f..764ecf8 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -90,6 +90,9 @@ class KadeEngineData if (FlxG.save.data.inputShow == null) FlxG.save.data.inputShow = false; + if (FlxG.save.data.optimize == null) + FlxG.save.data.optimize = false; + Conductor.recalculateTimings(); PlayerSettings.player1.controls.loadKeyBinds(); KeyBinds.keyCheck(); diff --git a/source/Options.hx b/source/Options.hx index 3c4742d..c7ef026 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -504,6 +504,27 @@ class RainbowFPSOption extends Option } } +class Optimization extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.optimize = !FlxG.save.data.optimize; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return "Optimization " + (FlxG.save.data.optimize ? "ON" : "OFF"); + } +} + class NPSDisplayOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index c8e8950..9a89d12 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -57,9 +57,10 @@ class OptionsMenu extends MusicBeatState #end new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."), new WatermarkOption("Enable and disable all watermarks from the engine."), - new BotPlay("Showcase your charts and mods with autoplay."), new ScoreScreen("Show the score screen after the end of a song"), - new ShowInput("Display every single input in the score screen.") + new ShowInput("Display every single input in the score screen."), + new Optimization("No backgrounds, no characters, centered notes, no player 2."), + new BotPlay("Showcase your charts and mods with autoplay."), ]) ]; diff --git a/source/PlayState.hx b/source/PlayState.hx index 840e460..67cd656 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -258,7 +258,7 @@ class PlayState extends MusicBeatState PlayStateChangeables.safeFrames = FlxG.save.data.frames; PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed; PlayStateChangeables.botPlay = FlxG.save.data.botplay; - + PlayStateChangeables.Optimize = FlxG.save.data.optimize; // pre lowercasing the song name (create) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); @@ -271,6 +271,8 @@ class PlayState extends MusicBeatState #if windows executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); + if (executeModchart) + PlayStateChangeables.Optimize = false; #end #if !cpp executeModchart = false; // FORCE disable for non cpp targets @@ -377,6 +379,9 @@ class PlayState extends MusicBeatState } } else {stageCheck = SONG.stage;} + if (!PlayStateChangeables.Optimize) + { + switch(stageCheck) { case 'halloween': @@ -756,7 +761,7 @@ class PlayState extends MusicBeatState add(stageCurtains); } } - + } //defaults if no gf was found in chart var gfCheck:String = 'gf'; @@ -781,7 +786,7 @@ class PlayState extends MusicBeatState default: curGf = 'gf'; } - + gf = new Character(400, 130, curGf); gf.scrollFactor.set(0.95, 0.95); @@ -870,14 +875,19 @@ class PlayState extends MusicBeatState gf.y += 300; } - add(gf); + if (!PlayStateChangeables.Optimize) + { + add(gf); + + // Shitty layering but whatev it works LOL + if (curStage == 'limo') + add(limo); + + add(dad); + add(boyfriend); + } - // Shitty layering but whatev it works LOL - if (curStage == 'limo') - add(limo); - add(dad); - add(boyfriend); if (loadRep) { FlxG.watch.addQuick('rep rpesses',repPresses); @@ -1538,6 +1548,10 @@ class PlayState extends MusicBeatState oldNote = null; var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote); + + if (!gottaHitNote && PlayStateChangeables.Optimize) + continue; + swagNote.sustainLength = songNotes[2]; swagNote.scrollFactor.set(0, 0); @@ -1598,6 +1612,9 @@ class PlayState extends MusicBeatState //defaults if no noteStyle was found in chart var noteTypeCheck:String = 'normal'; + if (PlayStateChangeables.Optimize && player == 0) + continue; + if (SONG.noteStyle == null) { switch(storyWeek) {case 6: noteTypeCheck = 'pixel';} } else {noteTypeCheck = SONG.noteStyle;} @@ -1732,6 +1749,9 @@ class PlayState extends MusicBeatState babyArrow.x += 50; babyArrow.x += ((FlxG.width / 2) * player); + if (PlayStateChangeables.Optimize) + babyArrow.x -= 275; + cpuStrums.forEach(function(spr:FlxSprite) { spr.centerOffsets(); //CPU arrows start out slightly off-center @@ -1929,7 +1949,7 @@ class PlayState extends MusicBeatState switch (curStage) { case 'philly': - if (trainMoving) + if (trainMoving && !PlayStateChangeables.Optimize) { trainFrameTiming += elapsed; diff --git a/source/PlayStateChangeables.hx b/source/PlayStateChangeables.hx index 8ee4995..17a430a 100644 --- a/source/PlayStateChangeables.hx +++ b/source/PlayStateChangeables.hx @@ -4,4 +4,5 @@ class PlayStateChangeables public static var safeFrames:Int; public static var scrollSpeed:Float; public static var botPlay:Bool; + public static var Optimize:Bool; } \ No newline at end of file