diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index 97ff49ffc..1d6187b69 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -136,6 +136,8 @@ class Flags { public static var DEFAULT_MODCHART_HOLD_SUBDIVISIONS:Int = 4; #end + public static var SUSTAINS_AS_ONE_NOTE:Bool = true; + @:also(funkin.game.Character.FALLBACK_DEAD_CHARACTER) public static var DEFAULT_GAMEOVER_CHARACTER:String = "bf-dead"; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index cac4e5c8f..f38384628 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1837,7 +1837,14 @@ class PlayState extends MusicBeatState var directionID:Null = note == null ? direction : note.strumID; if (playerID == null || directionID == null || playerID == -1) return; - var event:NoteMissEvent = gameAndCharsEvent("onPlayerMiss", EventManager.get(NoteMissEvent).recycle(note, -10, 1, muteVocalsOnMiss, note != null ? -0.0475 : -0.04, Paths.sound(FlxG.random.getObject(Flags.DEFAULT_MISS_SOUNDS)), FlxG.random.float(0.1, 0.2), note == null, combo > 5, "sad", true, true, "miss", strumLines.members[playerID].characters, playerID, note != null ? note.noteType : null, directionID, 0)); + if (Flags.SUSTAINS_AS_ONE_NOTE) { + if (note != null ? (note.isSustainNote && note.prevNote != null && note.prevNote.isSustainNote && !note.prevNote.wasGoodHit) : false) { + strumLine.deleteNote(note); + return; + } + } + + var event:NoteMissEvent = gameAndCharsEvent("onPlayerMiss", EventManager.get(NoteMissEvent).recycle(note, -10, 1, muteVocalsOnMiss, note != null ? ((note.isSustainNote && Flags.SUSTAINS_AS_ONE_NOTE) ? -0.1425 : -0.0475) : -0.04, Paths.sound(FlxG.random.getObject(Flags.DEFAULT_MISS_SOUNDS)), FlxG.random.float(0.1, 0.2), note == null, combo > 5, "sad", true, true, "miss", strumLines.members[playerID].characters, playerID, note != null ? note.noteType : null, directionID, 0)); strumLine.onMiss.dispatch(event); if (event.cancelled) { gameAndCharsEvent("onPostPlayerMiss", event); diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index c998666e8..8945c7d58 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -258,14 +258,19 @@ class StrumLine extends FlxTypedGroup { } } - var __funcsToExec:ArrayVoid> = []; var __pressed:Array = []; var __justPressed:Array = []; var __justReleased:Array = []; var __notePerStrum:Array = []; function __inputProcessPressed(note:Note) { - if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent != null && note.sustainParent.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { + if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { + note.tripTimer = 1; + PlayState.instance.goodNoteHit(this, note); + } + } + function __inputProcessPressedOne(note:Note) { + if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent != null && note.prevNote != null && note.prevNote.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { note.tripTimer = 1; PlayState.instance.goodNoteHit(this, note); } @@ -297,12 +302,11 @@ class StrumLine extends FlxTypedGroup { if (cpu) return; - __funcsToExec.clear(); __pressed.resize(members.length); __justPressed.resize(members.length); __justReleased.resize(members.length); - for(i in 0...members.length) { + for (i in 0...members.length) { __pressed[i] = members[i].__getPressed(this); __justPressed[i] = members[i].__getJustPressed(this); __justReleased[i] = members[i].__getJustReleased(this); @@ -316,34 +320,34 @@ class StrumLine extends FlxTypedGroup { __justPressed = CoolUtil.getDefault(event.justPressed, []); __justReleased = CoolUtil.getDefault(event.justReleased, []); - __notePerStrum = cast new haxe.ds.Vector(members.length);//[for(_ in 0...members.length) null]; + __notePerStrum = cast new haxe.ds.Vector(members.length); // [for(_ in 0...members.length) null]; + + if (__justPressed.contains(true)) { + notes.forEachAlive(__inputProcessJustPressed); + if (!ghostTapping) for (k => pr in __justPressed) if (pr && __notePerStrum[k] == null) + PlayState.instance.noteMiss(this, null, k, ID); // FUCK YOU + } if (__pressed.contains(true)) { - for(c in characters) + for (e in __notePerStrum) + if (e != null) + PlayState.instance.goodNoteHit(this, e); + + for (c in characters) if (c.lastAnimContext != DANCE) c.__lockAnimThisFrame = true; - __funcsToExec.push(__inputProcessPressed); - } - if (__justPressed.contains(true)) - __funcsToExec.push(__inputProcessJustPressed); - - if (__funcsToExec.length > 0) { - notes.forEachAlive(function(note:Note) { - for(e in __funcsToExec) if (e != null) e(note); - }); + if (Flags.SUSTAINS_AS_ONE_NOTE) + notes.forEachAlive(__inputProcessPressedOne); + else + notes.forEachAlive(__inputProcessPressed); } - if (!ghostTapping) for(k=>pr in __justPressed) if (pr && __notePerStrum[k] == null) { - // FUCK YOU - PlayState.instance.noteMiss(this, null, k, ID); - } - for(e in __notePerStrum) if (e != null) PlayState.instance.goodNoteHit(this, e); - forEach(function(str:Strum) { str.updatePlayerInput(str.__getPressed(this), str.__getJustPressed(this), str.__getJustReleased(this)); }); + PlayState.instance.gameAndCharsCall("onPostInputUpdate"); }