From 18034002c4bc844e68a2126896e340be9cf8b93b Mon Sep 17 00:00:00 2001 From: KadeDev Date: Tue, 27 Apr 2021 14:03:39 -0700 Subject: [PATCH] added toggle for ghost tapping --- source/KadeEngineData.hx | 3 +++ source/Options.hx | 23 +++++++++++++++++++++++ source/OptionsMenu.hx | 1 + source/PlayState.hx | 16 +++++++++++++++- 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 71728c6..38bd27d 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -60,6 +60,9 @@ class KadeEngineData if (FlxG.save.data.watermark == null) FlxG.save.data.watermark = true; + if (FlxG.save.data.ghost == null) + FlxG.save.data.ghost = true; + Conductor.recalculateTimings(); Main.watermarks = FlxG.save.data.watermark; diff --git a/source/Options.hx b/source/Options.hx index aafebd8..95f145c 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -69,6 +69,8 @@ class Option public function right():Bool { return throw "stub!"; } } + + class DFJKOption extends Option { private var controls:Controls; @@ -119,6 +121,27 @@ class DownscrollOption extends Option } } +class GhostTapOption extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.ghost = !FlxG.save.data.ghost; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return FlxG.save.data.ghost ? "Ghost Tapping" : "No Ghost Tapping"; + } +} + class AccuracyOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 139279f..b0da8b7 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -22,6 +22,7 @@ class OptionsMenu extends MusicBeatState var options:Array = [ new OptionCatagory("Gameplay", [ new DFJKOption(controls), + new GhostTapOption("Ghost Tapping is when you tap a direction and it doesn't give you a miss."), new Judgement("Customize your Hit Timings (LEFT or RIGHT)"), #if desktop new FPSCapOption("Cap your FPS (Left for -10, Right for +10. SHIFT to go faster)"), diff --git a/source/PlayState.hx b/source/PlayState.hx index 3e6dfe3..baf906a 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -3249,6 +3249,14 @@ class PlayState extends MusicBeatState goodNoteHit(possibleNotes[0]); else if (possibleNotes.length > 0 && !dontCheck) { + if (!FlxG.save.data.ghost) + { + for (shit in 0...pressArray.length) + { // if a direction is hit that shouldn't be + if (pressArray[shit] && !directionList.contains(shit)) + noteMiss(shit, null); + } + } for (coolNote in possibleNotes) { if (pressArray[coolNote.noteData]) @@ -3260,8 +3268,14 @@ class PlayState extends MusicBeatState } } } + else if (!FlxG.save.data.ghost) + { + for (shit in 0...pressArray.length) + if (pressArray[shit]) + noteMiss(shit, null); + } - if (dontCheck && possibleNotes.length > 0) + if (dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost) { if (mashViolations > 4) {