From 18823ab677b69ad89ef88cfa3d690740a94e46a1 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 21 Feb 2023 00:55:50 +0100 Subject: [PATCH] time to recode entire note logic --- buildnumber.txt | 2 +- source/funkin/game/Note.hx | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 37b9a3fb..feea2736 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2319 \ No newline at end of file +2322 \ No newline at end of file diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index f6d502f5..2c64282e 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -97,20 +97,21 @@ class Note extends FlxSprite public var animSuffix:String = ""; - public function new(strumLine:StrumLine, noteData:ChartNote, isSustainNote:Bool) + public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0) { super(); // TODO: Sustain note this.prevNote = strumLine.notes.members.last(); this.noteTypeID = noteData.type.getDefault(0); - this.isSustainNote = false; + this.isSustainNote = sustain; + this.sustainLength = sustainLength; this.strumLine = strumLine; x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? y -= 2000; - this.strumTime = noteData.time.getDefault(0); + this.strumTime = noteData.time.getDefault(0) + sustainOffset; this.noteData = noteData.id.getDefault(0); @@ -172,6 +173,16 @@ class Note extends FlxSprite if (PlayState.instance != null) PlayState.instance.scripts.event("onPostNoteCreation", event); + + if (!isSustainNote && noteData.sustainLength > Conductor.stepCrochet * 0.75) { + var len:Float = noteData.sustainLength; + var curLen:Float = 0; + while(len > 10) { + curLen = Math.min(len, Conductor.stepCrochet); + len -= curLen; + strumLine.notes.add(new Note(strumLine, noteData, true, curLen, noteData.sustainLength - len)); + } + } } public var lastScrollSpeed:Null = null;