1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

add rarity and points to achievement unlock widget

This commit is contained in:
Jamiras 2024-06-11 14:54:09 -06:00 committed by LibretroAdmin
parent dfcf0c042c
commit 79cfce6033
3 changed files with 28 additions and 2 deletions

View File

@ -452,8 +452,29 @@ static void rcheevos_award_achievement(const rc_client_achievement_t* cheevo)
#if defined(HAVE_GFX_WIDGETS)
if (gfx_widgets_ready())
{
gfx_widgets_push_achievement(msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED),
cheevo->title, cheevo->badge_name);
char title[128], subtitle[96];
float rarity = rc_client_get_hardcore_enabled(rcheevos_locals.client) ?
cheevo->rarity_hardcore : cheevo->rarity;
if (rarity >= 10.0)
{
snprintf(title, sizeof(title), "%s - %0.2f%%",
msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED), rarity);
}
else if (rarity > 0.0)
{
snprintf(title, sizeof(title), "%s - %0.2f%%",
msg_hash_to_str(MSG_RARE_ACHIEVEMENT_UNLOCKED), rarity);
}
else
{
snprintf(title, sizeof(title), "%s",
msg_hash_to_str(MSG_ACHIEVEMENT_UNLOCKED));
}
snprintf(subtitle, sizeof(subtitle), "%s (%d)", cheevo->title, cheevo->points);
gfx_widgets_push_achievement(title, subtitle, cheevo->badge_name);
}
else
#endif

View File

@ -14975,6 +14975,10 @@ MSG_HASH(
MSG_ACHIEVEMENT_UNLOCKED,
"Achievement Unlocked"
)
MSG_HASH(
MSG_RARE_ACHIEVEMENT_UNLOCKED,
"Rare Achievement Unlocked"
)
MSG_HASH(
MSG_LEADERBOARD_STARTED,
"Leaderboard attempt started"

View File

@ -433,6 +433,7 @@ enum msg_hash_enums
MSG_TAKING_SCREENSHOT,
MSG_SCREENSHOT_SAVED,
MSG_ACHIEVEMENT_UNLOCKED,
MSG_RARE_ACHIEVEMENT_UNLOCKED,
MSG_LEADERBOARD_STARTED,
MSG_LEADERBOARD_FAILED,
MSG_LEADERBOARD_SUBMISSION,