From 9e4e6fdb5b00c98f2f73cddc50e4bac549c7d1fe Mon Sep 17 00:00:00 2001 From: Lasercar Date: Sun, 23 Feb 2025 19:18:24 +1000 Subject: [PATCH 1/4] Freeplay UI fixes Input is disabled as soon as possible when a capsule is open Input re-enables after capsule errors instrument selector uses the capsule's target position as it's position, rather than the capsule's position --- source/funkin/ui/freeplay/FreeplayState.hx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 2cdd3ef543..9920bc76d0 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -1850,11 +1850,15 @@ class FreeplayState extends MusicBeatSubState */ function capsuleOnOpenDefault(cap:SongMenuItem):Void { + busy = true; + letterSort.inputEnabled = false; var targetSongId:String = cap?.freeplayData?.data.id ?? 'unknown'; var targetSongNullable:Null = SongRegistry.instance.fetchEntry(targetSongId); if (targetSongNullable == null) { FlxG.log.warn('WARN: could not find song with id (${targetSongId})'); + busy = false; + letterSort.inputEnabled = true; return; } var targetSong:Song = targetSongNullable; @@ -1868,6 +1872,8 @@ class FreeplayState extends MusicBeatSubState if (targetDifficulty == null) { FlxG.log.warn('WARN: could not find difficulty with id (${targetDifficultyId})'); + busy = false; + letterSort.inputEnabled = true; return; } @@ -1897,9 +1903,7 @@ class FreeplayState extends MusicBeatSubState function openInstrumentalList(cap:SongMenuItem, instrumentalIds:Array):Void { - busy = true; - - capsuleOptionsMenu = new CapsuleOptionsMenu(this, cap.x + 175, cap.y + 115, instrumentalIds); + capsuleOptionsMenu = new CapsuleOptionsMenu(this, cap.targetPos.x + 175, cap.targetPos.y + 115, instrumentalIds); capsuleOptionsMenu.cameras = [funnyCam]; capsuleOptionsMenu.zIndex = 10000; add(capsuleOptionsMenu); @@ -1914,6 +1918,7 @@ class FreeplayState extends MusicBeatSubState public function cleanupCapsuleOptionsMenu():Void { this.busy = false; + letterSort.inputEnabled = true; if (capsuleOptionsMenu != null) { @@ -1927,9 +1932,6 @@ class FreeplayState extends MusicBeatSubState */ function capsuleOnConfirmDefault(cap:SongMenuItem, ?targetInstId:String):Void { - busy = true; - letterSort.inputEnabled = false; - PlayStatePlaylist.isStoryMode = false; var targetSongId:String = cap?.freeplayData?.data.id ?? 'unknown'; @@ -1937,6 +1939,8 @@ class FreeplayState extends MusicBeatSubState if (targetSongNullable == null) { FlxG.log.warn('WARN: could not find song with id (${targetSongId})'); + busy = false; + letterSort.inputEnabled = true; return; } var targetSong:Song = targetSongNullable; @@ -1948,6 +1952,8 @@ class FreeplayState extends MusicBeatSubState if (targetDifficulty == null) { FlxG.log.warn('WARN: could not find difficulty with id (${currentDifficulty})'); + busy = false; + letterSort.inputEnabled = true; return; } From 85608bc31975c7c96995a2f18bb86b204bb76b22 Mon Sep 17 00:00:00 2001 From: Lasercar Date: Mon, 24 Feb 2025 22:25:10 +1000 Subject: [PATCH 2/4] Fixed letter sort animation --- source/funkin/ui/freeplay/LetterSort.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/freeplay/LetterSort.hx b/source/funkin/ui/freeplay/LetterSort.hx index 049e9194aa..7c50dc4420 100644 --- a/source/funkin/ui/freeplay/LetterSort.hx +++ b/source/funkin/ui/freeplay/LetterSort.hx @@ -209,6 +209,9 @@ class FreeplayLetter extends FlxAtlasSprite this.anim.play(animLetters[letterInd] + " move"); this.anim.pause(); curLetter = letterInd; + this.anim.onComplete.add(function() { + this.anim.play(animLetters[curLetter] + " move"); + }); } } @@ -236,7 +239,7 @@ class FreeplayLetter extends FlxAtlasSprite animName = "T move"; } - this.anim.play(animName); + this.anim.play(animName, true); if (curSelection != curLetter) { this.anim.pause(); From 2ac8a5a3890ba4e049b44a319873bea36fb04889 Mon Sep 17 00:00:00 2001 From: Lasercar Date: Mon, 24 Feb 2025 23:25:30 +1000 Subject: [PATCH 3/4] This should fix the squashed capsule text, right? --- source/funkin/ui/freeplay/CapsuleText.hx | 2 ++ source/funkin/ui/freeplay/FreeplayState.hx | 12 ++++++---- source/funkin/ui/freeplay/SongMenuItem.hx | 26 ++++++++++++++++++---- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/source/funkin/ui/freeplay/CapsuleText.hx b/source/funkin/ui/freeplay/CapsuleText.hx index aae72544e5..1c96dbc1ea 100644 --- a/source/funkin/ui/freeplay/CapsuleText.hx +++ b/source/funkin/ui/freeplay/CapsuleText.hx @@ -168,6 +168,8 @@ class CapsuleText extends FlxSpriteGroup public function resetText():Void { + scale.x = 1; + scale.y = 1; if (moveTween != null) moveTween.cancel(); if (moveTimer != null) moveTimer.cancel(); whiteText.offset.x = 0; diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 9920bc76d0..62e3ce1823 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -723,7 +723,7 @@ class FreeplayState extends MusicBeatSubState // Initialize the random capsule, with empty/blank info (which we display once bf/pico does his hand) var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem); - randomCapsule.init(FlxG.width, 0, null, styleData); + randomCapsule.init(FlxG.width, 0, null, styleData, 0); randomCapsule.y = randomCapsule.intendedY(0) + 10; randomCapsule.targetPos.x = randomCapsule.x; randomCapsule.alpha = 0; @@ -751,7 +751,7 @@ class FreeplayState extends MusicBeatSubState var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem); - funnyMenu.init(FlxG.width, 0, tempSong, styleData); + funnyMenu.init(FlxG.width, 0, tempSong, styleData, i + 1); funnyMenu.onConfirm = function() { capsuleOnOpenDefault(funnyMenu); }; @@ -761,7 +761,11 @@ class FreeplayState extends MusicBeatSubState funnyMenu.capsule.alpha = 0.5; funnyMenu.hsvShader = hsvShader; funnyMenu.newText.animation.curAnim.curFrame = 45 - ((i * 4) % 45); - funnyMenu.forcePosition(); + // I would like to use to use the jump in now that it looks better, + // but I still can't because switching from harder to normal difficulties causes the x positions to mess up + /*if (fromCharSelect)*/ funnyMenu.forcePosition(); + /*else + funnyMenu.initJumpIn(0, force); */ grpCapsules.add(funnyMenu); } @@ -2065,7 +2069,7 @@ class FreeplayState extends MusicBeatSubState capsule.selected = index == curSelected + 1; capsule.targetPos.y = capsule.intendedY(index - curSelected); - capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected))); + capsule.targetPos.x = capsule.intendedX(index - curSelected); if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure } diff --git a/source/funkin/ui/freeplay/SongMenuItem.hx b/source/funkin/ui/freeplay/SongMenuItem.hx index 3db958bb53..06f34075a8 100644 --- a/source/funkin/ui/freeplay/SongMenuItem.hx +++ b/source/funkin/ui/freeplay/SongMenuItem.hx @@ -83,6 +83,8 @@ class SongMenuItem extends FlxSpriteGroup var sparkleTimer:FlxTimer; + var index:Int; + public function new(x:Float, y:Float) { super(x, y); @@ -523,17 +525,19 @@ class SongMenuItem extends FlxSpriteGroup spr.visible = value; } - if (value) textAppear(); + textAppear(); updateSelected(); } - public function init(?x:Float, ?y:Float, freeplayData:Null, ?styleData:FreeplayStyle = null):Void + public function init(?x:Float, ?y:Float, freeplayData:Null, ?styleData:FreeplayStyle = null, index:Int = null):Void { if (x != null) this.x = x; if (y != null) this.y = y; this.freeplayData = freeplayData; + if (index != null) this.index = index; + // im so mad i have to do this but im pretty sure with the capsules recycling i cant call the new function properly :/ // if thats possible someone Please change the new function to be something like // capsule.frames = Paths.getSparrowAtlas(styleData == null ? 'freeplay/freeplayCapsule/capsule/freeplayCapsule' : styleData.getCapsuleAssetKey()); thank u luv u @@ -655,13 +659,18 @@ class SongMenuItem extends FlxSpriteGroup capsule.scale.x = xFrames[frameInTypeBeat]; capsule.scale.y = 1 / xFrames[frameInTypeBeat]; - x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))]; + targetPos.x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))]; capsule.scale.x *= realScaled; capsule.scale.y *= realScaled; frameInTypeBeat += 1; } + else if (frameInTypeBeat == xFrames.length) + { + doJumpIn = false; + targetPos.x = intendedX(index); + } } if (doJumpOut) @@ -674,13 +683,17 @@ class SongMenuItem extends FlxSpriteGroup capsule.scale.x = xFrames[frameOutTypeBeat]; capsule.scale.y = 1 / xFrames[frameOutTypeBeat]; - x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))]; + this.x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))]; capsule.scale.x *= realScaled; capsule.scale.y *= realScaled; frameOutTypeBeat += 1; } + else if (frameOutTypeBeat == xFrames.length) + { + doJumpOut = false; + } } if (doLerp) @@ -704,6 +717,11 @@ class SongMenuItem extends FlxSpriteGroup } } + public function intendedX(index:Int):Float + { + return 270 + (60 * (Math.sin(index))); + } + public function intendedY(index:Int):Float { return (index * ((height * realScaled) + 10)) + 120; From 7160eda703b669e50096aaf0fa0667016350b2e0 Mon Sep 17 00:00:00 2001 From: Lasercar Date: Wed, 26 Feb 2025 00:39:03 +1000 Subject: [PATCH 4/4] First rank overrides itself fix --- source/funkin/ui/freeplay/FreeplayState.hx | 4 ++-- source/funkin/ui/freeplay/SongMenuItem.hx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 62e3ce1823..b358a31c6a 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -1748,7 +1748,7 @@ class FreeplayState extends MusicBeatSubState intendedScore = songScore?.score ?? 0; intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes); rememberedDifficulty = currentDifficulty; - grpCapsules.members[curSelected].refreshDisplay(); + grpCapsules.members[curSelected].refreshDisplay((prepForNewRank == true) ? false : true); } else { @@ -2051,7 +2051,7 @@ class FreeplayState extends MusicBeatSubState intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes); rememberedSongId = daSongCapsule.freeplayData.data.id; changeDiff(); - daSongCapsule.refreshDisplay(); + daSongCapsule.refreshDisplay((prepForNewRank == true) ? false : true); } else { diff --git a/source/funkin/ui/freeplay/SongMenuItem.hx b/source/funkin/ui/freeplay/SongMenuItem.hx index 06f34075a8..a9568f1af3 100644 --- a/source/funkin/ui/freeplay/SongMenuItem.hx +++ b/source/funkin/ui/freeplay/SongMenuItem.hx @@ -424,7 +424,7 @@ class SongMenuItem extends FlxSpriteGroup return evilTrail.color; } - public function refreshDisplay():Void + public function refreshDisplay(updateRank:Bool = true):Void { if (freeplayData == null) { @@ -443,7 +443,7 @@ class SongMenuItem extends FlxSpriteGroup pixelIcon.visible = true; updateBPM(Std.int(freeplayData.songStartingBpm) ?? 0); updateDifficultyRating(freeplayData.difficultyRating ?? 0); - updateScoringRank(freeplayData.scoringRank); + if (updateRank) updateScoringRank(freeplayData.scoringRank); newText.visible = freeplayData.isNew; favIcon.visible = freeplayData.isFav; favIconBlurred.visible = freeplayData.isFav;