From 7f5d4ac35fb289e82389dcb3a9c8d6671d436731 Mon Sep 17 00:00:00 2001 From: CuckyDev Date: Mon, 2 Aug 2021 23:25:04 -0400 Subject: [PATCH] Fix sustain clipping banger --- source/PlayState.hx | 25 +++++++++++++++++------ source/SusClip.hx | 48 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 source/SusClip.hx diff --git a/source/PlayState.hx b/source/PlayState.hx index e14b145..d079905 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2968,7 +2968,7 @@ class PlayState extends MusicBeatState // If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime if (!PlayStateChangeables.botPlay) { - if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit || holdArray[Math.floor(Math.abs(daNote.noteData))] && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) { // Clip to strumline @@ -3009,7 +3009,7 @@ class PlayState extends MusicBeatState if (!PlayStateChangeables.botPlay) { - if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit || holdArray[Math.floor(Math.abs(daNote.noteData))] && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) { // Clip to strumline @@ -3121,7 +3121,13 @@ class PlayState extends MusicBeatState // WIP interpolation shit? Need to fix the pause issue // daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); - if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate + if (daNote.isSustainNote && daNote.wasGoodHit && Conductor.songPosition >= daNote.strumTime) + { + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); + } + else if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate && PlayStateChangeables.useDownscroll) && daNote.mustPress) { @@ -4285,9 +4291,16 @@ class PlayState extends MusicBeatState } }); - note.kill(); - notes.remove(note, true); - note.destroy(); + if (!note.isSustainNote) + { + note.kill(); + notes.remove(note, true); + note.destroy(); + } + else + { + note.wasGoodHit = true; + } updateAccuracy(); } diff --git a/source/SusClip.hx b/source/SusClip.hx new file mode 100644 index 0000000..3523934 --- /dev/null +++ b/source/SusClip.hx @@ -0,0 +1,48 @@ +package; + +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.graphics.frames.FlxAtlasFrames; +import flixel.math.FlxMath; +import flixel.util.FlxColor; + +import Note; + +class SusClip extends FlxSprite +{ + public var strumTime:Float = 0; + public var noteData:Int = 0; + public var mustPress:Bool = false; + public var noteYOff:Int = 0; + + public function new(note:Note) + { + super(); + + //Copy note data + strumTime = note.strumTime; + noteData = note.noteData; + mustPress = note.mustPress; + noteYOff = note.noteYOff; + + x = note.x; + y = note.y; + alpha = note.alpha; + loadGraphicFromSprite(note); + + angle = note.angle; + flipY = note.flipY; + clipRect = note.clipRect; + scale.copyFrom(note.scale); + scrollFactor.copyFrom(note.scrollFactor); + updateHitbox(); + } + + /* + override function update(elapsed:Float) + { + super.update(elapsed); + angle = modAngle + localAngle; + } + */ +} \ No newline at end of file