Skip to content

Commit

Permalink
fixed noteType won't work correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
HRK-EXEX committed Dec 27, 2024
1 parent b9aece3 commit 4572901
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 40 deletions.
59 changes: 26 additions & 33 deletions source/objects/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -240,36 +240,28 @@ class Note extends FlxSprite
if (rgbShader != null && rgbShader.enabled) defaultRGB();

if(noteData > -1 && noteType != value) {
switch(value) {
case 'Hurt Note':
ignoreNote = mustPress;
//reloadNote('HURTNOTE_assets');
//this used to change the note texture to HURTNOTE_assets.png,
//but i've changed it to something more optimized with the implementation of RGBPalette:

// note colors
rgbShader.r = 0xFF101010;
rgbShader.g = 0xFFFF0000;
rgbShader.b = 0xFF990022;

// splash data and colors
//noteSplashData.r = 0xFFFF0000;
//noteSplashData.g = 0xFF101010;
noteSplashData.texture = 'noteSplashes-electric';

// gameplay data
lowPriority = true;
missHealth = isSustainNote ? 0.25 : 0.1;
hitCausesMiss = true;
hitsound = 'cancelMenu';
hitsoundChartEditor = false;
case 'Alt Animation':
animSuffix = '-alt';
case 'No Animation':
noAnimation = true;
noMissAnimation = true;
case 'GF Sing':
gfNote = true;
if (value == 'Hurt Note') {
ignoreNote = mustPress;
//reloadNote('HURTNOTE_assets');
//this used to change the note texture to HURTNOTE_assets.png,
//but i've changed it to something more optimized with the implementation of RGBPalette:

// note colors
rgbShader.r = 0xFF101010;
rgbShader.g = 0xFFFF0000;
rgbShader.b = 0xFF990022;

// splash data and colors
//noteSplashData.r = 0xFFFF0000;
//noteSplashData.g = 0xFF101010;
noteSplashData.texture = 'noteSplashes-electric';

// gameplay data
lowPriority = true;
missHealth = isSustainNote ? 0.25 : 0.1;
hitCausesMiss = true;
hitsound = 'cancelMenu';
hitsoundChartEditor = false;
}
if (value != null && value.length > 1) NoteTypesConfig.applyNoteTypeData(this, value);
if (hitsound != 'hitsound' && hitsoundVolume > 0) Paths.sound(hitsound); //precache new sound for being idiot-proof
Expand Down Expand Up @@ -687,11 +679,9 @@ class Note extends FlxSprite
isSustainEnds = toBool(target.noteData & (1<<10)); // isHoldEnd
gfNote = toBool(target.noteData & (1<<11)); // gfNote
animSuffix = toBool(target.noteData & (1<<12)) ? "-alt" : ""; // altAnim
noAnimation = toBool(target.noteData & (1<<13)); // noAnim
noMissAnimation = toBool(target.noteData & (1<<14)); // noMissAnim
noAnimation = noMissAnimation = toBool(target.noteData & (1<<13)); // noAnim
blockHit = toBool(target.noteData & (1<<15)); // blockHit
noteData = target.noteData & 3;
noteType = target.noteType;

// Absoluty should be here, or messing pixel texture glitches...
if (!PlayState.isPixelStage) {
Expand All @@ -704,6 +694,9 @@ class Note extends FlxSprite
rgbShader.g = colorRef.g;
rgbShader.b = colorRef.b;

if (target.noteType is String) noteType = target.noteType; // applying note color on damage notes
else noteType = defaultNoteTypes[Std.parseInt(target.noteType)];

if (PlayState.SONG != null && PlayState.SONG.disableNoteRGB) rgbShader.enabled = false;

sustainLength = target.holdLength ?? 0;
Expand Down
6 changes: 3 additions & 3 deletions source/options/OptimizeSettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class OptimizeSettingsSubState extends BaseOptionsMenu
addOption(option);

var option:Option = new Option('Process Notes before Spawning',
"If checked, it process notes before they spawn.\nIt boosts game performance vastly.\n It is recommended to enable this option.",
"If checked, it process notes before they spawn.\nIt boosts game performance vastly.\nIt is recommended to enable this option.",
'processFirst',
BOOL);
addOption(option);
Expand Down Expand Up @@ -123,13 +123,13 @@ class OptimizeSettingsSubState extends BaseOptionsMenu
addOption(option);

var option:Option = new Option('spawnNoteEvent',
"If unchecked, the game will not send any event on Lua/HScript for spawned notes.\nImproves performance.",
"If unchecked, the game will not send spawn event\non Lua/HScript for spawned notes. Improves performance.",
'spawnNoteEvent',
BOOL);
addOption(option);

var option:Option = new Option('noteHitEvents for Skipped Notes',
"If unchecked, the game will not send any event on Lua/HScript for skipped notes.\nImproves performance.",
"If unchecked, the game will not send any hit event\non Lua/HScript for skipped notes. Improves performance.",
'skipNoteEvent',
BOOL);
addOption(option);
Expand Down
6 changes: 2 additions & 4 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1782,21 +1782,19 @@ class PlayState extends MusicBeatState
}

holdLength = songNotes[2];
noteType = songNotes[3];

swagNote = {
strumTime: songNotes[0],
noteData: noteColumn,
noteType: Math.isNaN(songNotes[3]) ? songNotes[3] : null,
noteType: songNotes[3],
holdLength: holdLength,
noteSkin: SONG.arrowSkin ?? null
};

swagNote.noteData |= gottaHitNote ? 1<<8 : 0; // mustHit
swagNote.noteData |= (section.gfSection && (songNotes[1]<4) || songNotes[3] == 'GF Sing' || songNotes[3] == 4) ? 1<<11 : 0; // gfNote
swagNote.noteData |= (section.altAnim || (songNotes[3] == 'Alt Animation' || songNotes[3] == 1)) ? 1<<12 : 0; // altAnim
swagNote.noteData |= (songNotes[3] == 'No Animation' || songNotes[3] == 5) ? 3<<13 : 0; // noAnimation & noMissAnimaiton
swagNote.noteData |= (songNotes[3] == 'Hurt Note' || songNotes[3] == 3) ? 1<<15 : 0;
swagNote.noteData |= (songNotes[3] == 'No Animation' || songNotes[3] == 5) ? 1<<13 : 0; // noAnimation & noMissAnimaiton

unspawnNotes.push(swagNote);

Expand Down

0 comments on commit 4572901

Please sign in to comment.