mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
Fixes to Achievement points count/mastery
Two minor updates to improve the Achievement Manager's handling of a player's completion rate. One, UnlockStatus and the unlock map now track achievement category, such that TallyScore does not count unofficial achievements in counts/points. Two, the determinations for mastery/completion are now improved to check (1) that the achievement triggering this is CORE (not UNOFFICIAL) and (2) that it has not already been unlocked at this level on the site, which should be sufficient to determine that the unlocking of this particular achievement completes/masters the game.
This commit is contained in:
@ -359,11 +359,11 @@ void AchievementManager::ActivateDeactivateAchievements()
|
|||||||
bool encore = Config::Get(Config::RA_ENCORE_ENABLED);
|
bool encore = Config::Get(Config::RA_ENCORE_ENABLED);
|
||||||
for (u32 ix = 0; ix < m_game_data.num_achievements; ix++)
|
for (u32 ix = 0; ix < m_game_data.num_achievements; ix++)
|
||||||
{
|
{
|
||||||
u32 points = (m_game_data.achievements[ix].category == RC_ACHIEVEMENT_CATEGORY_UNOFFICIAL) ?
|
auto iter =
|
||||||
0 :
|
m_unlock_map.insert({m_game_data.achievements[ix].id,
|
||||||
m_game_data.achievements[ix].points;
|
UnlockStatus{.game_data_index = ix,
|
||||||
auto iter = m_unlock_map.insert(
|
.points = m_game_data.achievements[ix].points,
|
||||||
{m_game_data.achievements[ix].id, UnlockStatus{.game_data_index = ix, .points = points}});
|
.category = m_game_data.achievements[ix].category}});
|
||||||
ActivateDeactivateAchievement(iter.first->first, enabled, unofficial, encore);
|
ActivateDeactivateAchievement(iter.first->first, enabled, unofficial, encore);
|
||||||
}
|
}
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Achievements (de)activated.");
|
INFO_LOG_FMT(ACHIEVEMENTS, "Achievements (de)activated.");
|
||||||
@ -800,6 +800,8 @@ AchievementManager::PointSpread AchievementManager::TallyScore() const
|
|||||||
return spread;
|
return spread;
|
||||||
for (const auto& entry : m_unlock_map)
|
for (const auto& entry : m_unlock_map)
|
||||||
{
|
{
|
||||||
|
if (entry.second.category != RC_ACHIEVEMENT_CATEGORY_CORE)
|
||||||
|
continue;
|
||||||
u32 points = entry.second.points;
|
u32 points = entry.second.points;
|
||||||
spread.total_count++;
|
spread.total_count++;
|
||||||
spread.total_points += points;
|
spread.total_points += points;
|
||||||
@ -1460,8 +1462,11 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_
|
|||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ?
|
(Config::Get(Config::RA_BADGES_ENABLED)) ?
|
||||||
DecodeBadgeToOSDIcon(it->second.unlocked_badge.badge) :
|
DecodeBadgeToOSDIcon(it->second.unlocked_badge.badge) :
|
||||||
nullptr);
|
nullptr);
|
||||||
|
if (m_game_data.achievements[game_data_index].category == RC_ACHIEVEMENT_CATEGORY_CORE)
|
||||||
|
{
|
||||||
PointSpread spread = TallyScore();
|
PointSpread spread = TallyScore();
|
||||||
if (spread.hard_points == spread.total_points)
|
if (spread.hard_points == spread.total_points &&
|
||||||
|
it->second.remote_unlock_status != UnlockStatus::UnlockType::HARDCORE)
|
||||||
{
|
{
|
||||||
OSD::AddMessage(
|
OSD::AddMessage(
|
||||||
fmt::format("Congratulations! {} has mastered {}", m_display_name, m_game_data.title),
|
fmt::format("Congratulations! {} has mastered {}", m_display_name, m_game_data.title),
|
||||||
@ -1469,7 +1474,8 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_
|
|||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
else if (spread.hard_points + spread.soft_points == spread.total_points)
|
else if (spread.hard_points + spread.soft_points == spread.total_points &&
|
||||||
|
it->second.remote_unlock_status == UnlockStatus::UnlockType::LOCKED)
|
||||||
{
|
{
|
||||||
OSD::AddMessage(
|
OSD::AddMessage(
|
||||||
fmt::format("Congratulations! {} has completed {}", m_display_name, m_game_data.title),
|
fmt::format("Congratulations! {} has completed {}", m_display_name, m_game_data.title),
|
||||||
@ -1477,6 +1483,7 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_
|
|||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ActivateDeactivateAchievement(event_id, Config::Get(Config::RA_ACHIEVEMENTS_ENABLED),
|
ActivateDeactivateAchievement(event_id, Config::Get(Config::RA_ACHIEVEMENTS_ENABLED),
|
||||||
Config::Get(Config::RA_UNOFFICIAL_ENABLED),
|
Config::Get(Config::RA_UNOFFICIAL_ENABLED),
|
||||||
Config::Get(Config::RA_ENCORE_ENABLED));
|
Config::Get(Config::RA_ENCORE_ENABLED));
|
||||||
|
@ -89,6 +89,7 @@ public:
|
|||||||
u32 points = 0;
|
u32 points = 0;
|
||||||
BadgeStatus locked_badge;
|
BadgeStatus locked_badge;
|
||||||
BadgeStatus unlocked_badge;
|
BadgeStatus unlocked_badge;
|
||||||
|
u32 category = RC_ACHIEVEMENT_CATEGORY_CORE;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::string_view GRAY = "transparent";
|
static constexpr std::string_view GRAY = "transparent";
|
||||||
|
Reference in New Issue
Block a user