1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-25 21:55:55 +00:00

check for pixel style if necessary

This commit is contained in:
lemz 2024-06-11 23:45:08 +02:00 committed by EliteMasterEric
parent c4855c0ca8
commit 928de7b8eb
4 changed files with 32 additions and 14 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; var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.isHoldNotePixel()) ?? 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; var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.isHoldNotePixel()) ?? this.noteStyle;
holdNoteSprite.setupHoldNoteGraphic(noteKindStyle); holdNoteSprite.setupHoldNoteGraphic(noteKindStyle);
holdNoteSprite.parentStrumline = this; holdNoteSprite.parentStrumline = this;

View file

@ -21,9 +21,9 @@ class NoteKind implements INoteScriptedClass
/** /**
* Custom note style * Custom note style
*/ */
public var noteStyleId:String; public var noteStyleId:Null<String>;
public function new(noteKind:String, description:String = "", noteStyleId:String = "") public function new(noteKind:String, description:String = "", ?noteStyleId:String)
{ {
this.noteKind = noteKind; this.noteKind = noteKind;
this.description = description; this.description = description;

View file

@ -65,11 +65,17 @@ 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
* @return NoteStyle * @return NoteStyle
*/ */
public static function getNoteStyle(noteKind:String):Null<NoteStyle> public static function getNoteStyle(noteKind:String, isPixel:Bool = false):Null<NoteStyle>
{ {
var noteStyleId:String = noteKinds.get(noteKind)?.noteStyleId ?? ""; var noteStyleId:Null<String> = getNoteStyleId(noteKind, isPixel);
if (noteStyleId == null)
{
return null;
}
return NoteStyleRegistry.instance.fetchEntry(noteStyleId); return NoteStyleRegistry.instance.fetchEntry(noteStyleId);
} }
@ -77,10 +83,17 @@ 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
* @return Null<String> * @return Null<String>
*/ */
public static function getNoteStyleId(noteKind:String):Null<String> public static function getNoteStyleId(noteKind:String, isPixel:Bool = false):Null<String>
{ {
return noteKinds.get(noteKind)?.noteStyleId; var noteStyleId:Null<String> = noteKinds.get(noteKind)?.noteStyleId;
if (isPixel && noteStyleId != null)
{
noteStyleId = NoteStyleRegistry.instance.hasEntry('$noteStyleId-pixel') ? '$noteStyleId-pixel' : noteStyleId;
}
return noteStyleId;
} }
} }

View file

@ -3585,7 +3585,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) ?? currentSongNoteStyle; noteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
noteSprite.overrideStepTime = null; noteSprite.overrideStepTime = null;
noteSprite.overrideData = null; noteSprite.overrideData = null;
@ -3609,7 +3609,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
holdNoteSprite.setHeightDirectly(noteLengthPixels); holdNoteSprite.setHeightDirectly(noteLengthPixels);
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind) ?? currentSongNoteStyle; holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes); holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
@ -3675,7 +3675,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) ?? currentSongNoteStyle; holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes); holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
@ -4574,7 +4574,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) ?? currentSongNoteStyle; gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes); gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
} }
else else
@ -4896,7 +4896,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{ {
noteData.kind = noteKindToPlace; noteData.kind = noteKindToPlace;
noteData.data = cursorColumn; noteData.data = cursorColumn;
gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle; gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
gridGhostNote.playNoteAnimation(); gridGhostNote.playNoteAnimation();
} }
noteData.time = cursorSnappedMs; noteData.time = cursorSnappedMs;
@ -5288,7 +5288,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) ?? currentSongNoteStyle; ghostHold.noteStyle = NoteKindManager.getNoteStyleId(ghostHold.noteData.kind, isPixelStyle()) ?? currentSongNoteStyle;
ghostHold.updateHoldNotePosition(renderedHoldNotes); ghostHold.updateHoldNotePosition(renderedHoldNotes);
} }
@ -6413,6 +6413,11 @@ 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();