From 6b979e50cb912ed041a76b225f184ed6e22ab8e9 Mon Sep 17 00:00:00 2001 From: MtH Date: Wed, 31 Mar 2021 03:02:12 +0200 Subject: [PATCH] susnote clip for downscroll still looks like shit tho --- source/Note.hx | 2 ++ source/PlayState.hx | 32 +++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index d0b582e50..e3c8913cb 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -184,6 +184,8 @@ class Note extends FlxSprite } prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; + if (PreferencesMenu.getPref('downscroll')) + prevNote.angle = 0; prevNote.updateHitbox(); // prevNote.setGraphicSize(); } diff --git a/source/PlayState.hx b/source/PlayState.hx index 0dd29b668..6565c4eb1 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1647,21 +1647,35 @@ class PlayState extends MusicBeatState daNote.active = true; } + var strumLineMid = strumLine.y + Note.swagWidth / 2; + if (PreferencesMenu.getPref('downscroll')) + { daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + + if (daNote.isSustainNote && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) + && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid) + { + // div by scale because cliprect is affected by scale i THINK + var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); + + swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y; + daNote.clipRect = swagRect; + } + } else + { daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); - // i am so fucking sorry for this if condition - if (daNote.isSustainNote - && daNote.y + daNote.offset.y <= strumLine.y + Note.swagWidth / 2 - && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))) - { - var swagRect = new FlxRect(0, strumLine.y + Note.swagWidth / 2 - daNote.y, daNote.width * 2, daNote.height * 2); - swagRect.y /= daNote.scale.y; - swagRect.height -= swagRect.y; + if (daNote.isSustainNote && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) + && daNote.y + daNote.offset.y * daNote.scale.y <= strumLineMid) + { + var swagRect:FlxRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); - daNote.clipRect = swagRect; + swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y; + swagRect.height -= swagRect.y; + daNote.clipRect = swagRect; + } } if (!daNote.mustPress && daNote.wasGoodHit)