Fix Inconsistency in Sustain Input (#663)
Make player sustains the same as cpu sustains
This commit is contained in:
+13
-19
@@ -278,30 +278,22 @@ class Note extends FlxSprite
|
||||
public function updateSustain(strum:Strum) {
|
||||
var scrollSpeed = strum.getScrollSpeed(this);
|
||||
|
||||
var len = 0.45 * CoolUtil.quantize(scrollSpeed, 100);
|
||||
|
||||
if (nextSustain != null && lastScrollSpeed != scrollSpeed) {
|
||||
// is long sustain
|
||||
if (lastScrollSpeed != scrollSpeed) {
|
||||
lastScrollSpeed = scrollSpeed;
|
||||
|
||||
scale.y = (sustainLength * len) / frameHeight;
|
||||
updateHitbox();
|
||||
scale.y += gapFix / frameHeight;
|
||||
if (nextSustain != null) {
|
||||
scale.y = (sustainLength * 0.45 * scrollSpeed) / frameHeight;
|
||||
updateHitbox();
|
||||
scale.y += gapFix / frameHeight;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasGoodHit) return;
|
||||
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;
|
||||
swagRect.width = frameWidth;
|
||||
swagRect.height = frameHeight;
|
||||
|
||||
setClipRect(swagRect);
|
||||
updateSustainClip();
|
||||
}
|
||||
|
||||
public inline function setClipRect(rect:FlxRect) {
|
||||
this.clipRect = rect;
|
||||
public function updateSustainClip() if (wasGoodHit) {
|
||||
var t = FlxMath.bound((Conductor.songPosition - strumTime) / height * 0.45 * lastScrollSpeed, 0, 1);
|
||||
var rect = clipRect == null ? FlxRect.get() : clipRect;
|
||||
clipRect = rect.set(0, frameHeight * t, frameWidth, frameHeight * (1 - t));
|
||||
}
|
||||
|
||||
@:noCompletion
|
||||
@@ -317,5 +309,7 @@ class Note extends FlxSprite
|
||||
|
||||
public override function destroy() {
|
||||
super.destroy();
|
||||
|
||||
clipRect = FlxDestroyUtil.put(clipRect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
|
||||
if (cpu && __updateNote_event.__autoCPUHit && !daNote.avoid && !daNote.wasGoodHit && daNote.strumTime < __updateNote_songPos) PlayState.instance.goodNoteHit(this, daNote);
|
||||
|
||||
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (daNote.sustainLength) < __updateNote_songPos) {
|
||||
if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + daNote.sustainLength < __updateNote_songPos) {
|
||||
deleteNote(daNote);
|
||||
return;
|
||||
}
|
||||
@@ -215,8 +215,9 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
var __notePerStrum:Array<Note> = [];
|
||||
|
||||
function __inputProcessPressed(note:Note) {
|
||||
if (__pressed[note.strumID] && note.isSustainNote && note.canBeHit && !note.wasGoodHit) {
|
||||
if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit) {
|
||||
PlayState.instance.goodNoteHit(this, note);
|
||||
note.updateSustainClip();
|
||||
}
|
||||
}
|
||||
function __inputProcessJustPressed(note:Note) {
|
||||
|
||||
Reference in New Issue
Block a user