Skip to content

Commit

Permalink
another experiment from good ol' shadow mario
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCatYT committed Feb 27, 2024
1 parent e2b6588 commit cc71b5c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
3 changes: 3 additions & 0 deletions source/states/CreditsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class CreditsState extends MusicBeatState {
['Engine Contributors'],
['CrowPlexus', 'gabriela', 'Input System v3, Major Help and Other PRs', 'https://twitter.com/crowplexus', 'A1A1A1'],
['Keoiki', 'keoiki', 'Note Splash Animations and Latin Alphabet', 'https://twitter.com/Keoiki_', 'D2D2D2'],
['lunarcleint', 'lunar', 'codename engine code', 'https://github.com/lunarcleint', 'A1A1A1'],
['NeeEoo', 'neo', 'again, codename engine code', 'https://github.com/NeeEoo', 'A1A1A1'],
['Nex', 'nex', 'prs from psych, and other shit', 'https://github.com/NexIsDumb', 'A1A1A1'],
['SqirraRNG', 'sqirra', 'Crash Handler and Base code for\nChart Editor\'s Waveform', 'https://twitter.com/gedehari', 'E1843A'],
['EliteMasterEric', 'mastereric', 'Runtime Shaders support', 'https://twitter.com/EliteMasterEric', 'FFBD40'],
['AlterToriel', 'altertoriel', 'Made the Character Selection Screen.', '', 'A1A1A1'],
Expand Down
37 changes: 35 additions & 2 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ class PlayState extends MusicBeatState
public var timeBar:Bar;
var songPercent:Float = 0;

// something experimental, probably might soon be a debug-only feature ig...
public var delayBar:FlxSprite;
public var delayBarBg:FlxSprite;
public var delayBarTxt:FlxText;

public var ratingsData:Array<Rating> = Rating.loadDefault();
public var fullComboFunction:Void->Void = null;

Expand Down Expand Up @@ -547,6 +552,24 @@ class PlayState extends MusicBeatState
uiGroup.add(timeBar);
uiGroup.add(timeTxt);

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);

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);

strumLineNotes = new FlxTypedGroup<StrumNote>();
add(strumLineNotes);
add(grpNoteSplashes);
Expand Down Expand Up @@ -1765,8 +1788,7 @@ class PlayState extends MusicBeatState
Conductor.songPosition += elapsed * 1000 * playbackRate;
if (Conductor.songPosition >= 0) {
var timeDiff:Float = Math.abs(FlxG.sound.music.time - Conductor.songPosition - Conductor.offset);
if(timeDiff > 15 * playbackRate)
Conductor.songPosition = FlxMath.lerp(Conductor.songPosition, FlxG.sound.music.time, FlxMath.bound(elapsed * 10, 0, 1));
Conductor.songPosition = FlxMath.lerp(Conductor.songPosition, FlxG.sound.music.time, FlxMath.bound(elapsed * 2.5, 0, 1));

if (timeDiff > 25 * playbackRate) trace('Warning! Delay is too fucking high!!');

Expand All @@ -1776,6 +1798,17 @@ class PlayState extends MusicBeatState
trace('Difference: ' + (FlxG.sound.music.time - Conductor.songPosition));
}
#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;
}
}

Expand Down

0 comments on commit cc71b5c

Please sign in to comment.