1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

Merge pull request #591 from FunkinCrew/rank-fixes

Freeplay rank fixes + freeplay rank cutscene fixes
This commit is contained in:
Cameron Taylor 2024-06-02 02:20:15 -04:00 committed by GitHub
commit 0346c3767e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 343 additions and 63 deletions

2
assets

@ -1 +1 @@
Subproject commit 3bfa4e3da87713ea651f60d4f898c283e5d86093 Subproject commit d9ea5ebe5e4db8584a8b1e1e16820b4d1527794c

View file

@ -359,7 +359,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
if (shouldLoadPartial) if (shouldLoadPartial)
{ {
var music = FunkinSound.loadPartial(pathToUse, params.partialParams?.start ?? 0, params.partialParams?.end ?? 1, params?.startingVolume ?? 1.0, var music = FunkinSound.loadPartial(pathToUse, params.partialParams?.start ?? 0.0, params.partialParams?.end ?? 1.0, params?.startingVolume ?? 1.0,
params.loop ?? true, false, false, params.onComplete); params.loop ?? true, false, false, params.onComplete);
if (music != null) if (music != null)

View file

@ -61,6 +61,7 @@ class ResultState extends MusicBeatSubState
var gfGood:Null<FlxSprite> = null; var gfGood:Null<FlxSprite> = null;
var bfShit:Null<FlxAtlasSprite> = null; var bfShit:Null<FlxAtlasSprite> = null;
var rankBg:FunkinSprite;
final cameraBG:FunkinCamera; final cameraBG:FunkinCamera;
final cameraScroll:FunkinCamera; final cameraScroll:FunkinCamera;
final cameraEverything:FunkinCamera; final cameraEverything:FunkinCamera;
@ -105,6 +106,8 @@ class ResultState extends MusicBeatSubState
highscoreNew = new FlxSprite(310, 570); highscoreNew = new FlxSprite(310, 570);
score = new ResultScore(35, 305, 10, params.scoreData.score); score = new ResultScore(35, 305, 10, params.scoreData.score);
rankBg = new FunkinSprite(0, 0);
} }
override function create():Void override function create():Void
@ -382,6 +385,12 @@ class ResultState extends MusicBeatSubState
} }
}); });
rankBg.makeSolidColor(FlxG.width, FlxG.height, 0xFF000000);
rankBg.zIndex = 99999;
add(rankBg);
rankBg.alpha = 0;
refresh(); refresh();
super.create(); super.create();
@ -691,18 +700,48 @@ class ResultState extends MusicBeatSubState
} }
else else
{ {
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build( var rigged:Bool = true;
{ if (rank > Scoring.calculateRank(params?.prevScoreData)) // if (rigged)
{
trace('THE RANK IS Higher.....');
FlxTween.tween(rankBg, {alpha: 1}, 0.5,
{ {
fromResults: ease: FlxEase.expoOut,
{ onComplete: function(_) {
oldRank: Scoring.calculateRank(params?.prevScoreData), FlxG.switchState(FreeplayState.build(
newRank: rank, {
songId: params.songId, {
difficultyId: params.difficultyId fromResults:
} {
} oldRank: Scoring.calculateRank(params?.prevScoreData),
}, sticker))); newRank: rank,
songId: params.songId,
difficultyId: params.difficultyId,
playRankAnim: true
}
}
}));
}
});
}
else
{
trace('rank is lower...... and/or equal');
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(
{
{
fromResults:
{
oldRank: null,
playRankAnim: false,
newRank: rank,
songId: params.songId,
difficultyId: params.difficultyId
}
}
}, sticker)));
}
} }
} }

View file

@ -349,7 +349,7 @@ class Scoring
public static function calculateRank(scoreData:Null<SaveScoreData>):Null<ScoringRank> public static function calculateRank(scoreData:Null<SaveScoreData>):Null<ScoringRank>
{ {
if (scoreData == null) return null; if (scoreData?.tallies.totalNotes == 0 || scoreData == null) return null;
// we can return null here, meaning that the player hasn't actually played and finished the song (thus has no data) // we can return null here, meaning that the player hasn't actually played and finished the song (thus has no data)
if (scoreData.tallies.totalNotes == 0) return null; if (scoreData.tallies.totalNotes == 0) return null;
@ -397,6 +397,62 @@ enum abstract ScoringRank(String)
var GOOD; var GOOD;
var SHIT; var SHIT;
@:op(A > B) static function compare(a:Null<ScoringRank>, b:Null<ScoringRank>):Bool
{
if (a != null && b == null) return true;
if (a == null || b == null) return false;
var temp1:Int = 0;
var temp2:Int = 0;
// temp 1
switch (a)
{
case PERFECT_GOLD:
temp1 = 5;
case PERFECT:
temp1 = 4;
case EXCELLENT:
temp1 = 3;
case GREAT:
temp1 = 2;
case GOOD:
temp1 = 1;
case SHIT:
temp1 = 0;
default:
temp1 = -1;
}
// temp 2
switch (b)
{
case PERFECT_GOLD:
temp2 = 5;
case PERFECT:
temp2 = 4;
case EXCELLENT:
temp2 = 3;
case GREAT:
temp2 = 2;
case GOOD:
temp2 = 1;
case SHIT:
temp2 = 0;
default:
temp2 = -1;
}
if (temp1 > temp2)
{
return true;
}
else
{
return false;
}
}
/** /**
* Delay in seconds * Delay in seconds
*/ */

View file

@ -4,6 +4,7 @@ import flixel.text.FlxText;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import funkin.audio.FunkinSound; import funkin.audio.FunkinSound;
import flixel.FlxSprite; import flixel.FlxSprite;
import funkin.ui.mainmenu.MainMenuState;
import flixel.group.FlxSpriteGroup; import flixel.group.FlxSpriteGroup;
/** /**
@ -199,7 +200,7 @@ class CreditsState extends MusicBeatState
function exit():Void function exit():Void
{ {
FlxG.switchState(funkin.ui.mainmenu.MainMenuState.new); FlxG.switchState(() -> new MainMenuState());
} }
public override function destroy():Void public override function destroy():Void

View file

@ -131,7 +131,7 @@ class AlbumRoll extends FlxSpriteGroup
if (exitMovers == null) return; if (exitMovers == null) return;
exitMovers.set([newAlbumArt], exitMovers.set([newAlbumArt, difficultyStars],
{ {
x: FlxG.width, x: FlxG.width,
speed: 0.4, speed: 0.4,

View file

@ -6,6 +6,7 @@ import flixel.addons.ui.FlxInputText;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.group.FlxGroup; import flixel.group.FlxGroup;
import funkin.graphics.shaders.GaussianBlurShader;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
import flixel.input.touch.FlxTouch; import flixel.input.touch.FlxTouch;
@ -45,6 +46,7 @@ import funkin.util.MathUtil;
import lime.utils.Assets; import lime.utils.Assets;
import flixel.tweens.misc.ShakeTween; import flixel.tweens.misc.ShakeTween;
import funkin.effects.IntervalShake; import funkin.effects.IntervalShake;
import funkin.ui.freeplay.SongMenuItem.FreeplayRank;
/** /**
* Parameters used to initialize the FreeplayState. * Parameters used to initialize the FreeplayState.
@ -66,6 +68,11 @@ typedef FromResultsParams =
*/ */
var ?oldRank:ScoringRank; var ?oldRank:ScoringRank;
/**
* Whether or not to play the rank animation on returning to freeplay.
*/
var playRankAnim:Bool;
/** /**
* The new rank the song has. * The new rank the song has.
*/ */
@ -194,12 +201,19 @@ class FreeplayState extends MusicBeatSubState
var fromResultsParams:Null<FromResultsParams> = null; var fromResultsParams:Null<FromResultsParams> = null;
var prepForNewRank:Bool = false;
public function new(?params:FreeplayStateParams, ?stickers:StickerSubState) public function new(?params:FreeplayStateParams, ?stickers:StickerSubState)
{ {
currentCharacter = params?.character ?? Constants.DEFAULT_CHARACTER; currentCharacter = params?.character ?? Constants.DEFAULT_CHARACTER;
fromResultsParams = params?.fromResults; fromResultsParams = params?.fromResults;
if (fromResultsParams?.playRankAnim == true)
{
prepForNewRank = true;
}
if (stickers != null) if (stickers != null)
{ {
stickerSubState = stickers; stickerSubState = stickers;
@ -236,11 +250,14 @@ class FreeplayState extends MusicBeatSubState
isDebug = true; isDebug = true;
#end #end
FunkinSound.playMusic('freakyMenu', if (prepForNewRank == false)
{ {
overrideExisting: true, FunkinSound.playMusic('freakyMenu',
restartTrack: false {
}); overrideExisting: true,
restartTrack: false
});
}
// Add a null entry that represents the RANDOM option // Add a null entry that represents the RANDOM option
songs.push(null); songs.push(null);
@ -638,7 +655,7 @@ class FreeplayState extends MusicBeatSubState
cardGlow.visible = true; cardGlow.visible = true;
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.45, {ease: FlxEase.sineOut}); FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.45, {ease: FlxEase.sineOut});
if (fromResultsParams != null) if (prepForNewRank == true)
{ {
rankAnimStart(fromResultsParams); rankAnimStart(fromResultsParams);
} }
@ -668,6 +685,11 @@ class FreeplayState extends MusicBeatSubState
FlxG.cameras.add(rankCamera, false); FlxG.cameras.add(rankCamera, false);
rankBg.cameras = [rankCamera]; rankBg.cameras = [rankCamera];
rankBg.alpha = 0; rankBg.alpha = 0;
if (prepForNewRank == true)
{
rankCamera.fade(0xFF000000, 0, false, null, true);
}
} }
var currentFilter:SongFilter = null; var currentFilter:SongFilter = null;
@ -818,9 +840,13 @@ class FreeplayState extends MusicBeatSubState
return songsToFilter; return songsToFilter;
} }
var sparks:FlxSprite;
var sparksADD:FlxSprite;
function rankAnimStart(fromResults:Null<FromResultsParams>):Void function rankAnimStart(fromResults:Null<FromResultsParams>):Void
{ {
busy = true; busy = true;
// grpCapsules.members[curSelected].forcePosition();
if (fromResults != null) if (fromResults != null)
{ {
@ -836,11 +862,60 @@ class FreeplayState extends MusicBeatSubState
if (FlxG.sound.music != null) FlxG.sound.music.volume = 0; if (FlxG.sound.music != null) FlxG.sound.music.volume = 0;
rankBg.alpha = 1; rankBg.alpha = 1;
originalPos.x = grpCapsules.members[curSelected].x; if (fromResults?.oldRank != null)
originalPos.y = grpCapsules.members[curSelected].y; {
grpCapsules.members[curSelected].fakeRanking.rank = fromResults.oldRank;
grpCapsules.members[curSelected].fakeBlurredRanking.rank = fromResults.oldRank;
grpCapsules.members[curSelected].ranking.alpha = 0; sparks = new FlxSprite(0, 0);
grpCapsules.members[curSelected].blurredRanking.alpha = 0; sparks.frames = Paths.getSparrowAtlas('freeplay/sparks');
sparks.animation.addByPrefix('sparks', 'sparks', 24, false);
sparks.visible = false;
sparks.blend = BlendMode.ADD;
sparks.setPosition(517, 134);
sparks.scale.set(0.5, 0.5);
add(sparks);
sparks.cameras = [rankCamera];
sparksADD = new FlxSprite(0, 0);
sparksADD.visible = false;
sparksADD.frames = Paths.getSparrowAtlas('freeplay/sparksadd');
sparksADD.animation.addByPrefix('sparks add', 'sparks add', 24, false);
sparksADD.setPosition(498, 116);
sparksADD.blend = BlendMode.ADD;
sparksADD.scale.set(0.5, 0.5);
add(sparksADD);
sparksADD.cameras = [rankCamera];
switch (fromResults.oldRank)
{
case SHIT:
sparksADD.color = 0xFF6044FF;
case GOOD:
sparksADD.color = 0xFFEF8764;
case GREAT:
sparksADD.color = 0xFFEAF6FF;
case EXCELLENT:
sparksADD.color = 0xFFFDCB42;
case PERFECT:
sparksADD.color = 0xFFFF58B4;
case PERFECT_GOLD:
sparksADD.color = 0xFFFFB619;
}
// sparksADD.color = sparks.color;
}
grpCapsules.members[curSelected].doLerp = false;
// originalPos.x = grpCapsules.members[curSelected].x;
// originalPos.y = grpCapsules.members[curSelected].y;
originalPos.x = 320.488;
originalPos.y = 235.6;
trace(originalPos);
grpCapsules.members[curSelected].ranking.visible = false;
grpCapsules.members[curSelected].blurredRanking.visible = false;
rankCamera.zoom = 1.85; rankCamera.zoom = 1.85;
FlxTween.tween(rankCamera, {"zoom": 1.8}, 0.6, {ease: FlxEase.sineIn}); FlxTween.tween(rankCamera, {"zoom": 1.8}, 0.6, {ease: FlxEase.sineIn});
@ -849,20 +924,21 @@ class FreeplayState extends MusicBeatSubState
FlxTween.tween(funnyCam, {"zoom": 1.1}, 0.6, {ease: FlxEase.sineIn}); FlxTween.tween(funnyCam, {"zoom": 1.1}, 0.6, {ease: FlxEase.sineIn});
grpCapsules.members[curSelected].cameras = [rankCamera]; grpCapsules.members[curSelected].cameras = [rankCamera];
grpCapsules.members[curSelected].targetPos.set((FlxG.width / 2) - (grpCapsules.members[curSelected].width / 2), // grpCapsules.members[curSelected].targetPos.set((FlxG.width / 2) - (grpCapsules.members[curSelected].width / 2),
// (FlxG.height / 2) - (grpCapsules.members[curSelected].height / 2));
grpCapsules.members[curSelected].setPosition((FlxG.width / 2) - (grpCapsules.members[curSelected].width / 2),
(FlxG.height / 2) - (grpCapsules.members[curSelected].height / 2)); (FlxG.height / 2) - (grpCapsules.members[curSelected].height / 2));
new FlxTimer().start(0.5, _ -> { new FlxTimer().start(0.5, _ -> {
grpCapsules.members[curSelected].doLerp = false;
rankDisplayNew(fromResults); rankDisplayNew(fromResults);
}); });
} }
function rankDisplayNew(fromResults:Null<FromResultsParams>):Void function rankDisplayNew(fromResults:Null<FromResultsParams>):Void
{ {
grpCapsules.members[curSelected].ranking.alpha = 1; grpCapsules.members[curSelected].ranking.visible = true;
grpCapsules.members[curSelected].blurredRanking.alpha = 1; grpCapsules.members[curSelected].blurredRanking.visible = true;
grpCapsules.members[curSelected].ranking.scale.set(20, 20); grpCapsules.members[curSelected].ranking.scale.set(20, 20);
grpCapsules.members[curSelected].blurredRanking.scale.set(20, 20); grpCapsules.members[curSelected].blurredRanking.scale.set(20, 20);
@ -875,7 +951,23 @@ class FreeplayState extends MusicBeatSubState
FlxTween.tween(grpCapsules.members[curSelected].blurredRanking, {"scale.x": 1, "scale.y": 1}, 0.1); FlxTween.tween(grpCapsules.members[curSelected].blurredRanking, {"scale.x": 1, "scale.y": 1}, 0.1);
new FlxTimer().start(0.1, _ -> { new FlxTimer().start(0.1, _ -> {
trace(grpCapsules.members[curSelected].ranking.rank); // trace(grpCapsules.members[curSelected].ranking.rank);
if (fromResults?.oldRank != null)
{
grpCapsules.members[curSelected].fakeRanking.visible = false;
grpCapsules.members[curSelected].fakeBlurredRanking.visible = false;
sparks.visible = true;
sparksADD.visible = true;
sparks.animation.play('sparks', true);
sparksADD.animation.play('sparks add', true);
sparks.animation.finishCallback = anim -> {
sparks.visible = false;
sparksADD.visible = false;
};
}
switch (fromResultsParams?.newRank) switch (fromResultsParams?.newRank)
{ {
case SHIT: case SHIT:
@ -1031,7 +1123,7 @@ class FreeplayState extends MusicBeatSubState
new FlxTimer().start(2, _ -> { new FlxTimer().start(2, _ -> {
// dj.fistPump(); // dj.fistPump();
FlxG.sound.music.fadeIn(4.0, 0.0, 1.0); prepForNewRank = false;
}); });
} }
@ -1066,39 +1158,60 @@ class FreeplayState extends MusicBeatSubState
rankAnimStart(fromResultsParams); rankAnimStart(fromResultsParams);
} }
if (FlxG.keys.justPressed.H) // if (FlxG.keys.justPressed.H)
{ // {
rankDisplayNew(fromResultsParams); // rankDisplayNew(fromResultsParams);
} // }
// if (FlxG.keys.justPressed.G)
// {
// rankAnimSlam(fromResultsParams);
// }
if (FlxG.keys.justPressed.G) if (FlxG.keys.justPressed.G)
{ {
rankAnimSlam(fromResultsParams); sparks.y -= 2;
trace(sparks.x, sparks.y);
}
if (FlxG.keys.justPressed.V)
{
sparks.x -= 2;
trace(sparks.x, sparks.y);
}
if (FlxG.keys.justPressed.N)
{
sparks.x += 2;
trace(sparks.x, sparks.y);
}
if (FlxG.keys.justPressed.B)
{
sparks.y += 2;
trace(sparks.x, sparks.y);
} }
if (FlxG.keys.justPressed.I) if (FlxG.keys.justPressed.I)
{ {
confirmTextGlow.y -= 1; sparksADD.y -= 2;
trace(confirmTextGlow.x, confirmTextGlow.y); trace(sparksADD.x, sparksADD.y);
} }
if (FlxG.keys.justPressed.J) if (FlxG.keys.justPressed.J)
{ {
confirmTextGlow.x -= 1; sparksADD.x -= 2;
trace(confirmTextGlow.x, confirmTextGlow.y); trace(sparksADD.x, sparksADD.y);
} }
if (FlxG.keys.justPressed.L) if (FlxG.keys.justPressed.L)
{ {
confirmTextGlow.x += 1; sparksADD.x += 2;
trace(confirmTextGlow.x, confirmTextGlow.y); trace(sparksADD.x, sparksADD.y);
} }
if (FlxG.keys.justPressed.K) if (FlxG.keys.justPressed.K)
{ {
confirmTextGlow.y += 1; sparksADD.y += 2;
trace(confirmTextGlow.x, confirmTextGlow.y); trace(sparksADD.x, sparksADD.y);
} }
#end #end
if (FlxG.keys.justPressed.F) if (FlxG.keys.justPressed.F && !busy)
{ {
var targetSong = grpCapsules.members[curSelected]?.songData; var targetSong = grpCapsules.members[curSelected]?.songData;
if (targetSong != null) if (targetSong != null)
@ -1107,24 +1220,45 @@ class FreeplayState extends MusicBeatSubState
var isFav = targetSong.toggleFavorite(); var isFav = targetSong.toggleFavorite();
if (isFav) if (isFav)
{ {
FlxTween.tween(grpCapsules.members[realShit], {angle: 360}, 0.4, grpCapsules.members[realShit].favIcon.visible = true;
grpCapsules.members[realShit].favIcon.animation.play('fav');
FunkinSound.playOnce(Paths.sound('fav'), 1);
busy = true;
grpCapsules.members[realShit].doLerp = false;
FlxTween.tween(grpCapsules.members[realShit], {y: grpCapsules.members[realShit].y - 5}, 0.1, {ease: FlxEase.expoOut});
FlxTween.tween(grpCapsules.members[realShit], {y: grpCapsules.members[realShit].y + 5}, 0.1,
{ {
ease: FlxEase.elasticOut, ease: FlxEase.expoIn,
onComplete: _ -> { startDelay: 0.1,
grpCapsules.members[realShit].favIcon.visible = true; onComplete: function(_) {
grpCapsules.members[realShit].favIcon.animation.play('fav'); grpCapsules.members[realShit].doLerp = true;
busy = false;
} }
}); });
} }
else else
{ {
grpCapsules.members[realShit].favIcon.animation.play('fav', false, true); grpCapsules.members[realShit].favIcon.animation.play('fav', true, true, 9);
new FlxTimer().start((1 / 24) * 14, _ -> { FunkinSound.playOnce(Paths.sound('unfav'), 1);
new FlxTimer().start(0.2, _ -> {
grpCapsules.members[realShit].favIcon.visible = false; grpCapsules.members[realShit].favIcon.visible = false;
}); });
new FlxTimer().start((1 / 24) * 24, _ -> {
FlxTween.tween(grpCapsules.members[realShit], {angle: 0}, 0.4, {ease: FlxEase.elasticOut}); busy = true;
}); grpCapsules.members[realShit].doLerp = false;
FlxTween.tween(grpCapsules.members[realShit], {y: grpCapsules.members[realShit].y + 5}, 0.1, {ease: FlxEase.expoOut});
FlxTween.tween(grpCapsules.members[realShit], {y: grpCapsules.members[realShit].y - 5}, 0.1,
{
ease: FlxEase.expoIn,
startDelay: 0.1,
onComplete: function(_) {
grpCapsules.members[realShit].doLerp = true;
busy = false;
}
});
} }
} }
} }
@ -1328,6 +1462,24 @@ class FreeplayState extends MusicBeatSubState
var longestTimer:Float = 0; var longestTimer:Float = 0;
// FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut});
FlxTween.color(pinkBack, 0.25, 0xFFFFD863, 0xFFFFD0D5, {ease: FlxEase.quadOut});
cardGlow.visible = true;
cardGlow.alpha = 1;
cardGlow.scale.set(1, 1);
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.25, {ease: FlxEase.sineOut});
orangeBackShit.visible = false;
alsoOrangeLOL.visible = false;
moreWays.visible = false;
funnyScroll.visible = false;
txtNuts.visible = false;
funnyScroll2.visible = false;
moreWays2.visible = false;
funnyScroll3.visible = false;
for (grpSpr in exitMovers.keys()) for (grpSpr in exitMovers.keys())
{ {
var moveData:MoveData = exitMovers.get(grpSpr); var moveData:MoveData = exitMovers.get(grpSpr);
@ -1372,6 +1524,7 @@ class FreeplayState extends MusicBeatSubState
overrideExisting: true, overrideExisting: true,
restartTrack: false restartTrack: false
}); });
FlxG.sound.music.fadeIn(4.0, 0.0, 1.0);
close(); close();
} }
else else
@ -1558,6 +1711,7 @@ class FreeplayState extends MusicBeatSubState
FunkinSound.playOnce(Paths.sound('confirmMenu')); FunkinSound.playOnce(Paths.sound('confirmMenu'));
dj.confirm(); dj.confirm();
grpCapsules.members[curSelected].forcePosition();
grpCapsules.members[curSelected].songText.flickerText(); grpCapsules.members[curSelected].songText.flickerText();
// FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut}); // FlxTween.color(bgDad, 0.33, 0xFFFFFFFF, 0xFF555555, {ease: FlxEase.quadOut});
@ -1686,7 +1840,7 @@ class FreeplayState extends MusicBeatSubState
{ {
startingVolume: 0.0, startingVolume: 0.0,
overrideExisting: true, overrideExisting: true,
restartTrack: true restartTrack: false
}); });
FlxG.sound.music.fadeIn(2, 0, 0.8); FlxG.sound.music.fadeIn(2, 0, 0.8);
} }
@ -1721,7 +1875,10 @@ class FreeplayState extends MusicBeatSubState
*/ */
public static function build(?params:FreeplayStateParams, ?stickers:StickerSubState):MusicBeatState public static function build(?params:FreeplayStateParams, ?stickers:StickerSubState):MusicBeatState
{ {
var result = new MainMenuState(); var result:MainMenuState;
if (params?.fromResults.playRankAnim) result = new MainMenuState(true);
else
result = new MainMenuState(false);
result.openSubState(new FreeplayState(params, stickers)); result.openSubState(new FreeplayState(params, stickers));
result.persistentUpdate = false; result.persistentUpdate = false;

View file

@ -39,9 +39,13 @@ class SongMenuItem extends FlxSpriteGroup
public var songText:CapsuleText; public var songText:CapsuleText;
public var favIcon:FlxSprite; public var favIcon:FlxSprite;
public var ranking:FreeplayRank; public var ranking:FreeplayRank;
public var blurredRanking:FreeplayRank; public var blurredRanking:FreeplayRank;
public var fakeRanking:FreeplayRank;
public var fakeBlurredRanking:FreeplayRank;
var ranks:Array<String> = ["fail", "average", "great", "excellent", "perfect", "perfectsick"]; var ranks:Array<String> = ["fail", "average", "great", "excellent", "perfect", "perfectsick"];
public var targetPos:FlxPoint = new FlxPoint(); public var targetPos:FlxPoint = new FlxPoint();
@ -131,12 +135,23 @@ class SongMenuItem extends FlxSpriteGroup
// doesn't get added, simply is here to help with visibility of things for the pop in! // doesn't get added, simply is here to help with visibility of things for the pop in!
grpHide = new FlxGroup(); grpHide = new FlxGroup();
fakeRanking = new FreeplayRank(420, 41);
add(fakeRanking);
fakeBlurredRanking = new FreeplayRank(fakeRanking.x, fakeRanking.y);
fakeBlurredRanking.shader = new GaussianBlurShader(1);
add(fakeBlurredRanking);
fakeRanking.visible = false;
fakeBlurredRanking.visible = false;
ranking = new FreeplayRank(420, 41); ranking = new FreeplayRank(420, 41);
add(ranking); add(ranking);
blurredRanking = new FreeplayRank(ranking.x, ranking.y); blurredRanking = new FreeplayRank(ranking.x, ranking.y);
blurredRanking.shader = new GaussianBlurShader(1); blurredRanking.shader = new GaussianBlurShader(1);
add(blurredRanking); add(blurredRanking);
// ranking.loadGraphic(Paths.image('freeplay/ranks/' + rank)); // ranking.loadGraphic(Paths.image('freeplay/ranks/' + rank));
// ranking.scale.x = ranking.scale.y = realScaled; // ranking.scale.x = ranking.scale.y = realScaled;
// ranking.alpha = 0.75; // ranking.alpha = 0.75;
@ -369,7 +384,7 @@ class SongMenuItem extends FlxSpriteGroup
switch (i) switch (i)
{ {
case 0: case 0:
if (newRating > 10) if (newRating < 10)
{ {
bigNumbers[i].digit = 0; bigNumbers[i].digit = 0;
} }
@ -675,7 +690,7 @@ class FreeplayRank extends FlxSprite
{ {
rank = val; rank = val;
if (rank == null) if (rank == null || val == null)
{ {
this.visible = false; this.visible = false;
} }
@ -685,6 +700,8 @@ class FreeplayRank extends FlxSprite
animation.play(val.getFreeplayRankIconAsset(), true, false); animation.play(val.getFreeplayRankIconAsset(), true, false);
trace(val.getFreeplayRankIconAsset());
centerOffsets(false); centerOffsets(false);
switch (val) switch (val)
@ -705,6 +722,7 @@ class FreeplayRank extends FlxSprite
// offset.y += 5; // offset.y += 5;
default: default:
centerOffsets(false); centerOffsets(false);
this.visible = false;
} }
updateHitbox(); updateHitbox();
} }

View file

@ -42,6 +42,15 @@ class MainMenuState extends MusicBeatState
var magenta:FlxSprite; var magenta:FlxSprite;
var camFollow:FlxObject; var camFollow:FlxObject;
var overrideMusic:Bool = false;
public function new(?_overrideMusic:Bool = false)
{
super();
overrideMusic = _overrideMusic;
}
override function create():Void override function create():Void
{ {
#if discord_rpc #if discord_rpc
@ -54,7 +63,7 @@ class MainMenuState extends MusicBeatState
transIn = FlxTransitionableState.defaultTransIn; transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut; transOut = FlxTransitionableState.defaultTransOut;
playMenuMusic(); if(overrideMusic == false) playMenuMusic();
// We want the state to always be able to begin with being able to accept inputs and show the anims of the menu items. // We want the state to always be able to begin with being able to accept inputs and show the anims of the menu items.
persistentUpdate = true; persistentUpdate = true;
@ -163,7 +172,7 @@ class MainMenuState extends MusicBeatState
function playMenuMusic():Void function playMenuMusic():Void
{ {
FunkinSound.playMusic('freakyMenu', FunkinSound.playMusic('freakyMenu',
{ {
overrideExisting: true, overrideExisting: true,
restartTrack: false restartTrack: false