mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-04-01 23:34:54 +00:00
Merge pull request #605 from FunkinCrew/fabs-final-fixes
Freeplay fixes, + some minor bug fixes
This commit is contained in:
commit
8e6c43b81b
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 68f223f965c60a3874d7842ee2d448eee5afc87b
|
Subproject commit 0062c05d559ae281ce39f8df3da6efb1f92ca808
|
|
@ -91,6 +91,12 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
||||||
return _metadata.keys().array();
|
return _metadata.keys().array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this returns false so that any new song can override this and return true when needed
|
||||||
|
public function isSongNew(currentDifficulty:String):Bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to false if the song was edited in the charter and should not be saved as a high score.
|
* Set to false if the song was edited in the charter and should not be saved as a high score.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -859,6 +859,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
function rankAnimStart(fromResults:Null<FromResultsParams>):Void
|
function rankAnimStart(fromResults:Null<FromResultsParams>):Void
|
||||||
{
|
{
|
||||||
busy = true;
|
busy = true;
|
||||||
|
grpCapsules.members[curSelected].sparkle.alpha = 0;
|
||||||
// grpCapsules.members[curSelected].forcePosition();
|
// grpCapsules.members[curSelected].forcePosition();
|
||||||
|
|
||||||
if (fromResults != null)
|
if (fromResults != null)
|
||||||
|
@ -1088,6 +1089,8 @@ class FreeplayState extends MusicBeatSubState
|
||||||
|
|
||||||
// NOW we can interact with the menu
|
// NOW we can interact with the menu
|
||||||
busy = false;
|
busy = false;
|
||||||
|
grpCapsules.members[curSelected].sparkle.alpha = 0.7;
|
||||||
|
playCurSongPreview(capsule);
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
// FlxTween.tween(capsule, {"targetPos.x": capsule.targetPos.x - 50}, 0.6,
|
// FlxTween.tween(capsule, {"targetPos.x": capsule.targetPos.x - 50}, 0.6,
|
||||||
|
@ -1814,7 +1817,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
|
|
||||||
function changeSelection(change:Int = 0):Void
|
function changeSelection(change:Int = 0):Void
|
||||||
{
|
{
|
||||||
FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
if (!prepForNewRank) FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||||
|
|
||||||
var prevSelected:Int = curSelected;
|
var prevSelected:Int = curSelected;
|
||||||
|
|
||||||
|
@ -1855,43 +1858,48 @@ class FreeplayState extends MusicBeatSubState
|
||||||
if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure
|
if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grpCapsules.countLiving() > 0)
|
if (grpCapsules.countLiving() > 0 && !prepForNewRank)
|
||||||
{
|
{
|
||||||
if (curSelected == 0)
|
playCurSongPreview(daSongCapsule);
|
||||||
{
|
|
||||||
FunkinSound.playMusic('freeplayRandom',
|
|
||||||
{
|
|
||||||
startingVolume: 0.0,
|
|
||||||
overrideExisting: true,
|
|
||||||
restartTrack: false
|
|
||||||
});
|
|
||||||
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var potentiallyErect:String = (currentDifficulty == "erect") || (currentDifficulty == "nightmare") ? "-erect" : "";
|
|
||||||
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
|
||||||
{
|
|
||||||
startingVolume: 0.0,
|
|
||||||
overrideExisting: true,
|
|
||||||
restartTrack: false,
|
|
||||||
pathsFunction: INST,
|
|
||||||
suffix: potentiallyErect,
|
|
||||||
partialParams:
|
|
||||||
{
|
|
||||||
loadPartial: true,
|
|
||||||
start: 0.05,
|
|
||||||
end: 0.25
|
|
||||||
},
|
|
||||||
onLoad: function() {
|
|
||||||
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
grpCapsules.members[curSelected].selected = true;
|
grpCapsules.members[curSelected].selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function playCurSongPreview(daSongCapsule:SongMenuItem):Void
|
||||||
|
{
|
||||||
|
if (curSelected == 0)
|
||||||
|
{
|
||||||
|
FunkinSound.playMusic('freeplayRandom',
|
||||||
|
{
|
||||||
|
startingVolume: 0.0,
|
||||||
|
overrideExisting: true,
|
||||||
|
restartTrack: false
|
||||||
|
});
|
||||||
|
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var potentiallyErect:String = (currentDifficulty == "erect") || (currentDifficulty == "nightmare") ? "-erect" : "";
|
||||||
|
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
||||||
|
{
|
||||||
|
startingVolume: 0.0,
|
||||||
|
overrideExisting: true,
|
||||||
|
restartTrack: false,
|
||||||
|
pathsFunction: INST,
|
||||||
|
suffix: potentiallyErect,
|
||||||
|
partialParams:
|
||||||
|
{
|
||||||
|
loadPartial: true,
|
||||||
|
start: 0.05,
|
||||||
|
end: 0.25
|
||||||
|
},
|
||||||
|
onLoad: function() {
|
||||||
|
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an instance of `FreeplayState` that is above the `MainMenuState`.
|
* Build an instance of `FreeplayState` that is above the `MainMenuState`.
|
||||||
* @return The MainMenuState with the FreeplayState as a substate.
|
* @return The MainMenuState with the FreeplayState as a substate.
|
||||||
|
@ -2004,6 +2012,8 @@ class FreeplaySongData
|
||||||
*/
|
*/
|
||||||
public var isFav:Bool = false;
|
public var isFav:Bool = false;
|
||||||
|
|
||||||
|
public var isNew:Bool = false;
|
||||||
|
|
||||||
var song:Song;
|
var song:Song;
|
||||||
|
|
||||||
public var levelId(default, null):String = '';
|
public var levelId(default, null):String = '';
|
||||||
|
@ -2083,6 +2093,8 @@ class FreeplaySongData
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scoringRank = Save.instance.getSongRank(songId, currentDifficulty);
|
this.scoringRank = Save.instance.getSongRank(songId, currentDifficulty);
|
||||||
|
|
||||||
|
this.isNew = song.isSongNew(currentDifficulty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import flixel.tweens.FlxEase;
|
||||||
import flixel.tweens.FlxTween;
|
import flixel.tweens.FlxTween;
|
||||||
import flixel.addons.effects.FlxTrail;
|
import flixel.addons.effects.FlxTrail;
|
||||||
import funkin.play.scoring.Scoring.ScoringRank;
|
import funkin.play.scoring.Scoring.ScoringRank;
|
||||||
|
import funkin.save.Save;
|
||||||
|
import funkin.save.Save.SaveScoreData;
|
||||||
import flixel.util.FlxColor;
|
import flixel.util.FlxColor;
|
||||||
|
|
||||||
class SongMenuItem extends FlxSpriteGroup
|
class SongMenuItem extends FlxSpriteGroup
|
||||||
|
@ -76,6 +78,10 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
|
|
||||||
var impactThing:FunkinSprite;
|
var impactThing:FunkinSprite;
|
||||||
|
|
||||||
|
public var sparkle:FlxSprite;
|
||||||
|
|
||||||
|
var sparkleTimer:FlxTimer;
|
||||||
|
|
||||||
public function new(x:Float, y:Float)
|
public function new(x:Float, y:Float)
|
||||||
{
|
{
|
||||||
super(x, y);
|
super(x, y);
|
||||||
|
@ -110,7 +116,7 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
newText.animation.play('newAnim', true);
|
newText.animation.play('newAnim', true);
|
||||||
newText.setGraphicSize(Std.int(newText.width * 0.9));
|
newText.setGraphicSize(Std.int(newText.width * 0.9));
|
||||||
|
|
||||||
newText.visible = false;
|
// newText.visible = false;
|
||||||
|
|
||||||
add(newText);
|
add(newText);
|
||||||
|
|
||||||
|
@ -153,6 +159,18 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
blurredRanking.shader = new GaussianBlurShader(1);
|
blurredRanking.shader = new GaussianBlurShader(1);
|
||||||
add(blurredRanking);
|
add(blurredRanking);
|
||||||
|
|
||||||
|
sparkle = new FlxSprite(ranking.x, ranking.y);
|
||||||
|
sparkle.frames = Paths.getSparrowAtlas('freeplay/sparkle');
|
||||||
|
sparkle.animation.addByPrefix('sparkle', 'sparkle', 24, false);
|
||||||
|
sparkle.animation.play('sparkle', true);
|
||||||
|
sparkle.scale.set(0.8, 0.8);
|
||||||
|
sparkle.blend = BlendMode.ADD;
|
||||||
|
|
||||||
|
sparkle.visible = false;
|
||||||
|
sparkle.alpha = 0.7;
|
||||||
|
|
||||||
|
add(sparkle);
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -218,6 +236,13 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
setVisibleGrp(false);
|
setVisibleGrp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sparkleEffect(timer:FlxTimer):Void
|
||||||
|
{
|
||||||
|
sparkle.setPosition(FlxG.random.float(ranking.x - 20, ranking.x + 3), FlxG.random.float(ranking.y - 29, ranking.y + 4));
|
||||||
|
sparkle.animation.play('sparkle', true);
|
||||||
|
sparkleTimer = new FlxTimer().start(FlxG.random.float(1.2, 4.5), sparkleEffect);
|
||||||
|
}
|
||||||
|
|
||||||
// no way to grab weeks rn, so this needs to be done :/
|
// no way to grab weeks rn, so this needs to be done :/
|
||||||
// negative values mean weekends
|
// negative values mean weekends
|
||||||
function checkWeek(name:String):Void
|
function checkWeek(name:String):Void
|
||||||
|
@ -415,8 +440,17 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
|
|
||||||
function updateScoringRank(newRank:Null<ScoringRank>):Void
|
function updateScoringRank(newRank:Null<ScoringRank>):Void
|
||||||
{
|
{
|
||||||
|
if (sparkleTimer != null) sparkleTimer.cancel();
|
||||||
|
sparkle.visible = false;
|
||||||
|
|
||||||
this.ranking.rank = newRank;
|
this.ranking.rank = newRank;
|
||||||
this.blurredRanking.rank = newRank;
|
this.blurredRanking.rank = newRank;
|
||||||
|
|
||||||
|
if (newRank == PERFECT_GOLD)
|
||||||
|
{
|
||||||
|
sparkleTimer = new FlxTimer().start(1, sparkleEffect);
|
||||||
|
sparkle.visible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_hsvShader(value:HSVShader):HSVShader
|
function set_hsvShader(value:HSVShader):HSVShader
|
||||||
|
@ -468,6 +502,7 @@ class SongMenuItem extends FlxSpriteGroup
|
||||||
updateBPM(Std.int(songData?.songStartingBpm) ?? 0);
|
updateBPM(Std.int(songData?.songStartingBpm) ?? 0);
|
||||||
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
updateDifficultyRating(songData?.difficultyRating ?? 0);
|
||||||
updateScoringRank(songData?.scoringRank);
|
updateScoringRank(songData?.scoringRank);
|
||||||
|
newText.visible = songData?.isNew;
|
||||||
// Update opacity, offsets, etc.
|
// Update opacity, offsets, etc.
|
||||||
updateSelected();
|
updateSelected();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue