Add UIErrorsFrame: center-bottom spell error overlay with fade-out

This commit is contained in:
Kelsi 2026-03-12 01:15:11 -07:00
parent 955b22841e
commit 25e2c60603
4 changed files with 92 additions and 2 deletions

View file

@ -1269,6 +1269,11 @@ public:
using PlayPositionalSoundCallback = std::function<void(uint32_t soundId, uint64_t sourceGuid)>;
void setPlayPositionalSoundCallback(PlayPositionalSoundCallback cb) { playPositionalSoundCallback_ = std::move(cb); }
// UI error frame: prominent on-screen error messages (spell can't be cast, etc.)
using UIErrorCallback = std::function<void(const std::string& msg)>;
void setUIErrorCallback(UIErrorCallback cb) { uiErrorCallback_ = std::move(cb); }
void addUIError(const std::string& msg) { if (uiErrorCallback_) uiErrorCallback_(msg); }
// Mount state
using MountCallback = std::function<void(uint32_t mountDisplayId)>; // 0 = dismount
void setMountCallback(MountCallback cb) { mountCallback_ = std::move(cb); }
@ -2548,6 +2553,9 @@ private:
PlayMusicCallback playMusicCallback_;
PlaySoundCallback playSoundCallback_;
PlayPositionalSoundCallback playPositionalSoundCallback_;
// ---- UI error frame callback ----
UIErrorCallback uiErrorCallback_;
};
} // namespace game

View file

@ -76,6 +76,12 @@ private:
float damageFlashAlpha_ = 0.0f; // Screen edge flash intensity (fades to 0)
float levelUpFlashAlpha_ = 0.0f; // Golden level-up burst effect (fades to 0)
uint32_t levelUpDisplayLevel_ = 0; // Level shown in level-up text
// UIErrorsFrame: WoW-style center-bottom error messages (spell fails, out of range, etc.)
struct UIErrorEntry { std::string text; float age = 0.0f; };
std::vector<UIErrorEntry> uiErrors_;
bool uiErrorCallbackSet_ = false;
static constexpr float kUIErrorLifetime = 2.5f;
bool showPlayerInfo = false;
bool showSocialFrame_ = false; // O key toggles social/friends list
bool showGuildRoster_ = false;
@ -256,6 +262,7 @@ private:
void renderCombatText(game::GameHandler& gameHandler);
void renderPartyFrames(game::GameHandler& gameHandler);
void renderBossFrames(game::GameHandler& gameHandler);
void renderUIErrors(game::GameHandler& gameHandler, float deltaTime);
void renderGroupInvitePopup(game::GameHandler& gameHandler);
void renderDuelRequestPopup(game::GameHandler& gameHandler);
void renderLootRollPopup(game::GameHandler& gameHandler);