From e7f8e4db32c7ba00a44985eecb20f0c9d5291342 Mon Sep 17 00:00:00 2001 From: JordanSantiagoYT Date: Sun, 12 Nov 2023 22:40:29 -0500 Subject: [PATCH] the changes!! Added the Denpa Engine Health Drain Bug as a feature OG HP Colors RETURNS Fixed default songs with spaces not being picked up correctly Sustain notes now render under normal notes and the strums Botplay text is now created again Finally fixed an issue with sustain notes after the first Troll Mode loop --- assets/preload/data/funnyTips.txt | 2 + source/ClientPrefs.hx | 10 ++++ source/FreeplayState.hx | 11 ++--- source/Note.hx | 32 ++++++++----- source/PlayState.hx | 72 +++++++++++++++++++++++------ source/editors/ChartingState.hx | 10 ++-- source/options/VisualsUISubState.hx | 14 ++++++ 7 files changed, 114 insertions(+), 37 deletions(-) diff --git a/assets/preload/data/funnyTips.txt b/assets/preload/data/funnyTips.txt index 76aee676e63..7cf1c5c642a 100644 --- a/assets/preload/data/funnyTips.txt +++ b/assets/preload/data/funnyTips.txt @@ -10,6 +10,7 @@ All it takes is one YouTube Video "JS Engine"? Never heard of it I wonder what goombas taste like... Finna blow up a toilet +what 5 grams of jordan santiago does to an fnf engine: "i DARE you to make a 30+mb chart with normal psych :joy_cat:" - justAMZ What's a debug without a 7? ;) JS engine aint JavaScript engine @@ -61,5 +62,6 @@ Download JS Engine right now! oh wait you're already here, uhhh... STOP USING OS THERES TOO MUCH ZOOMING PLEASE HELP ME TURN IT OFF- Options, then Visuals & UI, then turn off Double Note Ghosts. I kinda like future in 2024- Wait, 2024 EXISTS????? HUHHHH??? Stefan's grammar is so bad and un-understandable for real +2006archives says: "Penis" Mario is the best rythm gamer on mania charts. Go subscribe him tho btw. Mays, you know what happend if you gonna ignore Trollge? \ No newline at end of file diff --git a/source/ClientPrefs.hx b/source/ClientPrefs.hx index f024bc4f0b7..65fe8e710a7 100644 --- a/source/ClientPrefs.hx +++ b/source/ClientPrefs.hx @@ -120,6 +120,8 @@ class ClientPrefs { //default settings if it can't find a save file containing y public static var opponentRateCount:Bool = true; public static var coolGameplay:Bool = false; public static var skipResultsScreen:Bool = false; + public static var denpaDrainBug:Bool = false; + public static var ogHPColor:Bool = false; public static var hudType:String = 'Kade Engine'; public static var smoothHealth:Bool = true; public static var smoothHealthType:String = 'Golden Apple 1.5'; @@ -272,6 +274,8 @@ class ClientPrefs { //default settings if it can't find a save file containing y FlxG.save.data.holdNoteHits = holdNoteHits; FlxG.save.data.comboScoreEffect = comboScoreEffect; FlxG.save.data.comboMultiType = comboMultiType; + FlxG.save.data.denpaDrainBug = denpaDrainBug; + FlxG.save.data.ogHPColor = ogHPColor; FlxG.save.data.charsAndBG = charsAndBG; FlxG.save.data.pbRControls = pbRControls; FlxG.save.data.doubleGhost = doubleGhost; @@ -438,6 +442,12 @@ class ClientPrefs { //default settings if it can't find a save file containing y if(FlxG.save.data.noGunsRNG != null) { noGunsRNG = FlxG.save.data.noGunsRNG; } + if(FlxG.save.data.denpaDrainBug != null) { + denpaDrainBug = FlxG.save.data.denpaDrainBug; + } + if(FlxG.save.data.ogHPColor != null) { + ogHPColor = FlxG.save.data.ogHPColor; + } if(FlxG.save.data.showRamUsage != null) { showRamUsage = FlxG.save.data.showRamUsage; } diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index a41b396e333..ba179f4bf4a 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -391,11 +391,12 @@ class FreeplayState extends MusicBeatState Paths.currentModDirectory = songs[curSelected].folder; var poop:String = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), curDifficulty); PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase()); - for (i in 0...CoolUtil.defaultSongs.length) { - if (Paths.formatToSongPath(PlayState.SONG.song) == CoolUtil.defaultSongs[i] && curDifficulty == 2 && ClientPrefs.JSEngineRecharts) { + if (CoolUtil.defaultSongs.contains(PlayState.SONG.song.toLowerCase()) && curDifficulty == 2 && ClientPrefs.JSEngineRecharts) { PlayState.SONG = Song.loadFromJson(songs[curSelected].songName.toLowerCase() + '-jshard', songs[curSelected].songName.toLowerCase()); - } + } else { + PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase()); } + if (PlayState.SONG.needsVoices) vocals = new FlxSound().loadEmbedded(Paths.voices(PlayState.SONG.song)); else @@ -482,14 +483,12 @@ class FreeplayState extends MusicBeatState PlayState.SONG = Song.loadFromJson(poop, songLowercase); if(sys.FileSystem.exists(Paths.modsJson(songLowercase + '/' + poop)) || sys.FileSystem.exists(Paths.json(songLowercase + '/' + poop)) || OpenFlAssets.exists(Paths.modsJson(songLowercase + '/' + poop)) || OpenFlAssets.exists(Paths.json(songLowercase + '/' + poop))) { - for (i in 0...CoolUtil.defaultSongs.length) { - if (Paths.formatToSongPath(PlayState.SONG.song) == CoolUtil.defaultSongs[i] && curDifficulty == 2 && ClientPrefs.JSEngineRecharts) { + if (CoolUtil.defaultSongs.contains(PlayState.SONG.song.toLowerCase()) && curDifficulty == 2 && ClientPrefs.JSEngineRecharts) { PlayState.SONG = Song.loadFromJson(songs[curSelected].songName.toLowerCase() + '-jshard', songs[curSelected].songName.toLowerCase()); PlayState.storyDifficulty == 2; } else { PlayState.storyDifficulty = curDifficulty; } - } PlayState.isStoryMode = false; trace('CURRENT WEEK: ' + WeekData.getWeekFileName()); diff --git a/source/Note.hx b/source/Note.hx index c6aa7fa0a49..ce89f832f6a 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -78,13 +78,18 @@ class Note extends FlxSprite public var multAlpha:Float = 1; public var multSpeed(default, set):Float = 1; + public var prevNoteIsSustainNote:Bool = false; + public static var SUSTAIN_SIZE:Int = 44; public var copyX:Bool = true; public var copyY:Bool = true; + public var copyScale:Bool = true; public var copyAngle:Bool = true; public var copyAlpha:Bool = true; + public var dumbHitboxThing:Bool = true; + public var hitHealth:Float = 0.023; public var missHealth:Float = 0.0475; public var rating:String = 'unknown'; @@ -371,6 +376,7 @@ class Note extends FlxSprite multAlpha = 0.6; hitsoundDisabled = true; if(ClientPrefs.downScroll) flipY = true; + prevNoteIsSustainNote = prevNote.isSustainNote; offsetX += width / 2; copyAngle = false; @@ -572,6 +578,20 @@ class Note extends FlxSprite distance = (0.45 * (Conductor.songPosition - strumTime) * songSpeed * multSpeed); if (!myStrum.downScroll) distance *= -1; + if(animation != null && animation.curAnim != null && animation.curAnim.name.endsWith('end')) + { + y -= height-2; + if (!prevNoteIsSustainNote) //only for really short sustains that only have an end and no regular parts + { + y += height*0.25; //move back down slightly into the note + } + } + + if(copyScale && isSustainNote) + //scale.set(myStrum.scale.x, myStrum.scale.y); + if (!dumbHitboxThing) + updateHitbox(); + var angleDir = strumDirection * Math.PI / 180; if (copyAngle) angle = strumDirection - 90 + strumAngle + offsetAngle; @@ -623,16 +643,4 @@ class Note extends FlxSprite clipRect = swagRect; } } - - @:noCompletion - override function set_clipRect(rect:FlxRect):FlxRect // original fix by Ne_Eo - { - if (rect != null) - clipRect = rect; - - if (frames != null) - frame = frames.frames[animation.frameIndex]; - - return rect; - } } \ No newline at end of file diff --git a/source/PlayState.hx b/source/PlayState.hx index d183b4df228..f16d82c53f4 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -192,6 +192,7 @@ class PlayState extends MusicBeatState var tankmanAscend:Bool = false; // funni (2021 nostalgia oh my god) public var notes:FlxTypedGroup; + public var sustainNotes:FlxTypedGroup; public var unspawnNotes:Array = []; public var unspawnNotesCopy:Array = []; public var eventNotes:Array = []; @@ -1740,6 +1741,9 @@ class PlayState extends MusicBeatState if (ClientPrefs.hudType == 'Kade Engine' && ClientPrefs.hudType == 'Dave and Bambi') timePercentTxt.x = timeBarBG.x + 600; add(timePercentTxt); + sustainNotes = new FlxTypedGroup(); + add(sustainNotes); + strumLineNotes = new FlxTypedGroup(); add(strumLineNotes); add(grpNoteSplashes); @@ -2236,8 +2240,6 @@ class PlayState extends MusicBeatState pauseWarnText.y -= 25; pauseWarnText.alpha = 0; - if (cpuControlled && !ClientPrefs.showcaseMode) - { if (ClientPrefs.hudType == 'Psych Engine') { botplayTxt = new FlxText(400, timeBarBG.y + 55, FlxG.width - 800, "BOTPLAY", 32); @@ -2348,7 +2350,7 @@ class PlayState extends MusicBeatState botplayTxt.y = timeBarBG.y - 78; } } - } + if (ClientPrefs.communityGameBot && botplayTxt != null || ClientPrefs.showcaseMode && botplayTxt != null) botplayTxt.destroy(); laneunderlayOpponent.cameras = [camHUD]; @@ -2356,6 +2358,7 @@ class PlayState extends MusicBeatState strumLineNotes.cameras = [camHUD]; grpNoteSplashes.cameras = [camHUD]; notes.cameras = [camHUD]; + sustainNotes.cameras = [camHUD]; healthBar.cameras = [camHUD]; healthBarBG.cameras = [camHUD]; iconP1.cameras = [camHUD]; @@ -2718,6 +2721,11 @@ class PlayState extends MusicBeatState continue; note.resizeByRatio(ratio); } + for (note in sustainNotes){ + if (note == null) + continue; + note.resizeByRatio(ratio); + } for (note in unspawnNotes){ if (note == null) continue; @@ -2761,10 +2769,15 @@ class PlayState extends MusicBeatState } public function reloadHealthBarColors() { + if (!ClientPrefs.ogHPColor) { if (!opponentChart) healthBar.createFilledBar(FlxColor.fromRGB(dad.healthColorArray[0], dad.healthColorArray[1], dad.healthColorArray[2]), FlxColor.fromRGB(boyfriend.healthColorArray[0], boyfriend.healthColorArray[1], boyfriend.healthColorArray[2])); else healthBar.createFilledBar(FlxColor.fromRGB(boyfriend.healthColorArray[0], boyfriend.healthColorArray[1], boyfriend.healthColorArray[2]), FlxColor.fromRGB(dad.healthColorArray[0], dad.healthColorArray[1], dad.healthColorArray[2])); + } else { + if (!opponentChart) healthBar.createFilledBar(0xFFFF0000, 0xFF66FF33); + else healthBar.createFilledBar(0xFF66FF33, 0xFFFF0000); + } healthBar.updateBar(); } @@ -3773,7 +3786,7 @@ class PlayState extends MusicBeatState } } - notes.forEachAlive(function(note:Note) { + for (group in [notes, sustainNotes]) group.forEachAlive(function(note:Note) { if(ClientPrefs.opponentStrums || !ClientPrefs.opponentStrums && ClientPrefs.mobileMidScroll || ClientPrefs.middleScroll || !note.mustPress) { note.alpha *= 0.35; @@ -3852,6 +3865,26 @@ class PlayState extends MusicBeatState } --i; } + + i = sustainNotes.length - 1; + while (i >= 0) { + var daNote:Note = sustainNotes.members[i]; + if(daNote.strumTime - 350 < time) + { + daNote.active = false; + daNote.visible = false; + daNote.ignoreNote = true; + + if (shouldKillNotes) { + daNote.kill(); + } + sustainNotes.remove(daNote, true); + if (shouldKillNotes) { + daNote.destroy(); + } + } + --i; + } } public function updateScore(miss:Bool = false) @@ -5568,10 +5601,9 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi for (i in 0...unspawnNotes.length) { if (unspawnNotes[i].strumTime - Conductor.songPosition < spawnTime) { if (ClientPrefs.showNotes) { - // Add notes to 'notes' one by one if they meet the criteria - notes.insert(0, unspawnNotes[i]); + !unspawnNotes[i].isSustainNote ? notes.insert(0, unspawnNotes[i]) : sustainNotes.insert(0, unspawnNotes[i]); //If it's NOT a sustain note, we add it to notes. else, we add it to sustainNotes } else { - notes.add(unspawnNotes[i]); + !unspawnNotes[i].isSustainNote ? notes.add(unspawnNotes[i]) : sustainNotes.add(unspawnNotes[i]); } unspawnNotes[i].spawned = true; notesAddedCount++; @@ -5591,7 +5623,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi notesAddedCount = 0; for (i in 0...unspawnNotes.length) { - var daNote = unspawnNotes[i]; + final daNote = unspawnNotes[i]; if(daNote.mustPress && cpuControlled) { if (daNote.strumTime + (ClientPrefs.communityGameBot ? FlxG.random.float(ClientPrefs.minCGBMS, ClientPrefs.maxCGBMS) : 0) <= Conductor.songPosition || daNote.isSustainNote && daNote.strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * daNote.earlyHitMult /2)) { if (!ClientPrefs.showcaseMode || ClientPrefs.charsAndBG) goodNoteHit(daNote); @@ -5771,6 +5803,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi daNote.hitByOpponent = true; if (opponentDrain && health > 0.1) health -= daNote.hitHealth * hpDrainLevel * polyphony; + if (ClientPrefs.denpaDrainBug) displayedHealth -= daNote.hitHealth * hpDrainLevel * polyphony; callOnLuas('opponentNoteHit', [notes.members.indexOf(daNote), Math.abs(daNote.noteData), daNote.noteType, daNote.isSustainNote]); callOnLuas((opponentChart ? 'goodNoteHitFix' : 'opponentNoteHitFix'), [notes.members.indexOf(daNote), Math.abs(daNote.noteData), daNote.noteType, daNote.isSustainNote]); @@ -5832,7 +5865,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi if(startedCountdown) { var fakeCrochet:Float = (60 / SONG.bpm) * 1000; - notes.forEachAlive(function(daNote:Note) + for (group in [notes, sustainNotes]) group.forEachAlive(function(daNote:Note) //inspired by denpa, but not directly denpa code { if (ClientPrefs.showNotes) { @@ -6032,6 +6065,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi health -= daNote.hitHealth * hpDrainLevel * polyphony; if (ClientPrefs.healthDisplay && !ClientPrefs.hideScore && scoreTxtUpdateFrame <= 4 && scoreTxt != null) updateScore(); } + if (ClientPrefs.denpaDrainBug) displayedHealth -= daNote.hitHealth * hpDrainLevel * polyphony; if (ClientPrefs.ratingCounter && judgeCountUpdateFrame <= 4) updateRatingCounter(); if (ClientPrefs.compactNumbers && compactUpdateFrame <= 4) updateCompactNumbers(); } @@ -6098,7 +6132,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi { daNote.kill(); } - notes.remove(daNote, true); + group.remove(daNote, true); if (shouldKillNotes) { daNote.destroy(); @@ -6108,7 +6142,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi } else { - notes.forEachAlive(function(daNote:Note) + for (group in [notes, sustainNotes]) group.forEachAlive(function(daNote:Note) { daNote.canBeHit = false; daNote.wasGoodHit = false; @@ -6815,6 +6849,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi n.hitByOpponent = false; n.spawned = false; n.alpha = 1; + n.clipRect = null; if (n.mustPress && !n.isSustainNote) { totalNotes += 1; @@ -6855,6 +6890,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi n.hitByOpponent = false; n.spawned = false; n.alpha = 1; + n.clipRect = null; if (n.mustPress && !n.isSustainNote) { totalNotes += 1; @@ -6894,6 +6930,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi n.hitByOpponent = false; n.spawned = false; n.alpha = 1; + n.clipRect = null; if (n.mustPress && !n.isSustainNote) { totalNotes += 1; @@ -6931,6 +6968,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi n.hitByOpponent = false; n.spawned = false; n.alpha = 1; + n.clipRect = null; if (n.mustPress && !n.isSustainNote) { totalNotes += 1; @@ -6967,6 +7005,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi n.hitByOpponent = false; n.spawned = false; n.alpha = 1; + n.clipRect = null; if (n.mustPress && !n.isSustainNote) { totalNotes += 1; @@ -8036,7 +8075,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT var hittableSpam = []; var sortedNotesList:Array = []; - notes.forEachAlive(function(daNote:Note) + for (group in [notes, sustainNotes]) group.forEachAlive(function(daNote:Note) { if (strumsBlocked[daNote.noteData] != true && daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && !daNote.isSustainNote && !daNote.blockHit) { @@ -8196,7 +8235,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT if (startedCountdown && !char.stunned && generatedMusic) { // rewritten inputs??? - notes.forEachAlive(function(daNote:Note) + for (group in [notes, sustainNotes]) group.forEachAlive(function(daNote:Note) { // hold note functions if (strumsBlocked[daNote.noteData] != true && daNote.isSustainNote && parsedHoldArray[daNote.noteData] && daNote.canBeHit @@ -8259,13 +8298,13 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT function noteMiss(daNote:Note):Void { //You didn't hit the key and let it go offscreen, also used by Hurt Notes //Dupe note remove - notes.forEachAlive(function(note:Note) { + for (group in [notes, sustainNotes]) group.forEachAlive(function(note:Note) { if (daNote != note && daNote.mustPress && daNote.noteData == note.noteData && daNote.isSustainNote == note.isSustainNote && Math.abs(daNote.strumTime - note.strumTime) < 1) { if (shouldKillNotes) { note.kill(); } - notes.remove(note, true); + group.remove(note, true); if (shouldKillNotes) { note.destroy(); @@ -8325,6 +8364,8 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT char.playAnim(animToPlay, true); } + daNote.tooLate = true; + callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]); if (!ClientPrefs.hideScore && scoreTxtUpdateFrame <= 4 && scoreTxt != null) updateScore(); } @@ -9311,6 +9352,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT if (generatedMusic) { if (ClientPrefs.showNotes) notes.sort(FlxSort.byY, ClientPrefs.downScroll ? FlxSort.ASCENDING : FlxSort.DESCENDING); + if (ClientPrefs.showNotes) sustainNotes.sort(FlxSort.byY, ClientPrefs.downScroll ? FlxSort.ASCENDING : FlxSort.DESCENDING); } if (ClientPrefs.iconBounceType == 'Dave and Bambi') { diff --git a/source/editors/ChartingState.hx b/source/editors/ChartingState.hx index a41c60c7c2f..d1ba99580fb 100644 --- a/source/editors/ChartingState.hx +++ b/source/editors/ChartingState.hx @@ -1365,7 +1365,7 @@ class ChartingState extends MusicBeatState curSelectedNote[1][curEventSelected][0] = eventStuff[selectedEvent][0]; } - updateGrid(); + updateGrid(false); } }); blockPressWhileScrolling.push(eventDropDown); @@ -3074,12 +3074,12 @@ class ChartingState extends MusicBeatState function updateGrid(?andNext:Bool = true):Void { //classic fnf styled grid updating - while (curRenderedNotes.members.length > 0) + while (curRenderedNotes.length > 0) { curRenderedNotes.remove(curRenderedNotes.members[0], true); } - while (curRenderedSustains.members.length > 0) + while (curRenderedSustains.length > 0) { curRenderedSustains.remove(curRenderedSustains.members[0], true); } @@ -3169,9 +3169,10 @@ class ChartingState extends MusicBeatState } } + if (andNext) { // NEXT SECTION, which shouldnt even update if you're in the current section var beats:Float = getSectionBeats(1); - if(curSec < _song.notes.length-1 && andNext) { + if(curSec < _song.notes.length-1) { for (i in _song.notes[curSec+1].sectionNotes) { var note:Note = setupNoteData(i, true); @@ -3197,6 +3198,7 @@ class ChartingState extends MusicBeatState } } } + } #if desktop // Updating Discord Rich Presence (for updating Note Count) DiscordClient.changePresence("Chart Editor - Charting " + StringTools.replace(_song.song, '-', ' '), '${FlxStringUtil.formatMoney(CoolUtil.getNoteAmount(_song), false)} Notes'); diff --git a/source/options/VisualsUISubState.hx b/source/options/VisualsUISubState.hx index 721ce372435..fcc783a9192 100644 --- a/source/options/VisualsUISubState.hx +++ b/source/options/VisualsUISubState.hx @@ -261,6 +261,20 @@ class VisualsUISubState extends BaseOptionsMenu ['Golden Apple 1.5', 'Indie Cross']); addOption(option); + var option:Option = new Option('Denpa Engine Health Bug', //ill remove this at the request of AT - Jordan Santiago + 'If checked, well.. replicates the health drain bug in Denpa Engine.', + 'denpaDrainBug', + 'bool', + false); + addOption(option); + + var option:Option = new Option('OG HP Colors', + 'If checked, the health bar will globally use Red/Green as the colors.', + 'ogHPColor', + 'bool', + false); + addOption(option); + var option:Option = new Option('Double Note Ghosts', "If this is checked, hitting a Double Note will show an afterimage, just like in VS Impostor!", 'doubleGhost',