From 0706192cbe7863954351009a9825adf2bfbdd8c4 Mon Sep 17 00:00:00 2001 From: dombomb64 <49823019+dombomb64@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:50:59 -0400 Subject: [PATCH 1/2] Fix note scaling with one simple trick! --- source/funkin/play/notes/StrumlineNote.hx | 2 +- source/funkin/play/notes/notestyle/NoteStyle.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/notes/StrumlineNote.hx b/source/funkin/play/notes/StrumlineNote.hx index d8230aa282..c33c8b5787 100644 --- a/source/funkin/play/notes/StrumlineNote.hx +++ b/source/funkin/play/notes/StrumlineNote.hx @@ -85,7 +85,7 @@ class StrumlineNote extends FlxSprite noteStyle.applyStrumlineFrames(this); noteStyle.applyStrumlineAnimations(this, this.direction); - this.setGraphicSize(Std.int(Strumline.STRUMLINE_SIZE * noteStyle.getStrumlineScale())); + this.scale.set(noteStyle.getStrumlineScale()); this.updateHitbox(); noteStyle.applyStrumlineOffsets(this); diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index ee07703f1f..9079fee649 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -93,7 +93,7 @@ class NoteStyle implements IRegistryEntry buildNoteAnimations(target); // Set the scale. - target.setGraphicSize(Strumline.STRUMLINE_SIZE * getNoteScale()); + target.scale.set(getNoteScale()); target.updateHitbox(); } From 6e33cac9ec0636333156a308b65438c311bc92be Mon Sep 17 00:00:00 2001 From: dombomb64 <49823019+dombomb64@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:47:16 -0400 Subject: [PATCH 2/2] ...Okay it wasn't that simple --- source/funkin/play/notes/StrumlineNote.hx | 3 ++- source/funkin/play/notes/SustainTrail.hx | 5 +++-- .../funkin/play/notes/notestyle/NoteStyle.hx | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/notes/StrumlineNote.hx b/source/funkin/play/notes/StrumlineNote.hx index c33c8b5787..16df9f5020 100644 --- a/source/funkin/play/notes/StrumlineNote.hx +++ b/source/funkin/play/notes/StrumlineNote.hx @@ -85,7 +85,8 @@ class StrumlineNote extends FlxSprite noteStyle.applyStrumlineFrames(this); noteStyle.applyStrumlineAnimations(this, this.direction); - this.scale.set(noteStyle.getStrumlineScale()); + var scale = noteStyle.getStrumlineScale(); + this.scale.set(scale, scale); this.updateHitbox(); noteStyle.applyStrumlineOffsets(this); diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index 90b36b0099..a9af468b94 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -87,6 +87,7 @@ class SustainTrail extends FlxSprite public var bottomClip:Float = 0.9; public var isPixel:Bool; + public var noteStyleOffsets:Array; var graphicWidth:Float = 0; var graphicHeight:Float = 0; @@ -107,6 +108,7 @@ class SustainTrail extends FlxSprite this.noteDirection = noteDirection; setupHoldNoteGraphic(noteStyle); + noteStyleOffsets = noteStyle.getHoldNoteOffsets(); indices = new DrawData(12, true, TRIANGLE_VERTEX_INDICES); @@ -137,7 +139,6 @@ class SustainTrail extends FlxSprite zoom = 1.0; zoom *= noteStyle.fetchHoldNoteScale(); - zoom *= 0.7; // CALCULATE SIZE graphicWidth = graphic.width / 8 * zoom; // amount of notes * 2 @@ -202,7 +203,7 @@ class SustainTrail extends FlxSprite { width = graphicWidth; height = graphicHeight; - offset.set(0, 0); + offset.set(noteStyleOffsets[0], noteStyleOffsets[1]); origin.set(width * 0.5, height * 0.5); } diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index 9079fee649..a5ff19cba5 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -93,7 +93,8 @@ class NoteStyle implements IRegistryEntry buildNoteAnimations(target); // Set the scale. - target.scale.set(getNoteScale()); + var scale = getNoteScale(); + target.scale.set(scale, scale); target.updateHitbox(); } @@ -224,6 +225,13 @@ class NoteStyle implements IRegistryEntry return data?.scale ?? 1.0; } + public function getHoldNoteOffsets():Array + { + var data = _data?.assets?.holdNote; + if (data == null && fallback != null) return fallback.getHoldNoteOffsets(); + return data?.offsets ?? [0.0, 0.0]; + } + public function applyStrumlineFrames(target:StrumlineNote):Void { // TODO: Add support for multi-Sparrow. @@ -304,9 +312,16 @@ class NoteStyle implements IRegistryEntry return thx.Arrays.filterNull(result); } + public function getStrumlineOffsets():Array + { + var data = _data?.assets?.noteStrumline; + if (data == null && fallback != null) return fallback.getStrumlineOffsets(); + return data?.offsets ?? [0.0, 0.0]; + } + public function applyStrumlineOffsets(target:StrumlineNote):Void { - var offsets = _data?.assets?.noteStrumline?.offsets ?? [0.0, 0.0]; + var offsets = getStrumlineOffsets(); target.x += offsets[0]; target.y += offsets[1]; }