1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-06 03:28:08 +00:00

stinky dipshit specto viz optimization

This commit is contained in:
Cameron Taylor 2022-02-09 13:37:57 -05:00
parent 44e720ee28
commit 0b9c9d7533
2 changed files with 25 additions and 1 deletions

View file

@ -46,6 +46,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
{ {
var lineShit:FlxSprite = new FlxSprite(100, i / lengthOfShit * daHeight).makeGraphic(1, 1, col); var lineShit:FlxSprite = new FlxSprite(100, i / lengthOfShit * daHeight).makeGraphic(1, 1, col);
lineShit.active = false; lineShit.active = false;
lineShit.ID = i;
add(lineShit); add(lineShit);
} }
} }
@ -56,6 +57,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
var numSamples:Int = 0; var numSamples:Int = 0;
public var wavOptimiz:Int = 10;
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
switch (visType) switch (visType)
@ -68,6 +71,11 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
default: default:
} }
forEach(spr ->
{
spr.visible = FlxG.game.ticks % wavOptimiz == spr.ID % wavOptimiz;
});
// if visType is static, call updateVisulizer() manually whenever you want to update it! // if visType is static, call updateVisulizer() manually whenever you want to update it!
super.update(elapsed); super.update(elapsed);
@ -110,6 +118,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
group.members[i].setGraphicSize(Std.int(Math.max(line.length, 1)), Std.int(1)); group.members[i].setGraphicSize(Std.int(Math.max(line.length, 1)), Std.int(1));
group.members[i].angle = line.degrees; group.members[i].angle = line.degrees;
} }
wavOptimiz = 1; // hard set wavOptimiz to 1 so its a pure thing
} }
} }
@ -234,6 +244,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
} }
} }
var curTime:Float = 0;
public function updateVisulizer():Void public function updateVisulizer():Void
{ {
if (vis.snd != null) if (vis.snd != null)
@ -247,7 +259,19 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
if (vis.snd.playing) if (vis.snd.playing)
remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, numSamples)); remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, numSamples));
else else
{
if (curTime == Conductor.songPosition)
{
wavOptimiz = 3;
return; // already did shit, so finishes function early
}
curTime = Conductor.songPosition;
remappedShit = Std.int(FlxMath.remapToRange(Conductor.songPosition, 0, vis.snd.length, 0, numSamples)); remappedShit = Std.int(FlxMath.remapToRange(Conductor.songPosition, 0, vis.snd.length, 0, numSamples));
}
wavOptimiz = 8;
var i = remappedShit; var i = remappedShit;
var prevLine:FlxPoint = new FlxPoint(); var prevLine:FlxPoint = new FlxPoint();

View file

@ -1166,7 +1166,7 @@ class ChartingState extends MusicBeatState
} }
// generates the cool sidebar shit // generates the cool sidebar shit
if (sidePreview != null) if (sidePreview != null && sidePreview.active)
{ {
sidePreview.drawRect(0, 0, 40, FlxG.height, 0xFF444444); sidePreview.drawRect(0, 0, 40, FlxG.height, 0xFF444444);