From bb8b862d67200087e8022447de3090bdcba68f72 Mon Sep 17 00:00:00 2001 From: "HRK.EXEX" <74143200+HRK-EXEX@users.noreply.github.com> Date: Sun, 5 Jan 2025 12:35:29 +0900 Subject: [PATCH] fixed bug noteType doesn't work if the same value is passed consecutively. --- source/backend/SongJson.hx | 2 +- source/objects/Note.hx | 44 ++++++++++++++++++++++---------------- source/states/PlayState.hx | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/source/backend/SongJson.hx b/source/backend/SongJson.hx index 580f8c0e..1b554a32 100644 --- a/source/backend/SongJson.hx +++ b/source/backend/SongJson.hx @@ -158,7 +158,7 @@ class SongJson { case '"'.code: if (field != null || comma) invalidChar(); field = parseString(); - #if debug trace('field: $field'); #end + #if debug if (!skipMode) trace('field: $field'); #end if (skipChart && field == "notes") prepareSkipMode = true; default: invalidChar(); diff --git a/source/objects/Note.hx b/source/objects/Note.hx index bfd96f5f..b28debcd 100644 --- a/source/objects/Note.hx +++ b/source/objects/Note.hx @@ -123,6 +123,8 @@ class Note extends FlxSprite public var lateHitMult:Float = 1; public var lowPriority:Bool = false; + public static var isBotplay:Bool = false; + public static var SUSTAIN_SIZE:Int = 44; public static var swagWidth:Float = 160 * 0.7; public static var originalWidth:Float = 160 * 0.7; @@ -216,16 +218,16 @@ class Note extends FlxSprite return value; } + static var colArr:Array; public function defaultRGB() { - var arr:Array = ClientPrefs.data.arrowRGB[noteData]; - if(PlayState.isPixelStage) arr = ClientPrefs.data.arrowRGBPixel[noteData]; + colArr = PlayState.isPixelStage ? ClientPrefs.data.arrowRGBPixel[noteData] : ClientPrefs.data.arrowRGB[noteData]; - if (arr != null && noteData > -1 && noteData <= arr.length) + if (colArr != null && noteData > -1 && noteData <= colArr.length) { - rgbShader.r = arr[0]; - rgbShader.g = arr[1]; - rgbShader.b = arr[2]; + rgbShader.r = colArr[0]; + rgbShader.g = colArr[1]; + rgbShader.b = colArr[2]; } else { @@ -239,9 +241,11 @@ class Note extends FlxSprite noteSplashData.texture = PlayState.SONG != null ? PlayState.SONG.splashSkin : 'noteSplashes'; if (rgbShader != null && rgbShader.enabled) defaultRGB(); - if(noteData > -1 && noteType != value) { + trace(value, noteType); + + if (noteData > -1) { if (value == 'Hurt Note') { - ignoreNote = mustPress; + ignoreNote = mustPress && isBotplay; //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: @@ -282,7 +286,7 @@ class Note extends FlxSprite y -= 2000; rgbShader = new RGBShaderReference(this, initializeGlobalRGBShader(noteData)); - if(PlayState.SONG != null && PlayState.SONG.disableNoteRGB) rgbShader.enabled = false; + if (PlayState.SONG != null && PlayState.SONG.disableNoteRGB) rgbShader.enabled = false; // if(createdFrom == null) createdFrom = PlayState.instance; @@ -369,18 +373,18 @@ class Note extends FlxSprite // x += offsetX; } + static var newRGB:RGBPalette = new RGBPalette(); public static function initializeGlobalRGBShader(noteData:Int) { if(globalRgbShaders[noteData] == null) { - var newRGB:RGBPalette = new RGBPalette(); - var arr:Array = (!PlayState.isPixelStage) ? ClientPrefs.data.arrowRGB[noteData] : ClientPrefs.data.arrowRGBPixel[noteData]; + colArr = PlayState.isPixelStage ? ClientPrefs.data.arrowRGBPixel[noteData] : ClientPrefs.data.arrowRGB[noteData]; - if (arr != null && noteData > -1 && noteData <= arr.length) + if (colArr != null && noteData > -1 && noteData <= colArr.length) { - newRGB.r = arr[0]; - newRGB.g = arr[1]; - newRGB.b = arr[2]; + newRGB.r = colArr[0]; + newRGB.g = colArr[1]; + newRGB.b = colArr[2]; } else { @@ -671,6 +675,8 @@ class Note extends FlxSprite wasGoodHit = hitByOpponent = tooLate = canBeHit = spawned = followed = false; // Don't make an update call of this for the note group exists = true; + isBotplay = PlayState.instance != null ? PlayState.instance.cpuControlled : false; + strumTime = target.strumTime; if (!inEditor) strumTime += ClientPrefs.data.noteOffset; @@ -694,10 +700,10 @@ 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; + try { + if (target.noteType is String) noteType = target.noteType; // applying note color on damage notes + else noteType = defaultNoteTypes[Std.parseInt(target.noteType)]; + } catch (e:Dynamic) {} sustainLength = target.holdLength ?? 0; diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index de225e14..11bf2f54 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -4327,7 +4327,7 @@ Average NPS in loading: ${numFormat(notes / takenNoteTime, 3)}'); } } goodNoteHit(funnyNote); - popUpScore(funnyNote); + if (showPopups && popUpHitNote != null) popUpScore(funnyNote); } else {