From 00ec466c766fd81bfd4ae615825591db0c85b197 Mon Sep 17 00:00:00 2001 From: MtH Date: Mon, 2 Aug 2021 03:29:34 +0200 Subject: [PATCH] sustain note scaling FIXED (imo) clipping is still wack. also i made it round instead of floor for the number of sus notes to place because that also just makes sense imo thanks to @cuckydev again for good ideas --- source/Note.hx | 9 +++++++-- source/PlayState.hx | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index cda58b1d6..ef57dc6f1 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -186,9 +186,14 @@ class Note extends FlxSprite prevNote.animation.play('redhold'); } - prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; prevNote.updateHitbox(); - // prevNote.setGraphicSize(); + + var scaleThing:Float = Math.round((Conductor.stepCrochet) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2))); + // get them a LIL closer together cuz the antialiasing blurs the edges + if (antialiasing) + scaleThing *= 1.0 + (1.0 / prevNote.frameHeight); + prevNote.scale.y = scaleThing / prevNote.frameHeight; + prevNote.updateHitbox(); } } } diff --git a/source/PlayState.hx b/source/PlayState.hx index 27aaee74d..9c830e8cf 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1623,7 +1623,7 @@ class PlayState extends MusicBeatState susLength = susLength / Conductor.stepCrochet; unspawnNotes.push(swagNote); - for (susNote in 0...Math.floor(susLength)) + for (susNote in 0...Math.round(susLength)) { oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)]; @@ -2118,11 +2118,11 @@ class PlayState extends MusicBeatState } var strumLineMid = strumLine.y + Note.swagWidth / 2; + daNote.y = (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2)); if (PreferencesMenu.getPref('downscroll')) { - daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); - + daNote.y += strumLine.y; if (daNote.isSustainNote) { if (daNote.animation.curAnim.name.endsWith("end") && daNote.prevNote != null) @@ -2133,28 +2133,18 @@ class PlayState extends MusicBeatState if ((!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid) { - // clipRect is applied to graphic itself so use frame Heights - var swagRect:FlxRect = new FlxRect(0, 0, daNote.frameWidth, daNote.frameHeight); - - swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y; - swagRect.y = daNote.frameHeight - swagRect.height; - daNote.clipRect = swagRect; + applyClipRect(daNote); } } } else { - daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); - + daNote.y = strumLine.y - daNote.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); - - swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y; - swagRect.height -= swagRect.y; - daNote.clipRect = swagRect; + applyClipRect(daNote); } } @@ -2241,6 +2231,26 @@ class PlayState extends MusicBeatState keyShit(); } + function applyClipRect(daNote:Note):Void + { + // clipRect is applied to graphic itself so use frame Heights + var swagRect:FlxRect = new FlxRect(0, 0, daNote.frameWidth, daNote.frameHeight); + var strumLineMid = strumLine.y + Note.swagWidth / 2; + + if (PreferencesMenu.getPref('downscroll')) + { + swagRect.height = (strumLineMid - daNote.y) / daNote.scale.y; + swagRect.y = daNote.frameHeight - swagRect.height; + } + else + { + swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y; + swagRect.height -= swagRect.y; + } + + daNote.clipRect = swagRect; + } + function killCombo():Void { if (combo > 5 && gf.animOffsets.exists('sad'))