From a10e8c010116b2749879dbb6960f6886e54e9eed Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Mon, 16 Jan 2023 13:49:02 +0100 Subject: [PATCH] gotta fix memory leak --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 4e0f4a6a..fb2e329c 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2058 \ No newline at end of file +2060 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 704ba8e2..ea8e6bc2 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1436,12 +1436,11 @@ class PlayState extends MusicBeatState } var notePerStrum = [for(i in 0...4) null]; - var additionalNotes:Array = []; if (__justPressed.contains(true)) { __funcsToExec.push(function(note:Note) { if (__justPressed[note.strumID] && !note.isSustainNote && note.mustPress && !note.wasGoodHit && note.canBeHit) { if (notePerStrum[note.strumID] == null) notePerStrum[note.strumID] = note; - else if (Math.abs(notePerStrum[note.strumID].strumTime - note.strumTime) <= 10) additionalNotes.push(note); + else if (Math.abs(notePerStrum[note.strumID].strumTime - note.strumTime) <= 5) deleteNote(note); else if (note.strumTime < notePerStrum[note.strumID].strumTime) notePerStrum[note.strumID] = note; } }); @@ -1454,7 +1453,6 @@ class PlayState extends MusicBeatState } for(e in notePerStrum) if (e != null) goodNoteHit(e); - for(e in additionalNotes) goodNoteHit(e); playerStrums.forEach(function(str:Strum) { str.updatePlayerInput(__pressed[str.ID], __justPressed[str.ID], __justReleased[str.ID]); @@ -1539,8 +1537,7 @@ class PlayState extends MusicBeatState var event:NoteHitEvent; if (note.mustPress) - // event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(note, [boyfriend], true, note.noteType, note.strumID, note.noteData > 0 ? 0.023 : 0.004, score, note.animSuffix, daRating, note.isSustainNote ? null : accuracy, "game/score/", '')); - event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, [boyfriend], true, note.noteType, "", "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, note.noteData > 0 ? 0.023 : 0.004, daRating, daRating == "sick")); + event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, [boyfriend], true, note.noteType, "", "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, note.noteData > 0 ? 0.023 : 0.004, daRating, !note.isSustainNote && daRating == "sick")); else event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, [dad], false, note.noteType, "", "game/score/", "", note.strumID, 0, null, 0, daRating, false));