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
This commit is contained in:
MtH 2021-08-02 03:29:34 +02:00
parent c9f31226e6
commit 00ec466c76
2 changed files with 33 additions and 18 deletions

View file

@ -186,9 +186,14 @@ class Note extends FlxSprite
prevNote.animation.play('redhold'); prevNote.animation.play('redhold');
} }
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed;
prevNote.updateHitbox(); 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();
} }
} }
} }

View file

@ -1623,7 +1623,7 @@ class PlayState extends MusicBeatState
susLength = susLength / Conductor.stepCrochet; susLength = susLength / Conductor.stepCrochet;
unspawnNotes.push(swagNote); unspawnNotes.push(swagNote);
for (susNote in 0...Math.floor(susLength)) for (susNote in 0...Math.round(susLength))
{ {
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)]; oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
@ -2118,11 +2118,11 @@ class PlayState extends MusicBeatState
} }
var strumLineMid = strumLine.y + Note.swagWidth / 2; var strumLineMid = strumLine.y + Note.swagWidth / 2;
daNote.y = (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2));
if (PreferencesMenu.getPref('downscroll')) 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.isSustainNote)
{ {
if (daNote.animation.curAnim.name.endsWith("end") && daNote.prevNote != null) 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))) if ((!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
&& daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= strumLineMid)
{ {
// clipRect is applied to graphic itself so use frame Heights applyClipRect(daNote);
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;
} }
} }
} }
else 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 if (daNote.isSustainNote
&& (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit)))
&& daNote.y + daNote.offset.y * daNote.scale.y <= strumLineMid) && 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); applyClipRect(daNote);
swagRect.y = (strumLineMid - daNote.y) / daNote.scale.y;
swagRect.height -= swagRect.y;
daNote.clipRect = swagRect;
} }
} }
@ -2241,6 +2231,26 @@ class PlayState extends MusicBeatState
keyShit(); 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 function killCombo():Void
{ {
if (combo > 5 && gf.animOffsets.exists('sad')) if (combo > 5 && gf.animOffsets.exists('sad'))