From 16495f6597f1d38db78e26c6b8c0ad1c93c67954 Mon Sep 17 00:00:00 2001 From: CharlesCatYT Date: Sun, 7 Apr 2024 01:23:31 -0400 Subject: [PATCH] making the delay bar optional cuz annoying --- source/backend/ClientPrefs.hx | 1 + source/backend/Wife3.hx | 33 ++++++++++++++++++ source/options/VisualsUISubState.hx | 6 ++++ source/psychlua/FunkinLua.hx | 3 +- source/states/PlayState.hx | 52 ++++++++++++++++------------- 5 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 source/backend/Wife3.hx diff --git a/source/backend/ClientPrefs.hx b/source/backend/ClientPrefs.hx index 0421af0..c05f32c 100644 --- a/source/backend/ClientPrefs.hx +++ b/source/backend/ClientPrefs.hx @@ -26,6 +26,7 @@ import states.StartingState; public var sfxVolume:Float = 100; public var fullscreen:Bool = false; public var showWatermark:Bool = true; + public var delayBar:Bool = false; public var antialiasing:Bool = true; public var noteSkin:String = 'Default'; public var splashSkin:String = 'Psych'; diff --git a/source/backend/Wife3.hx b/source/backend/Wife3.hx new file mode 100644 index 0000000..890d929 --- /dev/null +++ b/source/backend/Wife3.hx @@ -0,0 +1,33 @@ +package backend; + +class Wife3 { + static final erfs:Array = [0.254829592, -0.284496736, 1.421413741, 1.453152027, 1.061405429]; + static final p:Float = 0.3275911; + + static function erf(x:Float):Float { + var theSignLol:Int = (x < 0 ? -1 : 1); + x = Math.abs(x); + + var t:Float = 1 / (1 + p * x); + var y:Float = 1 - (((((erfs[4] * t + erfs[3]) * t) + erfs[2]) * t + erfs[1]) * t + erfs[0]) * t * Math.exp(-x * x); + return theSignLol * y; + } + + public static var max_points = 1.0; + public static var miss_weight = -5.5; + public static var ts_pow = .75; + public static var shit_weight:Float = 200; + + public static function getAcc(noteDiff:Float):Float { + var ts:Float = PlayState.instance.playbackRate; + + var ridic:Float = 5 * ts; + var zeroBucks:Float = 65 * Math.pow(ts, ts_pow); + var dev:Float = 22.7 * Math.pow(ts, ts_pow); + if(noteDiff <= ridic) return max_points; + else if(noteDiff <= zeroBucks) return max_points * erf((zeroBucks - noteDiff) / dev); + else if(noteDiff <= shit_weight) return (noteDiff - zeroBucks) * miss_weight / (shit_weight - zeroBucks); + + return miss_weight; + } +}` \ No newline at end of file diff --git a/source/options/VisualsUISubState.hx b/source/options/VisualsUISubState.hx index 46ebd7b..deb982e 100644 --- a/source/options/VisualsUISubState.hx +++ b/source/options/VisualsUISubState.hx @@ -102,6 +102,12 @@ class VisualsUISubState extends BaseOptionsMenu 'bool'); addOption(option); + var option:Option = new Option('Delay Bar', + "If checked, a delay indicator will be displayed, probably for testing.", + 'delayBar', + 'bool'); + addOption(option); + var option:Option = new Option('Enable Vignette', "If checked, a vignette effect will appear and change depending on your health.", 'enableVignette', diff --git a/source/psychlua/FunkinLua.hx b/source/psychlua/FunkinLua.hx index 06c20d8..621bcc2 100644 --- a/source/psychlua/FunkinLua.hx +++ b/source/psychlua/FunkinLua.hx @@ -113,7 +113,7 @@ class FunkinLua { set('primaryModifier', Main.modifier_keys[0]); // Control or Command set('secondaryModifier', Main.modifier_keys[1]); // Alt or Option - + set('isStoryMode', PlayState.isStoryMode); set('difficulty', PlayState.storyDifficulty); @@ -192,6 +192,7 @@ class FunkinLua { set('ghostTapping', ClientPrefs.data.ghostTapping); set('hideHud', ClientPrefs.data.hideHud); set('timeBarType', ClientPrefs.data.timeBarType); + set('shadersEnabled', ClientPrefs.data.shaders); set('scoreZoom', ClientPrefs.data.scoreZoom); set('cameraZoomOnBeat', ClientPrefs.data.camZooms); set('flashingLights', ClientPrefs.data.flashing); diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 9c3332d..fc84089 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -552,23 +552,25 @@ class PlayState extends MusicBeatState uiGroup.add(timeBar); uiGroup.add(timeTxt); - delayBarBg = new FlxSprite().makeGraphic(300, 30, FlxColor.BLACK); - delayBarBg.screenCenter(); + if (ClientPrefs.data.delayBar) { + delayBarBg = new FlxSprite().makeGraphic(300, 30, FlxColor.BLACK); + delayBarBg.screenCenter(); - delayBar = new FlxSprite(640).makeGraphic(1, 22, FlxColor.WHITE); - delayBar.scale.x = 0; - delayBar.updateHitbox(); - delayBar.screenCenter(Y); + delayBar = new FlxSprite(640).makeGraphic(1, 22, FlxColor.WHITE); + delayBar.scale.x = 0; + delayBar.updateHitbox(); + delayBar.screenCenter(Y); - delayBarTxt = new FlxText(0, 312, 100, '0 ms', 32); - delayBarTxt.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); - delayBarTxt.scrollFactor.set(); - delayBarTxt.borderSize = 2; - delayBarTxt.screenCenter(X); + delayBarTxt = new FlxText(0, 312, 100, '0 ms', 32); + delayBarTxt.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); + delayBarTxt.scrollFactor.set(); + delayBarTxt.borderSize = 2; + delayBarTxt.screenCenter(X); - uiGroup.add(delayBarBg); - uiGroup.add(delayBar); - uiGroup.add(delayBarTxt); + uiGroup.add(delayBarBg); + uiGroup.add(delayBar); + uiGroup.add(delayBarTxt); + } strumLineNotes = new FlxTypedGroup(); add(strumLineNotes); @@ -1825,16 +1827,18 @@ class PlayState extends MusicBeatState } #end - var daScale = Math.max(-144, Math.min(144, FlxG.sound.music.time - Conductor.songPosition) * (144/25)); - delayBar.scale.x = Math.abs(daScale); - delayBar.updateHitbox(); - if(daScale < 0) delayBar.x = 640 - delayBar.scale.x; - else delayBar.x = 640; - - var timeDiff:Int = Math.round(FlxG.sound.music.time - Conductor.songPosition); - delayBarTxt.text = '$timeDiff ms'; - if(Math.abs(timeDiff) > 15) delayBar.color = FlxColor.RED; - else delayBar.color = FlxColor.WHITE; + if (ClientPrefs.data.delayBar) { + var daScale = Math.max(-144, Math.min(144, FlxG.sound.music.time - Conductor.songPosition) * (144 / 25)); + delayBar.scale.x = Math.abs(daScale); + delayBar.updateHitbox(); + if (daScale < 0) delayBar.x = 640 - delayBar.scale.x; + else delayBar.x = 640; + + var timeDiff:Int = Math.round(FlxG.sound.music.time - Conductor.songPosition); + delayBarTxt.text = '$timeDiff ms'; + if (Math.abs(timeDiff) > 15) delayBar.color = FlxColor.RED; + else delayBar.color = FlxColor.WHITE; + } } }