Skip to content

Commit

Permalink
Merge branch 'FNF-CNE-Devs:main' into cne-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 authored Nov 8, 2024
2 parents 0476882 + f54c485 commit eafd09f
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 13 deletions.
7 changes: 7 additions & 0 deletions source/funkin/backend/scripting/events/NoteHitEvent.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
13 changes: 10 additions & 3 deletions source/funkin/backend/system/framerate/FlixelInfo.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package funkin.backend.system.framerate;

import funkin.backend.scripting.ModState;

class FlixelInfo extends FramerateCategory {
public function new() {
super("Flixel Info");
Expand All @@ -14,17 +16,22 @@ 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}';
_text += '\nSounds Count: ${FlxG.sound.list.length}';
_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
}

Expand Down
2 changes: 1 addition & 1 deletion source/funkin/backend/system/updating/AsyncUpdater.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/editors/charter/Charter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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(_) {
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/editors/charter/CharterBackdropGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class CharterBackdropDummy extends UISprite {

public override function draw() {
@:privateAccess
__lastDrawCameras = [for(c in cameras) c];
__lastDrawCameras = cameras.copy();
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/funkin/editors/ui/UISprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 5 additions & 2 deletions source/funkin/game/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class Note extends FlxSprite
return __customNoteTypeExists[path];
return __customNoteTypeExists[path] = Assets.exists(path);
}

static var DEFAULT_FIELDS:Array<String> = ["time", "id", "type", "sLen"];

public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?prev:Note)
{
super();
Expand All @@ -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));
}
}
Expand Down Expand Up @@ -290,7 +293,7 @@ class Note extends FlxSprite
setClipRect(swagRect);
}

public function setClipRect(rect:FlxRect) {
public inline function setClipRect(rect:FlxRect) {
this.clipRect = rect;
}

Expand Down
8 changes: 5 additions & 3 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/game/Strum.hx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Strum extends FlxSprite {
}

public override function draw() {
lastDrawCameras = [for(c in cameras) c];
lastDrawCameras = cameras.copy();
super.draw();
}

Expand Down

0 comments on commit eafd09f

Please sign in to comment.