diff --git a/source/funkin/backend/scripting/events/NoteHitEvent.hx b/source/funkin/backend/scripting/events/NoteHitEvent.hx index 7a20fed01..256c4c9f3 100644 --- a/source/funkin/backend/scripting/events/NoteHitEvent.hx +++ b/source/funkin/backend/scripting/events/NoteHitEvent.hx @@ -123,6 +123,13 @@ final class NoteHitEvent extends CancellableEvent { @:dox(hide) public function cancelDeletion() {preventDeletion();} + /** + * Forces the note to be deleted. + **/ + public function forceDeletion() { + deleteNote = true; + } + /** * Prevents the vocals volume from being set to 1 after pressing the note. */ diff --git a/source/funkin/backend/system/framerate/FlixelInfo.hx b/source/funkin/backend/system/framerate/FlixelInfo.hx index 259b7f8f2..297fcde79 100644 --- a/source/funkin/backend/system/framerate/FlixelInfo.hx +++ b/source/funkin/backend/system/framerate/FlixelInfo.hx @@ -1,5 +1,7 @@ package funkin.backend.system.framerate; +import funkin.backend.scripting.ModState; + class FlixelInfo extends FramerateCategory { public function new() { super("Flixel Info"); @@ -14,7 +16,12 @@ class FlixelInfo extends FramerateCategory { for(_ in FlxG.bitmap._cache.keys()) c++; - _text = 'State: ${Type.getClassName(Type.getClass(FlxG.state))}'; + if((FlxG.state is ModState)) { + var state:ModState = cast FlxG.state; + _text = "Mod State: " + state.scriptName; + } else { + _text = 'State: ${Type.getClassName(Type.getClass(FlxG.state))}'; + } _text += '\nObject Count: ${FlxG.state.members.length}'; _text += '\nCamera Count: ${FlxG.cameras.list.length}'; _text += '\nBitmaps Count: ${c}'; @@ -22,9 +29,9 @@ class FlixelInfo extends FramerateCategory { _text += '\nFlxG.game Childs Count: ${FlxG.game.numChildren}'; // _text += '\nCached objects count: ${cachedObjects}'; #if FLX_POINT_POOL - var points = flixel.math.FlxPoint.FlxBasePoint.pool; + //var points = flixel.math.FlxPoint.FlxBasePoint.pool; //_text += '\nPoint Count: ${points._count} | +${points.made} | -${points.gotten} | ${points.balance} | >${points.putted}'; - _text += '\nPoint Count: ${points._count}'; + //_text += '\nPoint Count: ${points._count}'; #end } diff --git a/source/funkin/backend/system/updating/AsyncUpdater.hx b/source/funkin/backend/system/updating/AsyncUpdater.hx index 52821a73c..843c55c21 100644 --- a/source/funkin/backend/system/updating/AsyncUpdater.hx +++ b/source/funkin/backend/system/updating/AsyncUpdater.hx @@ -101,7 +101,7 @@ class AsyncUpdater { progress.files = files.length; progress.step = DOWNLOADING_ASSETS; trace('starting assets download'); - doFile([for(e in files) e], [for(e in fileNames) e], function() { + doFile(files.copy(), fileNames.copy(), function() { progress.curFile = -1; progress.curFileName = null; progress.files = 1; diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 2ff39aa01..99f6f6909 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1657,7 +1657,7 @@ class Charter extends UIState { changeNoteSustain(-1); function _note_selectall(_) { - selection = [for (note in notesGroup.members) note]; + selection = cast notesGroup.members.copy(); } function _note_selectmeasure(_) { diff --git a/source/funkin/editors/charter/CharterBackdropGroup.hx b/source/funkin/editors/charter/CharterBackdropGroup.hx index e9240ad1a..21eeb90fb 100644 --- a/source/funkin/editors/charter/CharterBackdropGroup.hx +++ b/source/funkin/editors/charter/CharterBackdropGroup.hx @@ -253,7 +253,7 @@ class CharterBackdropDummy extends UISprite { public override function draw() { @:privateAccess - __lastDrawCameras = [for(c in cameras) c]; + __lastDrawCameras = cameras.copy(); } } diff --git a/source/funkin/editors/ui/UISprite.hx b/source/funkin/editors/ui/UISprite.hx index 5a41cec32..1246e6dee 100644 --- a/source/funkin/editors/ui/UISprite.hx +++ b/source/funkin/editors/ui/UISprite.hx @@ -69,7 +69,7 @@ class UISprite extends FlxSprite { public function drawSuper() { super.draw(); - __lastDrawCameras = [for(c in cameras) c]; + __lastDrawCameras = cameras.copy(); } public function drawMembers() { diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index b8baf48ec..9b06fc819 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -98,6 +98,9 @@ class Note extends FlxSprite return __customNoteTypeExists[path]; return __customNoteTypeExists[path] = Assets.exists(path); } + + static var DEFAULT_FIELDS:Array = ["time", "id", "type", "sLen"]; + public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?prev:Note) { super(); @@ -115,7 +118,7 @@ class Note extends FlxSprite this.sustainLength = sustainLength; this.strumLine = strumLine; for(field in Reflect.fields(noteData)) { - if(!["time", "id", "type", "sLen"].contains(field)) { + if(!DEFAULT_FIELDS.contains(field)) { this.extra.set(field, Reflect.field(noteData, field)); } } @@ -290,7 +293,7 @@ class Note extends FlxSprite setClipRect(swagRect); } - public function setClipRect(rect:FlxRect) { + public inline function setClipRect(rect:FlxRect) { this.clipRect = rect; } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 581c19ff7..82a925060 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1664,9 +1664,11 @@ class PlayState extends MusicBeatState var event:NoteHitEvent; if (strumLine != null && !strumLine.cpu) - event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick")); + event = EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"); else - event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false)); + event = EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false); + event.deleteNote = !note.isSustainNote; // work around, to allow sustain notes to be deleted + event = scripts.event(strumLine != null && !strumLine.cpu ? "onPlayerHit" : "onDadHit", event); strumLine.onHit.dispatch(event); scripts.event("onNoteHit", event); @@ -1713,7 +1715,7 @@ class PlayState extends MusicBeatState } } - if (event.deleteNote && !note.isSustainNote) strumLine.deleteNote(note); + if (event.deleteNote) strumLine.deleteNote(note); } public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void { diff --git a/source/funkin/game/Strum.hx b/source/funkin/game/Strum.hx index e2b6ccd0b..cbce2da40 100644 --- a/source/funkin/game/Strum.hx +++ b/source/funkin/game/Strum.hx @@ -74,7 +74,7 @@ class Strum extends FlxSprite { } public override function draw() { - lastDrawCameras = [for(c in cameras) c]; + lastDrawCameras = cameras.copy(); super.draw(); }