Merge branch 'rewrite/master' into bugfix/html5-save-data

This commit is contained in:
EliteMasterEric 2024-05-28 01:34:16 -04:00
commit 3f9d8ccda9
11 changed files with 309 additions and 160 deletions

9
.vscode/launch.json vendored
View file

@ -3,10 +3,17 @@
"configurations": [
{
// Launch in native/CPP on Windows/OSX/Linux
"name": "Lime",
"name": "Lime Build+Debug",
"type": "lime",
"request": "launch"
},
{
// Launch in native/CPP on Windows/OSX/Linux
"name": "Lime Debug (No Build)",
"type": "lime",
"request": "launch",
"preLaunchTask": null
},
{
// Launch in browser
"name": "HTML5 Debug",

View file

@ -155,6 +155,11 @@
"target": "hl",
"args": ["-debug", "-DDIALOGUE"]
},
{
"label": "Windows / Debug (Results Screen Test)",
"target": "windows",
"args": ["-debug", "-DRESULTS"]
},
{
"label": "Windows / Debug (Straight to Chart Editor)",
"target": "windows",

2
assets

@ -1 +1 @@
Subproject commit fd112e293ee0f823ee98d5b8bd8a85e934f772f6
Subproject commit ce7dabffbebc154c9dda1f01e92dbef83e3405ab

View file

@ -214,6 +214,30 @@ class InitState extends FlxState
#elseif STAGEBUILD
// -DSTAGEBUILD
FlxG.switchState(() -> new funkin.ui.debug.stage.StageBuilderState());
#elseif RESULTS
// -DRESULTS
FlxG.switchState(() -> new funkin.play.ResultState(
{
storyMode: false,
title: "CUM SONG",
isNewHighscore: true,
scoreData:
{
score: 1_234_567,
tallies:
{
sick: 130,
good: 69,
bad: 69,
shit: 69,
missed: 69,
combo: 69,
maxCombo: 69,
totalNotesHit: 140,
totalNotes: 2000,
}
},
}));
#elseif ANIMDEBUG
// -DANIMDEBUG
FlxG.switchState(() -> new funkin.ui.debug.anim.DebugBoundingState());

View file

@ -2777,6 +2777,7 @@ class PlayState extends MusicBeatSubState
deathCounter = 0;
var isNewHighscore = false;
var prevScoreData:Null<SaveScoreData> = Save.instance.getSongScore(currentSong.id, currentDifficulty);
if (currentSong != null && currentSong.validScore)
{
@ -2796,7 +2797,6 @@ class PlayState extends MusicBeatSubState
totalNotesHit: Highscore.tallies.totalNotesHit,
totalNotes: Highscore.tallies.totalNotes,
},
accuracy: Highscore.tallies.totalNotesHit / Highscore.tallies.totalNotes,
};
// adds current song data into the tallies for the level (story levels)
@ -2833,7 +2833,7 @@ class PlayState extends MusicBeatSubState
score: PlayStatePlaylist.campaignScore,
tallies:
{
// TODO: Sum up the values for the whole level!
// TODO: Sum up the values for the whole week!
sick: 0,
good: 0,
bad: 0,
@ -2844,7 +2844,6 @@ class PlayState extends MusicBeatSubState
totalNotesHit: 0,
totalNotes: 0,
},
accuracy: Highscore.tallies.totalNotesHit / Highscore.tallies.totalNotes,
};
if (Save.instance.isLevelHighScore(PlayStatePlaylist.campaignId, PlayStatePlaylist.campaignDifficulty, data))
@ -2930,11 +2929,11 @@ class PlayState extends MusicBeatSubState
{
if (rightGoddamnNow)
{
moveToResultsScreen(isNewHighscore);
moveToResultsScreen(isNewHighscore, prevScoreData);
}
else
{
zoomIntoResultsScreen(isNewHighscore);
zoomIntoResultsScreen(isNewHighscore, prevScoreData);
}
}
}
@ -3008,7 +3007,7 @@ class PlayState extends MusicBeatSubState
/**
* Play the camera zoom animation and then move to the results screen once it's done.
*/
function zoomIntoResultsScreen(isNewHighscore:Bool):Void
function zoomIntoResultsScreen(isNewHighscore:Bool, ?prevScoreData:SaveScoreData):Void
{
trace('WENT TO RESULTS SCREEN!');
@ -3048,7 +3047,7 @@ class PlayState extends MusicBeatSubState
FlxTween.tween(camHUD, {alpha: 0}, 0.6,
{
onComplete: function(_) {
moveToResultsScreen(isNewHighscore);
moveToResultsScreen(isNewHighscore, prevScoreData);
}
});
@ -3081,7 +3080,7 @@ class PlayState extends MusicBeatSubState
/**
* Move to the results screen right goddamn now.
*/
function moveToResultsScreen(isNewHighscore:Bool):Void
function moveToResultsScreen(isNewHighscore:Bool, ?prevScoreData:SaveScoreData):Void
{
persistentUpdate = false;
vocals.stop();
@ -3093,6 +3092,8 @@ class PlayState extends MusicBeatSubState
{
storyMode: PlayStatePlaylist.isStoryMode,
title: PlayStatePlaylist.isStoryMode ? ('${PlayStatePlaylist.campaignTitle}') : ('${currentChart.songName} by ${currentChart.songArtist}'),
prevScoreData: prevScoreData,
difficultyId: currentDifficulty,
scoreData:
{
score: PlayStatePlaylist.isStoryMode ? PlayStatePlaylist.campaignScore : songScore,
@ -3108,7 +3109,6 @@ class PlayState extends MusicBeatSubState
totalNotesHit: talliesToUse.totalNotesHit,
totalNotes: talliesToUse.totalNotes,
},
accuracy: Highscore.tallies.totalNotesHit / Highscore.tallies.totalNotes,
},
isNewHighscore: isNewHighscore
});

View file

@ -24,6 +24,7 @@ import funkin.save.Save;
import funkin.save.Save.SaveScoreData;
import funkin.graphics.shaders.LeftMaskShader;
import funkin.play.components.TallyCounter;
import funkin.play.components.ClearPercentCounter;
/**
* The state for the results screen after a song or week is finished.
@ -109,7 +110,7 @@ class ResultState extends MusicBeatSubState
var soundSystem:FlxSprite = FunkinSprite.createSparrow(-15, -180, 'resultScreen/soundSystem');
soundSystem.animation.addByPrefix("idle", "sound system", 24, false);
soundSystem.visible = false;
new FlxTimer().start(0.4, _ -> {
new FlxTimer().start(0.3, _ -> {
soundSystem.animation.play("idle");
soundSystem.visible = true;
});
@ -118,7 +119,7 @@ class ResultState extends MusicBeatSubState
switch (rank)
{
case PERFECT | PERFECT_GOLD | PERFECT_PLATINUM:
case PERFECT | PERFECT_GOLD:
bfPerfect = new FlxAtlasSprite(370, -180, Paths.animateAtlas("resultScreen/results-bf/resultsPERFECT", "shared"));
bfPerfect.visible = false;
bfPerfect.zIndex = 500;
@ -183,22 +184,7 @@ class ResultState extends MusicBeatSubState
});
}
var diffSpr:String = switch (PlayState.instance.currentDifficulty)
{
case 'easy':
'difEasy';
case 'normal':
'difNormal';
case 'hard':
'difHard';
case 'erect':
'difErect';
case 'nightmare':
'difNightmare';
case _:
'difNormal';
}
var diffSpr:String = 'dif${params?.difficultyId ?? 'Normal'}';
difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
add(difficulty);
@ -208,7 +194,7 @@ class ResultState extends MusicBeatSubState
speedOfTween.x = -1.0 * Math.cos(angleRad);
speedOfTween.y = -1.0 * Math.sin(angleRad);
timerThenSongName();
timerThenSongName(1.0);
songName.shader = maskShaderSongName;
difficulty.shader = maskShaderDifficulty;
@ -218,24 +204,40 @@ class ResultState extends MusicBeatSubState
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
blackTopBar.y = -blackTopBar.height;
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5});
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut});
blackTopBar.zIndex = 1010;
add(blackTopBar);
resultsAnim.animation.addByPrefix("result", "results instance 1", 24, false);
resultsAnim.animation.play("result");
resultsAnim.visible = false;
resultsAnim.zIndex = 1200;
add(resultsAnim);
new FlxTimer().start(0.3, _ -> {
resultsAnim.visible = true;
resultsAnim.animation.play("result");
});
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
ratingsPopin.visible = false;
ratingsPopin.zIndex = 1200;
add(ratingsPopin);
new FlxTimer().start(1.0, _ -> {
ratingsPopin.visible = true;
ratingsPopin.animation.play("idle");
});
scorePopin.animation.addByPrefix("score", "tally score", 24, false);
scorePopin.visible = false;
scorePopin.zIndex = 1200;
add(scorePopin);
new FlxTimer().start(1.0, _ -> {
scorePopin.visible = true;
scorePopin.animation.play("score");
scorePopin.animation.finishCallback = anim -> {
score.visible = true;
score.animateNumbers();
};
});
highscoreNew.frames = Paths.getSparrowAtlas("resultScreen/highscoreNew");
highscoreNew.animation.addByPrefix("new", "NEW HIGHSCORE", 24);
@ -285,14 +287,27 @@ class ResultState extends MusicBeatSubState
for (ind => rating in ratingGrp.members)
{
rating.visible = false;
new FlxTimer().start((0.3 * ind) + 0.55, _ -> {
new FlxTimer().start((0.3 * ind) + 1.20, _ -> {
rating.visible = true;
FlxTween.tween(rating, {curNumber: rating.neededNumber}, 0.5, {ease: FlxEase.quartOut});
});
}
ratingsPopin.animation.finishCallback = anim -> {
startRankTallySequence();
if (params.isNewHighscore ?? false)
{
highscoreNew.visible = true;
highscoreNew.animation.play("new");
FlxTween.tween(highscoreNew, {y: highscoreNew.y + 10}, 0.8, {ease: FlxEase.quartOut});
}
else
{
highscoreNew.visible = false;
}
};
refresh();
super.create();
@ -304,48 +319,43 @@ class ResultState extends MusicBeatSubState
function startRankTallySequence():Void
{
clearPercentTarget = Math.floor((params.scoreData.tallies.totalNotesHit) / params.scoreData.tallies.totalNotes * 100);
// clearPercentTarget = 97;
clearPercentTarget = Math.floor((params.scoreData.tallies.sick + params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100);
clearPercentTarget = 100;
var clearPercentText = new FlxText(FlxG.width / 2, FlxG.height / 2, 0, 'CLEAR: ${clearPercentLerp}%');
clearPercentText.setFormat(Paths.font('vcr.ttf'), 64, FlxColor.BLACK, FlxTextAlign.RIGHT);
clearPercentText.zIndex = 1000;
add(clearPercentText);
clearPercentLerp = Std.int(Math.max(0, clearPercentTarget - 36));
rankTallyTimer = new FlxTimer().start(1 / 24, _ -> {
// Tick up.
if (clearPercentLerp < clearPercentTarget)
var clearPercentCounter:ClearPercentCounter = new ClearPercentCounter(FlxG.width / 2 + 300, FlxG.height / 2 - 100, clearPercentTarget);
clearPercentCounter.curNumber = clearPercentLerp;
FlxTween.tween(clearPercentCounter, {curNumber: clearPercentTarget}, 1.5,
{
clearPercentLerp++;
clearPercentText.text = 'CLEAR: ${clearPercentLerp}%';
ease: FlxEase.quartOut,
onUpdate: _ -> {
// Only play the tick sound if the number increased.
if (clearPercentLerp != clearPercentCounter.curNumber)
{
clearPercentLerp = clearPercentCounter.curNumber;
FunkinSound.playOnce(Paths.sound('scrollMenu'));
}
// Don't overshoot.
if (clearPercentLerp > clearPercentTarget)
{
clearPercentLerp = clearPercentTarget;
}
if (clearPercentLerp == clearPercentTarget)
{
if (rankTallyTimer != null)
{
rankTallyTimer.destroy();
rankTallyTimer = null;
}
},
onComplete: _ -> {
// Play confirm sound.
FunkinSound.playOnce(Paths.sound('confirmMenu'));
new FlxTimer().start(1.0, _ -> {
remove(clearPercentText);
// Flash background.
bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
displayRankText();
new FlxTimer().start(2.0, _ -> {
// remove(clearPercentCounter);
afterRankTallySequence();
});
}
}, 0); // 0 = Loop until stopped
});
clearPercentCounter.zIndex = 450;
add(clearPercentCounter);
if (ratingsPopin == null)
{
@ -353,18 +363,15 @@ class ResultState extends MusicBeatSubState
}
else
{
ratingsPopin.animation.play("idle");
ratingsPopin.visible = true;
// ratingsPopin.animation.play("idle");
// ratingsPopin.visible = true;
ratingsPopin.animation.finishCallback = anim -> {
scorePopin.animation.play("score");
scorePopin.animation.finishCallback = anim -> {
score.visible = true;
score.animateNumbers();
};
scorePopin.visible = true;
// scorePopin.animation.play("score");
if (params.isNewHighscore)
// scorePopin.visible = true;
if (params.isNewHighscore ?? false)
{
highscoreNew.visible = true;
highscoreNew.animation.play("new");
@ -380,6 +387,23 @@ class ResultState extends MusicBeatSubState
refresh();
}
function displayRankText():Void
{
var rankTextVert:FunkinSprite = FunkinSprite.create(FlxG.width - 64, 100, rank.getVerTextAsset());
rankTextVert.zIndex = 2000;
add(rankTextVert);
for (i in 0...10)
{
var rankTextBack:FunkinSprite = FunkinSprite.create(FlxG.width / 2 - 80, 50, rank.getHorTextAsset());
rankTextBack.y += (rankTextBack.height * i / 2) + 10;
rankTextBack.zIndex = 100;
add(rankTextBack);
}
refresh();
}
function afterRankTallySequence():Void
{
FunkinSound.playMusic(rank.getMusicPath(),
@ -406,7 +430,7 @@ class ResultState extends MusicBeatSubState
switch (rank)
{
case PERFECT | PERFECT_GOLD | PERFECT_PLATINUM:
case PERFECT | PERFECT_GOLD:
if (bfPerfect == null)
{
trace("Could not build PERFECT animation!");
@ -415,17 +439,6 @@ class ResultState extends MusicBeatSubState
{
bfPerfect.visible = true;
bfPerfect.playAnimation('');
new FlxTimer().start((1 / 24) * 12, _ -> {
bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
new FlxTimer().start((1 / 24) * 2, _ ->
{
// bgFlash.alpha = 0.5;
// bgFlash.visible = false;
});
});
}
case EXCELLENT:
@ -437,17 +450,6 @@ class ResultState extends MusicBeatSubState
{
bfExcellent.visible = true;
bfExcellent.playAnimation('Intro');
new FlxTimer().start((1 / 24) * 12, _ -> {
bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
new FlxTimer().start((1 / 24) * 2, _ ->
{
// bgFlash.alpha = 0.5;
// bgFlash.visible = false;
});
});
}
case SHIT:
@ -459,17 +461,6 @@ class ResultState extends MusicBeatSubState
{
bfShit.visible = true;
bfShit.playAnimation('Intro');
new FlxTimer().start((1 / 24) * 12, _ -> {
bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
new FlxTimer().start((1 / 24) * 2, _ ->
{
// bgFlash.alpha = 0.5;
// bgFlash.visible = false;
});
});
}
case GREAT | GOOD:
@ -482,17 +473,6 @@ class ResultState extends MusicBeatSubState
bfGood.animation.play('fall');
bfGood.visible = true;
new FlxTimer().start((1 / 24) * 12, _ -> {
bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 0.4);
new FlxTimer().start((1 / 24) * 2, _ ->
{
// bgFlash.alpha = 0.5;
// bgFlash.visible = false;
});
});
new FlxTimer().start((1 / 24) * 22, _ -> {
// plays about 22 frames (at 24fps timing) after bf spawns in
if (gfGood != null)
@ -510,7 +490,7 @@ class ResultState extends MusicBeatSubState
}
}
function timerThenSongName():Void
function timerThenSongName(timerLength:Float = 3.0):Void
{
movingSongStuff = false;
@ -526,7 +506,7 @@ class ResultState extends MusicBeatSubState
FlxTween.tween(songName, {y: diffYTween - 35 - fuckedupnumber}, 0.5, {ease: FlxEase.expoOut, startDelay: 0.9});
songName.x = (difficulty.x + difficulty.width) + 20;
new FlxTimer().start(3, _ -> {
new FlxTimer().start(timerLength, _ -> {
var tempSpeed = FlxPoint.get(speedOfTween.x, speedOfTween.y);
speedOfTween.set(0, 0);
@ -600,33 +580,29 @@ class ResultState extends MusicBeatSubState
public static function calculateRank(params:ResultsStateParams):ResultRank
{
// Perfect (Platinum) is a Sick Full Clear
var isPerfectPlat = (params.scoreData.tallies.sick + params.scoreData.tallies.good) == params.scoreData.tallies.totalNotes
&& params.scoreData.tallies.sick / params.scoreData.tallies.totalNotes >= Constants.RANK_PERFECT_PLAT_THRESHOLD;
if (isPerfectPlat) return ResultRank.PERFECT_PLATINUM;
// Perfect (Gold) is an 85% Sick Full Clear
var isPerfectGold = (params.scoreData.tallies.sick + params.scoreData.tallies.good) == params.scoreData.tallies.totalNotes
&& params.scoreData.tallies.sick / params.scoreData.tallies.totalNotes >= Constants.RANK_PERFECT_GOLD_THRESHOLD;
var isPerfectGold = params.scoreData.tallies.sick == params.scoreData.tallies.totalNotes;
if (isPerfectGold) return ResultRank.PERFECT_GOLD;
// Else, use the standard grades
// Grade % (only good and sick), 1.00 is a full combo
var grade = (params.scoreData.tallies.sick + params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes;
// Clear % (including bad and shit). 1.00 is a full clear but not a full combo
var clear = (params.scoreData.tallies.totalNotesHit) / params.scoreData.tallies.totalNotes;
if (clear == Constants.RANK_PERFECT_THRESHOLD)
if (grade == Constants.RANK_PERFECT_THRESHOLD)
{
return ResultRank.PERFECT;
}
else if (clear >= Constants.RANK_EXCELLENT_THRESHOLD)
else if (grade >= Constants.RANK_EXCELLENT_THRESHOLD)
{
return ResultRank.EXCELLENT;
}
else if (clear >= Constants.RANK_GREAT_THRESHOLD)
else if (grade >= Constants.RANK_GREAT_THRESHOLD)
{
return ResultRank.GREAT;
}
else if (clear >= Constants.RANK_GOOD_THRESHOLD)
else if (grade >= Constants.RANK_GOOD_THRESHOLD)
{
return ResultRank.GOOD;
}
@ -639,7 +615,6 @@ class ResultState extends MusicBeatSubState
enum abstract ResultRank(String)
{
var PERFECT_PLATINUM;
var PERFECT_GOLD;
var PERFECT;
var EXCELLENT;
@ -651,8 +626,6 @@ enum abstract ResultRank(String)
{
switch (abstract)
{
case PERFECT_PLATINUM:
return 'resultsPERFECT';
case PERFECT_GOLD:
return 'resultsPERFECT';
case PERFECT:
@ -665,6 +638,8 @@ enum abstract ResultRank(String)
return 'resultsNORMAL';
case SHIT:
return 'resultsSHIT';
default:
return 'resultsNORMAL';
}
}
@ -672,8 +647,6 @@ enum abstract ResultRank(String)
{
switch (abstract)
{
case PERFECT_PLATINUM:
return true;
case PERFECT_GOLD:
return true;
case PERFECT:
@ -690,6 +663,48 @@ enum abstract ResultRank(String)
return false;
}
}
public function getHorTextAsset()
{
switch (abstract)
{
case PERFECT_GOLD:
return 'resultScreen/rankText/rankScrollPERFECT';
case PERFECT:
return 'resultScreen/rankText/rankScrollPERFECT';
case EXCELLENT:
return 'resultScreen/rankText/rankScrollEXCELLENT';
case GREAT:
return 'resultScreen/rankText/rankScrollGREAT';
case GOOD:
return 'resultScreen/rankText/rankScrollGOOD';
case SHIT:
return 'resultScreen/rankText/rankScrollLOSS';
default:
return 'resultScreen/rankText/rankScrollGOOD';
}
}
public function getVerTextAsset()
{
switch (abstract)
{
case PERFECT_GOLD:
return 'resultScreen/rankText/rankTextPERFECT';
case PERFECT:
return 'resultScreen/rankText/rankTextPERFECT';
case EXCELLENT:
return 'resultScreen/rankText/rankTextEXCELLENT';
case GREAT:
return 'resultScreen/rankText/rankTextGREAT';
case GOOD:
return 'resultScreen/rankText/rankTextGOOD';
case SHIT:
return 'resultScreen/rankText/rankTextLOSS';
default:
return 'resultScreen/rankText/rankTextGOOD';
}
}
}
typedef ResultsStateParams =
@ -707,10 +722,21 @@ typedef ResultsStateParams =
/**
* Whether the displayed score is a new highscore
*/
var isNewHighscore:Bool;
var ?isNewHighscore:Bool;
/**
* The difficulty ID of the song/week we just played.
* @default Normal
*/
var ?difficultyId:String;
/**
* The score, accuracy, and judgements.
*/
var scoreData:SaveScoreData;
/**
* The previous score data, used for rank comparision.
*/
var ?prevScoreData:SaveScoreData;
};

View file

@ -0,0 +1,96 @@
package funkin.play.components;
import funkin.graphics.FunkinSprite;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
import flixel.math.FlxMath;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.text.FlxText.FlxTextAlign;
import funkin.util.MathUtil;
/**
* Numerical counters used to display the clear percent.
*/
class ClearPercentCounter extends FlxTypedSpriteGroup<FlxSprite>
{
public var curNumber:Int = 0;
public var neededNumber:Int = 0;
public function new(x:Float, y:Float, neededNumber:Int = 0)
{
super(x, y);
this.neededNumber = neededNumber;
var clearPercentText:FunkinSprite = FunkinSprite.create(0, 0, 'resultScreen/clearPercent/clearPercentText');
add(clearPercentText);
if (curNumber == neededNumber) drawNumbers();
}
var tmr:Float = 0;
override function update(elapsed:Float)
{
super.update(elapsed);
if (curNumber < neededNumber) drawNumbers();
}
function drawNumbers()
{
var seperatedScore:Array<Int> = [];
var tempCombo:Int = Math.round(curNumber);
var fullNumberDigits:Int = Std.int(Math.max(1, Math.ceil(MathUtil.logBase(10, neededNumber))));
while (tempCombo != 0)
{
seperatedScore.push(tempCombo % 10);
tempCombo = Math.floor(tempCombo / 10);
}
if (seperatedScore.length == 0) seperatedScore.push(0);
seperatedScore.reverse();
for (ind => num in seperatedScore)
{
var digitIndex = ind + 1;
if (digitIndex >= members.length)
{
var xPos = (digitIndex - 1) * (72 * this.scale.x);
var yPos = 72;
// Three digits = LRL so two different numbers aren't adjacent to each other.
var variant:Bool = (fullNumberDigits % 2 != 0) ? (digitIndex % 2 == 0) : (digitIndex % 2 == 1);
var numb:ClearPercentNumber = new ClearPercentNumber(xPos, yPos, num);
numb.scale.set(this.scale.x, this.scale.y);
add(numb);
}
else
{
members[digitIndex].animation.play(Std.string(num));
}
}
}
}
class ClearPercentNumber extends FlxSprite
{
public function new(x:Float, y:Float, digit:Int, variant:Bool = false)
{
super(x, y);
frames = Paths.getSparrowAtlas('resultScreen/clearPercent/clearPercentNumber${variant ? 'Right' : 'Left'}');
for (i in 0...10)
{
animation.addByPrefix('$i', 'number $i 0', 24, false);
}
animation.play('$digit');
updateHitbox();
}
}

View file

@ -809,11 +809,6 @@ typedef SaveScoreData =
* The count of each judgement hit.
*/
var tallies:SaveScoreTallyData;
/**
* The accuracy percentage.
*/
var accuracy:Float;
}
typedef SaveScoreTallyData =

View file

@ -121,7 +121,7 @@ class SaveDataMigrator
var scoreDataEasy:SaveScoreData =
{
score: inputSaveData.songScores.get('${levelId}-easy') ?? 0,
accuracy: inputSaveData.songCompletion.get('${levelId}-easy') ?? 0.0,
// accuracy: inputSaveData.songCompletion.get('${levelId}-easy') ?? 0.0,
tallies:
{
sick: 0,
@ -140,7 +140,7 @@ class SaveDataMigrator
var scoreDataNormal:SaveScoreData =
{
score: inputSaveData.songScores.get('${levelId}') ?? 0,
accuracy: inputSaveData.songCompletion.get('${levelId}') ?? 0.0,
// accuracy: inputSaveData.songCompletion.get('${levelId}') ?? 0.0,
tallies:
{
sick: 0,
@ -159,7 +159,7 @@ class SaveDataMigrator
var scoreDataHard:SaveScoreData =
{
score: inputSaveData.songScores.get('${levelId}-hard') ?? 0,
accuracy: inputSaveData.songCompletion.get('${levelId}-hard') ?? 0.0,
// accuracy: inputSaveData.songCompletion.get('${levelId}-hard') ?? 0.0,
tallies:
{
sick: 0,
@ -181,7 +181,6 @@ class SaveDataMigrator
var scoreDataEasy:SaveScoreData =
{
score: 0,
accuracy: 0,
tallies:
{
sick: 0,
@ -199,14 +198,13 @@ class SaveDataMigrator
for (songId in songIds)
{
scoreDataEasy.score = Std.int(Math.max(scoreDataEasy.score, inputSaveData.songScores.get('${songId}-easy') ?? 0));
scoreDataEasy.accuracy = Math.max(scoreDataEasy.accuracy, inputSaveData.songCompletion.get('${songId}-easy') ?? 0.0);
// scoreDataEasy.accuracy = Math.max(scoreDataEasy.accuracy, inputSaveData.songCompletion.get('${songId}-easy') ?? 0.0);
}
result.setSongScore(songIds[0], 'easy', scoreDataEasy);
var scoreDataNormal:SaveScoreData =
{
score: 0,
accuracy: 0,
tallies:
{
sick: 0,
@ -224,14 +222,13 @@ class SaveDataMigrator
for (songId in songIds)
{
scoreDataNormal.score = Std.int(Math.max(scoreDataNormal.score, inputSaveData.songScores.get('${songId}') ?? 0));
scoreDataNormal.accuracy = Math.max(scoreDataNormal.accuracy, inputSaveData.songCompletion.get('${songId}') ?? 0.0);
// scoreDataNormal.accuracy = Math.max(scoreDataNormal.accuracy, inputSaveData.songCompletion.get('${songId}') ?? 0.0);
}
result.setSongScore(songIds[0], 'normal', scoreDataNormal);
var scoreDataHard:SaveScoreData =
{
score: 0,
accuracy: 0,
tallies:
{
sick: 0,
@ -249,7 +246,7 @@ class SaveDataMigrator
for (songId in songIds)
{
scoreDataHard.score = Std.int(Math.max(scoreDataHard.score, inputSaveData.songScores.get('${songId}-hard') ?? 0));
scoreDataHard.accuracy = Math.max(scoreDataHard.accuracy, inputSaveData.songCompletion.get('${songId}-hard') ?? 0.0);
// scoreDataHard.accuracy = Math.max(scoreDataHard.accuracy, inputSaveData.songCompletion.get('${songId}-hard') ?? 0.0);
}
result.setSongScore(songIds[0], 'hard', scoreDataHard);
}

View file

@ -998,7 +998,7 @@ class FreeplayState extends MusicBeatSubState
{
var songScore:SaveScoreData = Save.instance.getSongScore(grpCapsules.members[curSelected].songData.songId, currentDifficulty);
intendedScore = songScore?.score ?? 0;
intendedCompletion = songScore?.accuracy ?? 0.0;
intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes);
rememberedDifficulty = currentDifficulty;
}
else
@ -1196,7 +1196,7 @@ class FreeplayState extends MusicBeatSubState
{
var songScore:SaveScoreData = Save.instance.getSongScore(daSongCapsule.songData.songId, currentDifficulty);
intendedScore = songScore?.score ?? 0;
intendedCompletion = songScore?.accuracy ?? 0.0;
intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes);
diffIdsCurrent = daSongCapsule.songData.songDifficulties;
rememberedSongId = daSongCapsule.songData.songId;
changeDiff();

View file

@ -355,8 +355,7 @@ class MainMenuState extends MusicBeatState
maxCombo: 0,
totalNotesHit: 0,
totalNotes: 0,
},
accuracy: 0,
}
});
}
#end