diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 5495a6aa..31b89964 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -83,14 +83,6 @@ class Note extends FlxSprite @:dox(hide) public var __strumCameras:Array = null; @:dox(hide) public var __strum:Strum = null; @:dox(hide) public var __noteAngle:Float = 0; - @:dox(hide) public var __scrollSpeed(default, set):Float = 0; - @:dox(hide) public var __length:Float = 0; - - @:dox(hide) private inline function set___scrollSpeed(v:Float) { - if(__scrollSpeed != v) - __length = 0.45 * CoolUtil.quantize(v, 100); - return __scrollSpeed = v; - } private function get_noteType() { if (PlayState.instance == null) return null; @@ -196,7 +188,17 @@ class Note extends FlxSprite public var lastScrollSpeed:Null = null; public var angleOffsets:Bool = true; - public var useAntialiasingFix:Bool = false; + public var gapFix:Single = 0; + public var useAntialiasingFix(get, set):Bool; + inline function set_useAntialiasingFix(v:Bool) { + if(v != useAntialiasingFix) { + gapFix = v ? 1 : 0; + } + return v; + } + inline function get_useAntialiasingFix() { + return gapFix>0; + } /** * Whenever the position of the note should be relative to the strum position or not. @@ -215,7 +217,7 @@ class Note extends FlxSprite super.drawComplex(camera); } - var __notePosFrameOffset:FlxPoint = FlxPoint.get(); + static var __notePosFrameOffset:FlxPoint = FlxPoint.get(); override function draw() { @:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras; @@ -259,20 +261,21 @@ class Note extends FlxSprite public var latePressWindow:Float = 1; public function updateSustain(strum:Strum) { - if (nextSustain != null && lastScrollSpeed != __scrollSpeed) { - // is long sustain - lastScrollSpeed = __scrollSpeed; + var scrollSpeed = strum.getScrollSpeed(this); - scale.y = (sustainLength * __length) / frameHeight; + var len = 0.45 * CoolUtil.quantize(scrollSpeed, 100); + + if (nextSustain != null && lastScrollSpeed != scrollSpeed) { + // is long sustain + lastScrollSpeed = scrollSpeed; + + scale.y = (sustainLength * len) / frameHeight; updateHitbox(); - if (useAntialiasingFix) { - // dumbass antialiasing - scale.y += 1 / frameHeight; - } + scale.y += gapFix / frameHeight; } if (!wasGoodHit) return; - var t = FlxMath.bound((Conductor.songPosition - strumTime) / (height) * __length, 0, 1); + var t = FlxMath.bound((Conductor.songPosition - strumTime) / (height) * len, 0, 1); var swagRect = this.clipRect == null ? new FlxRect() : this.clipRect; swagRect.x = 0; swagRect.y = t * frameHeight; diff --git a/source/funkin/game/SplashGroup.hx b/source/funkin/game/SplashGroup.hx index 67e136c5..1fad99d4 100644 --- a/source/funkin/game/SplashGroup.hx +++ b/source/funkin/game/SplashGroup.hx @@ -83,6 +83,7 @@ class SplashGroup extends FlxTypedGroup { } // immediatly draw once and put image in GPU to prevent freezes + // TODO: change to graphics cache splashSprite.drawComplex(FlxG.camera); } catch(e) { Logs.trace('Couldn\'t parse splash data for "${path}": ${e.toString()}', ERROR); diff --git a/source/funkin/game/Strum.hx b/source/funkin/game/Strum.hx index 656a1343..0b3ca8ee 100644 --- a/source/funkin/game/Strum.hx +++ b/source/funkin/game/Strum.hx @@ -88,7 +88,6 @@ class Strum extends FlxSprite { daNote.__strum = this; daNote.scrollFactor.set(scrollFactor.x, scrollFactor.y); daNote.__noteAngle = getNotesAngle(daNote); - daNote.__scrollSpeed = getScrollSpeed(daNote); daNote.angle = daNote.isSustainNote ? daNote.__noteAngle : angle; updateNotePos(daNote); @@ -96,10 +95,10 @@ class Strum extends FlxSprite { private inline function updateNotePos(daNote:Note) { if (daNote.strumRelativePos) { - daNote.setPosition((this.width - daNote.width) / 2, (daNote.strumTime - Conductor.songPosition) * daNote.__length); + daNote.setPosition((this.width - daNote.width) / 2, (daNote.strumTime - Conductor.songPosition) * (0.45 * CoolUtil.quantize(getScrollSpeed(daNote), 100))); if (daNote.isSustainNote) daNote.y += N_WIDTHDIV2; } else { - var offset = FlxPoint.get(0, (Conductor.songPosition - daNote.strumTime) * daNote.__length); + var offset = FlxPoint.get(0, (Conductor.songPosition - daNote.strumTime) * (0.45 * CoolUtil.quantize(getScrollSpeed(daNote), 100))); var realOffset = FlxPoint.get(0, 0); if (daNote.isSustainNote) offset.y -= N_WIDTHDIV2;