Keep track of how many time each difficulty is used in linear races
This commit is contained in:
parent
edc683f720
commit
d008da5548
@ -43,7 +43,8 @@ class AchievementsStatus
|
|||||||
public :
|
public :
|
||||||
// Warning : changing what an existing id does breaks
|
// Warning : changing what an existing id does breaks
|
||||||
// save-game compatibility. Bump version number if doing so.
|
// save-game compatibility. Bump version number if doing so.
|
||||||
enum { // Won races values share the following properties :
|
enum AchievementData {
|
||||||
|
// Won races values share the following properties :
|
||||||
// 1. Only races with at least 3 AI count unless otherwise specified.
|
// 1. Only races with at least 3 AI count unless otherwise specified.
|
||||||
ACHIEVE_WON_RACES = 0, // Normal, time-trial and FTL
|
ACHIEVE_WON_RACES = 0, // Normal, time-trial and FTL
|
||||||
ACHIEVE_WON_NORMAL_RACES = 1, // Normal race only
|
ACHIEVE_WON_NORMAL_RACES = 1, // Normal race only
|
||||||
@ -55,16 +56,28 @@ public :
|
|||||||
ACHIEVE_CONS_WON_RACES = 4,
|
ACHIEVE_CONS_WON_RACES = 4,
|
||||||
// Won races in (at least) hard requires at least 5 AI opponents
|
// Won races in (at least) hard requires at least 5 AI opponents
|
||||||
ACHIEVE_CONS_WON_RACES_HARD = 5,
|
ACHIEVE_CONS_WON_RACES_HARD = 5,
|
||||||
|
// Count how many normal, TT & FTL races were started and finished by difficulty
|
||||||
|
EASY_STARTED = 6,
|
||||||
|
EASY_FINISHED = 7,
|
||||||
|
MEDIUM_STARTED = 8,
|
||||||
|
MEDIUM_FINISHED = 9,
|
||||||
|
HARD_STARTED = 10,
|
||||||
|
HARD_FINISHED = 11,
|
||||||
|
BEST_STARTED = 12,
|
||||||
|
BEST_FINISHED = 13,
|
||||||
// Count the number of powerups used by the player.
|
// Count the number of powerups used by the player.
|
||||||
ACHIEVE_POWERUP_USED = 6,
|
ACHIEVE_POWERUP_USED = 14,
|
||||||
ACHIEVE_POWERUP_USED_1RACE = 7,
|
ACHIEVE_POWERUP_USED_1RACE = 15,
|
||||||
// Count the number of bananas hit
|
// Count the number of bananas hit
|
||||||
ACHIEVE_BANANA = 8,
|
ACHIEVE_BANANA = 16,
|
||||||
ACHIEVE_BANANA_1RACE = 9,
|
ACHIEVE_BANANA_1RACE = 17,
|
||||||
// Count how many times the player skidded
|
// Count how many times the player skidded
|
||||||
ACHIEVE_SKIDDING_1LAP = 10,
|
ACHIEVE_SKIDDING_1LAP = 18,
|
||||||
ACHIEVE_SKIDDING_1RACE = 11,
|
ACHIEVE_SKIDDING_1RACE = 19,
|
||||||
ACHIEVE_SKIDDING = 12,
|
ACHIEVE_SKIDDING = 20,
|
||||||
|
// Count how many times a bowling ball from the player hit a kart
|
||||||
|
ACHIEVE_BOWLING_HIT = 21,
|
||||||
|
ACHIEVE_BOWLING_HIT_1RACE = 22,
|
||||||
|
|
||||||
ACHIEVE_DATA_NUM = 13
|
ACHIEVE_DATA_NUM = 13
|
||||||
};
|
};
|
||||||
@ -83,7 +96,7 @@ private:
|
|||||||
int counter;
|
int counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int DATA_VERSION = 1;
|
const int DATA_VERSION = 2;
|
||||||
|
|
||||||
// The tracked values are defined at compile time
|
// The tracked values are defined at compile time
|
||||||
AchievementVariable m_variables[ACHIEVE_DATA_NUM];
|
AchievementVariable m_variables[ACHIEVE_DATA_NUM];
|
||||||
|
@ -295,9 +295,19 @@ void World::reset(bool restart)
|
|||||||
if ((*i)->getController()->canGetAchievements())
|
if ((*i)->getController()->canGetAchievements())
|
||||||
{
|
{
|
||||||
if (race_manager->isLinearRaceMode())
|
if (race_manager->isLinearRaceMode())
|
||||||
|
{
|
||||||
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_STARTED);
|
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_STARTED);
|
||||||
|
AchievementsStatus::AchievementData diff;
|
||||||
|
diff = (race_manager->getDifficulty() == RaceManager::DIFFICULTY_EASY) ? AchievementsStatus::EASY_STARTED :
|
||||||
|
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_MEDIUM) ? AchievementsStatus::MEDIUM_STARTED :
|
||||||
|
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_HARD) ? AchievementsStatus::HARD_STARTED :
|
||||||
|
AchievementsStatus::BEST_STARTED;
|
||||||
|
PlayerManager::increaseAchievement(diff,1);
|
||||||
|
}
|
||||||
else if (race_manager->isEggHuntMode())
|
else if (race_manager->isEggHuntMode())
|
||||||
|
{
|
||||||
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_EGG_HUNT_STARTED);
|
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_EGG_HUNT_STARTED);
|
||||||
|
}
|
||||||
if (restart)
|
if (restart)
|
||||||
PlayerManager::onRaceEnd(true /* previous race aborted */);
|
PlayerManager::onRaceEnd(true /* previous race aborted */);
|
||||||
}
|
}
|
||||||
@ -641,6 +651,13 @@ void World::terminateRace()
|
|||||||
// Retrieve the current player
|
// Retrieve the current player
|
||||||
if (m_karts[i]->getController()->canGetAchievements())
|
if (m_karts[i]->getController()->canGetAchievements())
|
||||||
{
|
{
|
||||||
|
AchievementsStatus::AchievementData diff;
|
||||||
|
diff = (race_manager->getDifficulty() == RaceManager::DIFFICULTY_EASY) ? AchievementsStatus::EASY_FINISHED :
|
||||||
|
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_MEDIUM) ? AchievementsStatus::MEDIUM_FINISHED :
|
||||||
|
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_HARD) ? AchievementsStatus::HARD_FINISHED :
|
||||||
|
AchievementsStatus::BEST_FINISHED;
|
||||||
|
PlayerManager::increaseAchievement(diff,1);
|
||||||
|
|
||||||
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED);
|
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED);
|
||||||
if (race_manager->getReverseTrack())
|
if (race_manager->getReverseTrack())
|
||||||
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED_REVERSE);
|
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED_REVERSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user