Added Notification Popups for Game Start

Added an OnScreenDisplay message to LoadGameByFilenameAsync to display a message when a player starts a game with achievements, notifying them of their current score. The score displayed is challenge points if the player is in challenge mode or challenge + casual if the player is in casual mode. A second message tells the player which mode they are in. To match RetroAchievements' website interface, the messages are blue for casual and gold for challenge.
This commit is contained in:
LillyJadeKatrin 2023-05-23 08:51:54 -04:00
parent aa0224a8ab
commit 1841089054
1 changed files with 18 additions and 1 deletions

View File

@ -156,6 +156,23 @@ void AchievementManager::LoadGameByFilenameAsync(const std::string& iso_path,
std::lock_guard lg{m_lock}; std::lock_guard lg{m_lock};
LoadUnlockData([](ResponseType r_type) {}); LoadUnlockData([](ResponseType r_type) {});
ActivateDeactivateAchievements(); ActivateDeactivateAchievements();
PointSpread spread = TallyScore();
if (hardcore_mode_enabled)
{
OSD::AddMessage(fmt::format("You have {}/{} achievements worth {}/{} points",
spread.hard_unlocks, spread.total_count, spread.hard_points,
spread.total_points),
OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
OSD::AddMessage("Hardcore mode is ON", OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
}
else
{
OSD::AddMessage(fmt::format("You have {}/{} achievements worth {}/{} points",
spread.hard_unlocks + spread.soft_unlocks, spread.total_count,
spread.hard_points + spread.soft_points, spread.total_points),
OSD::Duration::VERY_LONG, OSD::Color::CYAN);
OSD::AddMessage("Hardcore mode is OFF", OSD::Duration::VERY_LONG, OSD::Color::CYAN);
}
} }
ActivateDeactivateLeaderboards(); ActivateDeactivateLeaderboards();
ActivateDeactivateRichPresence(); ActivateDeactivateRichPresence();
@ -591,7 +608,7 @@ AchievementManager::PointSpread AchievementManager::TallyScore() const
spread.hard_points += points; spread.hard_points += points;
} }
else if (entry.second.remote_unlock_status == UnlockStatus::UnlockType::SOFTCORE || else if (entry.second.remote_unlock_status == UnlockStatus::UnlockType::SOFTCORE ||
entry.second.session_unlock_count > 0) entry.second.session_unlock_count > 0)
{ {
spread.soft_unlocks++; spread.soft_unlocks++;
spread.soft_points += points; spread.soft_points += points;