diff --git a/src/core/achievements.cpp b/src/core/achievements.cpp index 13237d026..9b89f926a 100644 --- a/src/core/achievements.cpp +++ b/src/core/achievements.cpp @@ -79,6 +79,8 @@ static constexpr float ACHIEVEMENT_SUMMARY_NOTIFICATION_TIME = 5.0f; static constexpr float ACHIEVEMENT_SUMMARY_NOTIFICATION_TIME_HC = 10.0f; static constexpr float ACHIEVEMENT_SUMMARY_UNSUPPORTED_TIME = 12.0f; static constexpr float GAME_COMPLETE_NOTIFICATION_TIME = 20.0f; +static constexpr float CHALLENGE_STARTED_NOTIFICATION_TIME = 5.0f; +static constexpr float CHALLENGE_FAILED_NOTIFICATION_TIME = 5.0f; static constexpr float LEADERBOARD_STARTED_NOTIFICATION_TIME = 3.0f; static constexpr float LEADERBOARD_FAILED_NOTIFICATION_TIME = 3.0f; @@ -1729,16 +1731,18 @@ void Achievements::HandleAchievementChallengeIndicatorShowEvent(const rc_client_ // we still track these even if the option is disabled, so that they can be displayed in the pause menu if (g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::Notification) { - std::string description = fmt::format(TRANSLATE_FS("Achievements", "Challenge Started: {}"), - event->achievement->description ? event->achievement->description : ""); - GPUThread::RunOnThread([title = std::string(event->achievement->title), description = std::move(description), - badge_path, id = event->achievement->id]() mutable { - if (!FullscreenUI::Initialize()) - return; + std::string title = fmt::format(TRANSLATE_FS("Achievements", "Challenge Started: {}"), + event->achievement->title ? event->achievement->title : ""); + GPUThread::RunOnThread( + [title = std::move(title), + description = std::string(event->achievement->description ? event->achievement->description : ""), badge_path, + id = event->achievement->id]() mutable { + if (!FullscreenUI::Initialize()) + return; - ImGuiFullscreen::AddNotification(fmt::format("AchievementChallenge{}", id), LEADERBOARD_STARTED_NOTIFICATION_TIME, - std::move(title), std::move(description), std::move(badge_path)); - }); + ImGuiFullscreen::AddNotification(fmt::format("AchievementChallenge{}", id), CHALLENGE_STARTED_NOTIFICATION_TIME, + std::move(title), std::move(description), std::move(badge_path)); + }); } s_state.active_challenge_indicators.push_back( @@ -1761,6 +1765,23 @@ void Achievements::HandleAchievementChallengeIndicatorHideEvent(const rc_client_ DEV_LOG("Hide challenge indicator for {} ({})", event->achievement->id, event->achievement->title); + if (g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::Notification && + event->achievement->state == RC_CLIENT_ACHIEVEMENT_STATE_ACTIVE) + { + std::string title = fmt::format(TRANSLATE_FS("Achievements", "Challenge Failed: {}"), + event->achievement->title ? event->achievement->title : ""); + std::string badge_path = GetAchievementBadgePath(event->achievement, false); + GPUThread::RunOnThread( + [title = std::move(title), + description = std::string(event->achievement->description ? event->achievement->description : ""), + badge_path = std::move(badge_path), id = event->achievement->id]() mutable { + if (!FullscreenUI::Initialize()) + return; + + ImGuiFullscreen::AddNotification(fmt::format("AchievementChallenge{}", id), CHALLENGE_FAILED_NOTIFICATION_TIME, + std::move(title), std::move(description), std::move(badge_path)); + }); + } if (g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::Notification || g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::Disabled) { diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 8673a5b01..6b607b54e 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -4148,7 +4148,7 @@ void ImGuiFullscreen::DrawNotifications(ImVec2& position, float spacing) const float vertical_spacing = ImGuiFullscreen::LayoutScale(4.0f); const float badge_size = ImGuiFullscreen::LayoutScale(48.0f); const float min_width = ImGuiFullscreen::LayoutScale(200.0f); - const float max_width = ImGuiFullscreen::LayoutScale(800.0f); + const float max_width = ImGuiFullscreen::LayoutScale(600.0f); const float max_text_width = max_width - badge_size - (horizontal_padding * 2.0f) - horizontal_spacing; const float min_height = (vertical_padding * 2.0f) + badge_size; const float shadow_size = ImGuiFullscreen::LayoutScale(2.0f);