mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-07-14 22:25:49 +00:00
tallies for story mode
This commit is contained in:
parent
d2b124efca
commit
fa72fa44b1
|
@ -8,10 +8,32 @@ import flixel.FlxG;
|
||||||
class Highscore
|
class Highscore
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Keeps track of notes hit for the current song / week,
|
* Keeps track of notes hit for the current song
|
||||||
* and how accurate you were with each note (bad, missed, shit, etc.)
|
* and how accurate you were with each note (bad, missed, shit, etc.)
|
||||||
*/
|
*/
|
||||||
public static var tallies:Tallies = new Tallies();
|
public static var tallies:Tallies = new Tallies();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keeps track of notes hit for the current WEEK / level
|
||||||
|
* for use with storymode, or likely any other "playlist" esque option
|
||||||
|
*/
|
||||||
|
public static var talliesLevel:Tallies = new Tallies();
|
||||||
|
|
||||||
|
public static function combineTallies(tally1:Tallies, tally2:Tallies):Tallies
|
||||||
|
{
|
||||||
|
var combinedTally:Tallies = new Tallies();
|
||||||
|
combinedTally.combo = tally1.combo + tally2.combo;
|
||||||
|
combinedTally.missed = tally1.missed + tally2.missed;
|
||||||
|
combinedTally.shit = tally1.shit + tally2.shit;
|
||||||
|
combinedTally.bad = tally1.bad + tally2.bad;
|
||||||
|
combinedTally.good = tally1.good + tally2.good;
|
||||||
|
combinedTally.sick = tally1.sick + tally2.sick;
|
||||||
|
combinedTally.totalNotes = tally1.totalNotes + tally2.totalNotes;
|
||||||
|
combinedTally.totalNotesHit = tally1.totalNotesHit + tally2.totalNotesHit;
|
||||||
|
combinedTally.maxCombo = tally1.maxCombo + tally2.maxCombo;
|
||||||
|
|
||||||
|
return combinedTally;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@:forward
|
@:forward
|
||||||
|
|
|
@ -2458,8 +2458,6 @@ class PlayState extends MusicBeatSubState
|
||||||
|
|
||||||
health += healthChange;
|
health += healthChange;
|
||||||
|
|
||||||
FlxG.watch.addQuick("COMBO: ", Highscore.tallies.combo);
|
|
||||||
|
|
||||||
if (isComboBreak)
|
if (isComboBreak)
|
||||||
{
|
{
|
||||||
// Break the combo, but don't increment tallies.misses.
|
// Break the combo, but don't increment tallies.misses.
|
||||||
|
@ -2625,6 +2623,9 @@ class PlayState extends MusicBeatSubState
|
||||||
accuracy: Highscore.tallies.totalNotesHit / currentChart.notes.length,
|
accuracy: Highscore.tallies.totalNotesHit / currentChart.notes.length,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// adds current song data into the tallies for the level (story levels)
|
||||||
|
Highscore.talliesLevel = Highscore.combineTallies(Highscore.tallies, Highscore.talliesLevel);
|
||||||
|
|
||||||
if (Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data))
|
if (Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data))
|
||||||
{
|
{
|
||||||
Save.instance.setSongScore(currentSong.id, currentDifficulty, data);
|
Save.instance.setSongScore(currentSong.id, currentDifficulty, data);
|
||||||
|
@ -2893,11 +2894,14 @@ class PlayState extends MusicBeatSubState
|
||||||
persistentUpdate = false;
|
persistentUpdate = false;
|
||||||
vocals.stop();
|
vocals.stop();
|
||||||
camHUD.alpha = 1;
|
camHUD.alpha = 1;
|
||||||
|
|
||||||
|
var talliesToUse:Tallies = PlayStatePlaylist.isStoryMode ? Highscore.talliesLevel : Highscore.tallies;
|
||||||
|
|
||||||
var res:ResultState = new ResultState(
|
var res:ResultState = new ResultState(
|
||||||
{
|
{
|
||||||
storyMode: PlayStatePlaylist.isStoryMode,
|
storyMode: PlayStatePlaylist.isStoryMode,
|
||||||
title: PlayStatePlaylist.isStoryMode ? ('${PlayStatePlaylist.campaignTitle}') : ('${currentChart.songName} by ${currentChart.songArtist}'),
|
title: PlayStatePlaylist.isStoryMode ? ('${PlayStatePlaylist.campaignTitle}') : ('${currentChart.songName} by ${currentChart.songArtist}'),
|
||||||
tallies: Highscore.tallies,
|
tallies: talliesToUse,
|
||||||
});
|
});
|
||||||
res.camera = camHUD;
|
res.camera = camHUD;
|
||||||
openSubState(res);
|
openSubState(res);
|
||||||
|
|
|
@ -519,7 +519,7 @@ class StoryMenuState extends MusicBeatState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectLevel()
|
function selectLevel():Void
|
||||||
{
|
{
|
||||||
if (!currentLevel.isUnlocked())
|
if (!currentLevel.isUnlocked())
|
||||||
{
|
{
|
||||||
|
@ -554,6 +554,8 @@ class StoryMenuState extends MusicBeatState
|
||||||
PlayStatePlaylist.campaignTitle = currentLevel.getTitle();
|
PlayStatePlaylist.campaignTitle = currentLevel.getTitle();
|
||||||
PlayStatePlaylist.campaignDifficulty = currentDifficultyId;
|
PlayStatePlaylist.campaignDifficulty = currentDifficultyId;
|
||||||
|
|
||||||
|
Highscore.talliesLevel = new funkin.Highscore.Tallies();
|
||||||
|
|
||||||
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
||||||
FlxTransitionableState.skipNextTransIn = false;
|
FlxTransitionableState.skipNextTransIn = false;
|
||||||
FlxTransitionableState.skipNextTransOut = false;
|
FlxTransitionableState.skipNextTransOut = false;
|
||||||
|
|
Loading…
Reference in a new issue