Skip to content

Commit

Permalink
making the delay bar optional cuz annoying
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Apr 7, 2024
1 parent 2bf9900 commit 16495f6
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 25 deletions.
1 change: 1 addition & 0 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
33 changes: 33 additions & 0 deletions source/backend/Wife3.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package backend;

class Wife3 {
static final erfs:Array<Float> = [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;
}
}`
6 changes: 6 additions & 0 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
52 changes: 28 additions & 24 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<StrumNote>();
add(strumLineNotes);
Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 16495f6

Please sign in to comment.