Skip to content

Commit e585de7

Browse files
committed
Fix Sustain Miss As One Note
1 parent 219e951 commit e585de7

File tree

3 files changed

+19
-34
lines changed

3 files changed

+19
-34
lines changed

source/funkin/game/Note.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ class Note extends FlxSprite
113113

114114
public var animSuffix:String = null;
115115

116-
public var tripTimer:Float = 0; // ranges from 0 to 1
117-
116+
// Deprecated?
117+
@:dox(hide) public var tripTimer:Float = 0; // ranges from 0 to 1
118118

119119
private static function customTypePathExists(path:String) {
120120
if (__customNoteTypeExists.exists(path))

source/funkin/game/PlayState.hx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,18 +1833,25 @@ class PlayState extends MusicBeatState
18331833
*/
18341834
public function noteMiss(strumLine:StrumLine, note:Note, ?direction:Int, ?player:Int):Void
18351835
{
1836-
var playerID:Null<Int> = note == null ? player : strumLines.members.indexOf(strumLine);
1837-
var directionID:Null<Int> = note == null ? direction : note.strumID;
1836+
var hasNote:Bool = note != null;
1837+
var playerID:Null<Int> = hasNote ? strumLines.members.indexOf(strumLine) : player;
1838+
var directionID:Null<Int> = hasNote ? note.strumID : direction;
18381839
if (playerID == null || directionID == null || playerID == -1) return;
18391840

1840-
if (Flags.SUSTAINS_AS_ONE_NOTE) {
1841-
if (note != null ? (note.isSustainNote && note.prevNote != null && note.prevNote.isSustainNote && !note.prevNote.wasGoodHit) : false) {
1841+
if (hasNote) {
1842+
if (Flags.SUSTAINS_AS_ONE_NOTE && note.isSustainNote) {
18421843
strumLine.deleteNote(note);
1843-
return;
1844+
if (note.sustainParent.wasGoodHit) {
1845+
note.sustainParent.wasGoodHit = false;
1846+
note.sustainParent.tooLate = true;
1847+
note = note.sustainParent;
1848+
}
1849+
else
1850+
return;
18441851
}
18451852
}
18461853

1847-
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));
1854+
var event:NoteMissEvent = gameAndCharsEvent("onPlayerMiss", EventManager.get(NoteMissEvent).recycle(note, -10, 1, muteVocalsOnMiss, hasNote ? ((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), !hasNote, combo > 5, "sad", true, true, "miss", strumLines.members[playerID].characters, playerID, hasNote ? note.noteType : null, directionID, 0));
18481855
strumLine.onMiss.dispatch(event);
18491856
if (event.cancelled) {
18501857
gameAndCharsEvent("onPostPlayerMiss", event);
@@ -1883,7 +1890,7 @@ class PlayState extends MusicBeatState
18831890
}
18841891
}
18851892

1886-
if (event.deleteNote && strumLine != null && note != null)
1893+
if (event.deleteNote && strumLine != null && hasNote)
18871894
strumLine.deleteNote(note);
18881895

18891896
gameAndCharsEvent("onPostPlayerMiss", event);

source/funkin/game/StrumLine.hx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,8 @@ class StrumLine extends FlxTypedGroup<Strum> {
241241
if (__updateNote_event.strum == null) return;
242242
if (__updateNote_event.__reposNote) __updateNote_event.strum.updateNotePosition(daNote);
243243

244-
245-
if (daNote.isSustainNote)
246-
{
244+
if (daNote.isSustainNote) {
247245
daNote.updateSustain(__updateNote_event.strum);
248-
249-
if (daNote.tripTimer > 0 && daNote.tailCount > 3)
250-
{
251-
daNote.tripTimer -= 0.05 / daNote.sustainLength;
252-
if (daNote.tripTimer <= 0)
253-
{
254-
daNote.tripTimer = 0;
255-
daNote.canBeHit = false;
256-
}
257-
}
258246
}
259247
}
260248

@@ -264,14 +252,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
264252
var __notePerStrum:Array<Note> = [];
265253

266254
function __inputProcessPressed(note:Note) {
267-
if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit) {
268-
note.tripTimer = 1;
269-
PlayState.instance.goodNoteHit(this, note);
270-
}
271-
}
272-
function __inputProcessPressedOne(note:Note) {
273-
if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent != null && note.prevNote != null && note.prevNote.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) {
274-
note.tripTimer = 1;
255+
if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) {
275256
PlayState.instance.goodNoteHit(this, note);
276257
}
277258
}
@@ -338,10 +319,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
338319
if (c.lastAnimContext != DANCE)
339320
c.__lockAnimThisFrame = true;
340321

341-
if (Flags.SUSTAINS_AS_ONE_NOTE)
342-
notes.forEachAlive(__inputProcessPressedOne);
343-
else
344-
notes.forEachAlive(__inputProcessPressed);
322+
notes.forEachAlive(__inputProcessPressed);
345323
}
346324

347325
forEach(function(str:Strum) {

0 commit comments

Comments
 (0)