Save total of each rating to unused hits parameter in SongScore (#831)
* Save received ratings to unused hits parameter in SongScore * Adding function to set up keys for the hits map, as to prevent potential null issues
This commit is contained in:
@@ -332,6 +332,10 @@ class PlayState extends MusicBeatState
|
||||
* The total accuracy amount.
|
||||
*/
|
||||
public var totalAccuracyAmount:Float = 0;
|
||||
/**
|
||||
* Tracks how much of each rating was received.
|
||||
*/
|
||||
public var hits:Map<String, Int> = [];
|
||||
|
||||
/**
|
||||
* FunkinText that shows your score.
|
||||
@@ -364,6 +368,11 @@ class PlayState extends MusicBeatState
|
||||
public static var campaignAccuracyTotal:Float = 0;
|
||||
public static var campaignAccuracyCount:Float = 0;
|
||||
|
||||
/**
|
||||
* Number of each rating received for the current week.
|
||||
*/
|
||||
public static var campaignHits:Map<String, Int> = [];
|
||||
|
||||
/**
|
||||
* Camera zoom at which the game lerps to.
|
||||
*/
|
||||
@@ -680,6 +689,8 @@ class PlayState extends MusicBeatState
|
||||
|
||||
detailsText = isStoryMode ? ("Story Mode: " + storyWeek.name) : "Freeplay";
|
||||
|
||||
for (rating in [for (i in ratingManager.ratingData) i.name]) hits.set(rating, 0); // Ensure all keys exist as to prevent null errors.
|
||||
|
||||
// Checks if cutscene files exists
|
||||
var cutscenePath = Paths.script('songs/${SONG.meta.name}/cutscene');
|
||||
var endCutscenePath = Paths.script('songs/${SONG.meta.name}/cutscene-end');
|
||||
@@ -1731,7 +1742,7 @@ class PlayState extends MusicBeatState
|
||||
score: songScore,
|
||||
misses: misses,
|
||||
accuracy: accuracy,
|
||||
hits: [],
|
||||
hits: hits,
|
||||
date: Date.now().toString()
|
||||
}, getSongChanges());
|
||||
#end
|
||||
@@ -1758,6 +1769,7 @@ class PlayState extends MusicBeatState
|
||||
campaignMisses += misses;
|
||||
campaignAccuracyTotal += accuracy;
|
||||
campaignAccuracyCount++;
|
||||
for (k => v in hits) campaignHits[k] += v;
|
||||
storyPlaylist.shift();
|
||||
storyVariations.shift();
|
||||
|
||||
@@ -1771,7 +1783,7 @@ class PlayState extends MusicBeatState
|
||||
score: campaignScore,
|
||||
misses: campaignMisses,
|
||||
accuracy: campaignAccuracy,
|
||||
hits: [],
|
||||
hits: campaignHits,
|
||||
date: Date.now().toString()
|
||||
});
|
||||
#end
|
||||
@@ -1941,6 +1953,7 @@ class PlayState extends MusicBeatState
|
||||
displayCombo(event);
|
||||
if (event.displayRating)
|
||||
displayRating(event.rating, event);
|
||||
hits[rating.name] += 1;
|
||||
ratingNum += 1;
|
||||
}
|
||||
}
|
||||
@@ -2178,6 +2191,7 @@ class PlayState extends MusicBeatState
|
||||
campaignMisses = 0;
|
||||
campaignAccuracyTotal = 0;
|
||||
campaignAccuracyCount = 0;
|
||||
campaignHits = [];
|
||||
chartingMode = coopMode = opponentMode = false;
|
||||
__loadSong(storyPlaylist[0], difficulty, storyVariations[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user