Skip to content

Commit

Permalink
fix custom notes having a strange offset
Browse files Browse the repository at this point in the history
this still somewhat occurs for sustain notes, but it's progress.. right?
  • Loading branch information
JordanSantiagoYT committed Oct 18, 2024
1 parent d665b82 commit e47c8f3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ class Note extends FlxSprite

// this is used for note recycling
var firstOffX = false;
var shouldCenterOffsets:Bool = true;
public function setupNoteData(chartNoteData:PreloadedChartNote):Void
{
wasGoodHit = hitByOpponent = tooLate = canBeHit = false; // Don't make an update call of this for the note group
Expand All @@ -580,11 +581,16 @@ class Note extends FlxSprite
texture = 'noteskins/' + chartNoteData.noteskin;
useRGBShader = false;
}
if (chartNoteData.texture.length > 0 && chartNoteData.texture != texture) texture = chartNoteData.texture;
if (chartNoteData.texture.length > 0 && chartNoteData.texture != texture)
{
texture = chartNoteData.texture;
shouldCenterOffsets = false;
}
if ((chartNoteData.noteskin.length < 1 && chartNoteData.texture.length < 1) && chartNoteData.texture != Paths.defaultSkin)
{
texture = Paths.defaultSkin;
useRGBShader = ClientPrefs.enableColorShader;
shouldCenterOffsets = ClientPrefs.enableColorShader;
}

strumTime = chartNoteData.strumTime;
Expand Down Expand Up @@ -640,7 +646,7 @@ class Note extends FlxSprite

if (isSustainNote) {
offsetX += width / 2;
copyAngle = !false;
copyAngle = false;
animation.play(colArray[noteData % 4] + (chartNoteData.isSustainEnd ? 'holdend' : 'hold'));
updateHitbox();
offsetX -= width / 2;
Expand All @@ -649,7 +655,7 @@ class Note extends FlxSprite
animation.play(colArray[noteData % 4] + 'Scroll');
if (!copyAngle) copyAngle = true;
offsetX = 0; //Juuuust in case we recycle a sustain note to a regular note
if (useRGBShader)
if (useRGBShader && shouldCenterOffsets)
{
centerOffsets();
centerOrigin();
Expand Down

0 comments on commit e47c8f3

Please sign in to comment.