1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

Fix an issue where display would break on invalid note styles.

This commit is contained in:
EliteMasterEric 2024-07-12 16:39:42 -04:00
parent f76309c91e
commit ace762413e
4 changed files with 16 additions and 5 deletions

2
assets

@ -1 +1 @@
Subproject commit 005c96f85f4304865acb196e7cc4d6d83f9d76d8
Subproject commit 4af95a506fc62cd683422dfb9c599877b26c27db

View file

@ -1408,7 +1408,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
function get_currentSongNoteStyle():String
{
if (currentSongMetadata.playData.noteStyle == null)
if (currentSongMetadata.playData.noteStyle == null
|| currentSongMetadata.playData.noteStyle == ''
|| currentSongMetadata.playData.noteStyle == 'item')
{
// Initialize to the default value if not set.
currentSongMetadata.playData.noteStyle = Constants.DEFAULT_NOTE_STYLE;

View file

@ -53,7 +53,8 @@ class ChartEditorHoldNoteSprite extends SustainTrail
@:nullSafety(Off)
function updateHoldNoteGraphic():Void
{
var bruhStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle);
var bruhStyle:Null<NoteStyle> = NoteStyleRegistry.instance.fetchEntry(noteStyle);
if (bruhStyle == null) bruhStyle = NoteStyleRegistry.instance.fetchDefault();
setupHoldNoteGraphic(bruhStyle);
}

View file

@ -97,7 +97,9 @@ class ChartEditorNoteSprite extends FlxSprite
function fetchNoteStyle(noteStyleId:String):NoteStyle
{
return NoteStyleRegistry.instance.fetchEntry(noteStyleId) ?? NoteStyleRegistry.instance.fetchDefault();
var result = NoteStyleRegistry.instance.fetchEntry(noteStyleId);
if (result != null) return result;
return NoteStyleRegistry.instance.fetchDefault();
}
@:access(funkin.play.notes.notestyle.NoteStyle)
@ -198,7 +200,12 @@ class ChartEditorNoteSprite extends FlxSprite
function get_noteStyle():Null<String>
{
return this.noteStyle ?? this.parentState.currentSongNoteStyle;
if (this.noteStyle == null)
{
var result = this.parentState.currentSongNoteStyle;
return result;
}
return this.noteStyle;
}
function set_noteStyle(value:Null<String>):Null<String>
@ -218,6 +225,7 @@ class ChartEditorNoteSprite extends FlxSprite
// Play the appropriate animation for the type, direction, and skin.
var dirName:String = overrideData != null ? SongNoteData.buildDirectionName(overrideData) : this.noteData.getDirectionName();
var noteStyleSuffix:String = this.noteStyle?.toTitleCase() ?? Constants.DEFAULT_NOTE_STYLE.toTitleCase();
var animationName:String = '${baseAnimationName}${dirName}${this.noteStyle.toTitleCase()}';
this.animation.play(animationName);