1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-29 15:56:06 +00:00

use suffixes instead of pixel boolean

This commit is contained in:
lemz 2024-06-24 21:45:58 +02:00 committed by EliteMasterEric
parent 492af8add4
commit f9bccb057a
3 changed files with 22 additions and 22 deletions

View file

@ -709,7 +709,7 @@ class Strumline extends FlxSpriteGroup
if (noteSprite != null) if (noteSprite != null)
{ {
var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.isHoldNotePixel()) ?? this.noteStyle; var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.id) ?? this.noteStyle;
noteSprite.setupNoteGraphic(noteKindStyle); noteSprite.setupNoteGraphic(noteKindStyle);
noteSprite.direction = note.getDirection(); noteSprite.direction = note.getDirection();
@ -731,7 +731,7 @@ class Strumline extends FlxSpriteGroup
if (holdNoteSprite != null) if (holdNoteSprite != null)
{ {
var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.isHoldNotePixel()) ?? this.noteStyle; var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.id) ?? this.noteStyle;
holdNoteSprite.setupHoldNoteGraphic(noteKindStyle); holdNoteSprite.setupHoldNoteGraphic(noteKindStyle);
holdNoteSprite.parentStrumline = this; holdNoteSprite.parentStrumline = this;

View file

@ -66,12 +66,12 @@ class NoteKindManager
/** /**
* Retrieve the note style from the given note kind * Retrieve the note style from the given note kind
* @param noteKind note kind name * @param noteKind note kind name
* @param isPixel whether to use pixel style * @param suffix Used for song note styles
* @return NoteStyle * @return NoteStyle
*/ */
public static function getNoteStyle(noteKind:String, isPixel:Bool = false):Null<NoteStyle> public static function getNoteStyle(noteKind:String, ?suffix:String):Null<NoteStyle>
{ {
var noteStyleId:Null<String> = getNoteStyleId(noteKind, isPixel); var noteStyleId:Null<String> = getNoteStyleId(noteKind, suffix);
if (noteStyleId == null) if (noteStyleId == null)
{ {
@ -83,16 +83,21 @@ class NoteKindManager
/** /**
* Retrieve the note style id from the given note kind * Retrieve the note style id from the given note kind
* @param noteKind note kind name * @param noteKind Note kind name
* @param isPixel whether to use pixel style * @param suffix Used for song note styles
* @return Null<String> * @return Null<String>
*/ */
public static function getNoteStyleId(noteKind:String, isPixel:Bool = false):Null<String> public static function getNoteStyleId(noteKind:String, ?suffix:String):Null<String>
{ {
var noteStyleId:Null<String> = noteKinds.get(noteKind)?.noteStyleId; if (suffix == null)
if (isPixel && noteStyleId != null)
{ {
noteStyleId = NoteStyleRegistry.instance.hasEntry('$noteStyleId-pixel') ? '$noteStyleId-pixel' : noteStyleId; suffix = '';
}
var noteStyleId:Null<String> = noteKinds.get(noteKind)?.noteStyleId;
if (noteStyleId != null)
{
noteStyleId = NoteStyleRegistry.instance.hasEntry('$noteStyleId-$suffix') ? '$noteStyleId-$suffix' : noteStyleId;
} }
return noteStyleId; return noteStyleId;

View file

@ -3591,7 +3591,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
// The note sprite handles animation playback and positioning. // The note sprite handles animation playback and positioning.
noteSprite.noteData = noteData; noteSprite.noteData = noteData;
noteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle; noteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
noteSprite.overrideStepTime = null; noteSprite.overrideStepTime = null;
noteSprite.overrideData = null; noteSprite.overrideData = null;
@ -3615,7 +3615,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
holdNoteSprite.setHeightDirectly(noteLengthPixels); holdNoteSprite.setHeightDirectly(noteLengthPixels);
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind, isPixelStyle()) ?? currentSongNoteStyle; holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes); holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
@ -3681,7 +3681,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
holdNoteSprite.noteDirection = noteData.getDirection(); holdNoteSprite.noteDirection = noteData.getDirection();
holdNoteSprite.setHeightDirectly(noteLengthPixels); holdNoteSprite.setHeightDirectly(noteLengthPixels);
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle; holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes); holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
@ -4580,7 +4580,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
gridGhostHoldNote.noteData = currentPlaceNoteData; gridGhostHoldNote.noteData = currentPlaceNoteData;
gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection(); gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection();
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true); gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true);
gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind, isPixelStyle()) ?? currentSongNoteStyle; gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes); gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
} }
else else
@ -4905,7 +4905,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
noteData.kind = noteKindToPlace; noteData.kind = noteKindToPlace;
noteData.params = noteParamsToPlace; noteData.params = noteParamsToPlace;
noteData.data = cursorColumn; noteData.data = cursorColumn;
gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle; gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
gridGhostNote.playNoteAnimation(); gridGhostNote.playNoteAnimation();
} }
noteData.time = cursorSnappedMs; noteData.time = cursorSnappedMs;
@ -5297,7 +5297,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
ghostHold.visible = true; ghostHold.visible = true;
ghostHold.alpha = 0.6; ghostHold.alpha = 0.6;
ghostHold.setHeightDirectly(0); ghostHold.setHeightDirectly(0);
ghostHold.noteStyle = NoteKindManager.getNoteStyleId(ghostHold.noteData.kind, isPixelStyle()) ?? currentSongNoteStyle; ghostHold.noteStyle = NoteKindManager.getNoteStyleId(ghostHold.noteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
ghostHold.updateHoldNotePosition(renderedHoldNotes); ghostHold.updateHoldNotePosition(renderedHoldNotes);
} }
@ -6423,11 +6423,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return note != null && currentNoteSelection.indexOf(note) != -1; return note != null && currentNoteSelection.indexOf(note) != -1;
} }
function isPixelStyle():Bool
{
return currentSongNoteStyle == 'pixel';
}
override function destroy():Void override function destroy():Void
{ {
super.destroy(); super.destroy();