From 1cc7214e011a974dba52f7677015f9da67d55421 Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Fri, 21 Jul 2023 18:21:24 +0200 Subject: [PATCH] Fix holds --- source/funkin/game/Note.hx | 7 +++++-- source/funkin/game/StrumLine.hx | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 3c7e8c4b..38afb5c6 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -101,13 +101,16 @@ class Note extends FlxSprite return __customNoteTypeExists[path]; return __customNoteTypeExists[path] = Assets.exists(path); } - public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0) + public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?prev:Note) { super(); moves = false; - this.prevNote = strumLine.notes.members.last(); + if(prev != null) + this.prevNote = prev; + else + this.prevNote = strumLine.notes.members.last(); this.noteTypeID = noteData.type.getDefault(0); this.isSustainNote = sustain; this.sustainLength = sustainLength; diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 98c10c1a..af5f30cc 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -116,22 +116,23 @@ class StrumLine extends FlxTypedGroup { } notes.preallocate(total); - notes.length = total; var il = 0; + var prev:Note = null; + if (strumLine.notes != null) for(note in strumLine.notes) { if (startTime != null && startTime > note.time) continue; - notes.members[total-(il++)-1] = new Note(this, note, false); + notes.members[total-(il++)-1] = prev = new Note(this, note, false, prev); if (note.sLen > Conductor.stepCrochet * 0.75) { var len:Float = note.sLen; var curLen:Float = 0; while(len > 10) { curLen = Math.min(len, Conductor.stepCrochet); - notes.members[total-(il++)-1] = new Note(this, note, true, curLen, note.sLen - len); + notes.members[total-(il++)-1] = prev = new Note(this, note, true, curLen, note.sLen - len, prev); len -= curLen; } }