mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add Low Health Vignette toggle in Settings > Interface
The persistent red-edge vignette (below 20% HP) now has an on/off checkbox under Settings > Interface > Screen Effects, alongside the existing Damage Flash toggle. The preference is persisted to settings.cfg.
This commit is contained in:
parent
8cba8033ba
commit
9a08edae09
2 changed files with 11 additions and 1 deletions
|
|
@ -83,6 +83,7 @@ private:
|
||||||
uint32_t lastPlayerHp_ = 0; // Previous frame HP for damage flash detection
|
uint32_t lastPlayerHp_ = 0; // Previous frame HP for damage flash detection
|
||||||
float damageFlashAlpha_ = 0.0f; // Screen edge flash intensity (fades to 0)
|
float damageFlashAlpha_ = 0.0f; // Screen edge flash intensity (fades to 0)
|
||||||
bool damageFlashEnabled_ = true;
|
bool damageFlashEnabled_ = true;
|
||||||
|
bool lowHealthVignetteEnabled_ = true; // Persistent pulsing red vignette below 20% HP
|
||||||
float levelUpFlashAlpha_ = 0.0f; // Golden level-up burst effect (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
|
uint32_t levelUpDisplayLevel_ = 0; // Level shown in level-up text
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -787,7 +787,7 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show when alive and below 20% HP; intensity increases as HP drops
|
// Only show when alive and below 20% HP; intensity increases as HP drops
|
||||||
if (!isDead && hpPct < 0.20f && hpPct > 0.0f) {
|
if (lowHealthVignetteEnabled_ && !isDead && hpPct < 0.20f && hpPct > 0.0f) {
|
||||||
// Base intensity from HP deficit (0 at 20%, 1 at 0%); pulse at ~1.5 Hz
|
// Base intensity from HP deficit (0 at 20%, 1 at 0%); pulse at ~1.5 Hz
|
||||||
float danger = (0.20f - hpPct) / 0.20f;
|
float danger = (0.20f - hpPct) / 0.20f;
|
||||||
float pulse = 0.55f + 0.45f * std::sin(static_cast<float>(ImGui::GetTime()) * 9.4f);
|
float pulse = 0.55f + 0.45f * std::sin(static_cast<float>(ImGui::GetTime()) * 9.4f);
|
||||||
|
|
@ -12021,6 +12021,12 @@ void GameScreen::renderSettingsWindow() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextDisabled("(red vignette on taking damage)");
|
ImGui::TextDisabled("(red vignette on taking damage)");
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Low Health Vignette", &lowHealthVignetteEnabled_)) {
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled("(pulsing red edges below 20%% HP)");
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
@ -13841,6 +13847,7 @@ void GameScreen::saveSettings() {
|
||||||
out << "right_bar_offset_y=" << pendingRightBarOffsetY << "\n";
|
out << "right_bar_offset_y=" << pendingRightBarOffsetY << "\n";
|
||||||
out << "left_bar_offset_y=" << pendingLeftBarOffsetY << "\n";
|
out << "left_bar_offset_y=" << pendingLeftBarOffsetY << "\n";
|
||||||
out << "damage_flash=" << (damageFlashEnabled_ ? 1 : 0) << "\n";
|
out << "damage_flash=" << (damageFlashEnabled_ ? 1 : 0) << "\n";
|
||||||
|
out << "low_health_vignette=" << (lowHealthVignetteEnabled_ ? 1 : 0) << "\n";
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
out << "sound_muted=" << (soundMuted_ ? 1 : 0) << "\n";
|
out << "sound_muted=" << (soundMuted_ ? 1 : 0) << "\n";
|
||||||
|
|
@ -13962,6 +13969,8 @@ void GameScreen::loadSettings() {
|
||||||
pendingLeftBarOffsetY = std::clamp(std::stof(val), -400.0f, 400.0f);
|
pendingLeftBarOffsetY = std::clamp(std::stof(val), -400.0f, 400.0f);
|
||||||
} else if (key == "damage_flash") {
|
} else if (key == "damage_flash") {
|
||||||
damageFlashEnabled_ = (std::stoi(val) != 0);
|
damageFlashEnabled_ = (std::stoi(val) != 0);
|
||||||
|
} else if (key == "low_health_vignette") {
|
||||||
|
lowHealthVignetteEnabled_ = (std::stoi(val) != 0);
|
||||||
}
|
}
|
||||||
// Audio
|
// Audio
|
||||||
else if (key == "sound_muted") {
|
else if (key == "sound_muted") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue