refactor: add 6 color constants, replace 61 inline literals, remove const_cast
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

- Add kBrightGold, kPaleRed, kBrightRed, kLightBlue, kManaBlue, kCyan to ui_colors.hpp
- Replace 61 inline ImVec4 color literals across game_screen, inventory_screen,
  talent_screen, and world_map with named constants
- Remove const_cast in character_renderer render loop by using non-const iteration
This commit is contained in:
Kelsi 2026-03-27 10:08:30 -07:00
parent be694be558
commit 4090041431
6 changed files with 87 additions and 84 deletions

View file

@ -2015,8 +2015,8 @@ void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet,
VkPipeline currentPipeline = opaquePipeline_;
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, currentPipeline);
for (const auto& pair : instances) {
const auto& instance = pair.second;
for (auto& pair : instances) {
auto& instance = pair.second;
// Skip invisible instances (e.g., player in first-person mode)
if (!instance.visible) continue;
@ -2054,8 +2054,7 @@ void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet,
int numBones = std::min(static_cast<int>(instance.boneMatrices.size()), MAX_BONES);
if (numBones > 0) {
// Lazy-allocate bone SSBO on first use
auto& instMut = const_cast<CharacterInstance&>(instance);
if (!instMut.boneBuffer[frameIndex]) {
if (!instance.boneBuffer[frameIndex]) {
VkBufferCreateInfo bci{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
bci.size = MAX_BONES * sizeof(glm::mat4);
bci.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
@ -2064,34 +2063,34 @@ void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet,
aci.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
VmaAllocationInfo allocInfo{};
vmaCreateBuffer(vkCtx_->getAllocator(), &bci, &aci,
&instMut.boneBuffer[frameIndex], &instMut.boneAlloc[frameIndex], &allocInfo);
instMut.boneMapped[frameIndex] = allocInfo.pMappedData;
&instance.boneBuffer[frameIndex], &instance.boneAlloc[frameIndex], &allocInfo);
instance.boneMapped[frameIndex] = allocInfo.pMappedData;
// Allocate descriptor set for bone SSBO
VkDescriptorSetAllocateInfo ai{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
ai.descriptorPool = boneDescPool_;
ai.descriptorSetCount = 1;
ai.pSetLayouts = &boneSetLayout_;
VkResult dsRes = vkAllocateDescriptorSets(vkCtx_->getDevice(), &ai, &instMut.boneSet[frameIndex]);
VkResult dsRes = vkAllocateDescriptorSets(vkCtx_->getDevice(), &ai, &instance.boneSet[frameIndex]);
if (dsRes != VK_SUCCESS) {
LOG_ERROR("CharacterRenderer: bone descriptor allocation failed (instance=",
instMut.id, ", frame=", frameIndex, ", vk=", static_cast<int>(dsRes), ")");
if (instMut.boneBuffer[frameIndex]) {
instance.id, ", frame=", frameIndex, ", vk=", static_cast<int>(dsRes), ")");
if (instance.boneBuffer[frameIndex]) {
vmaDestroyBuffer(vkCtx_->getAllocator(),
instMut.boneBuffer[frameIndex], instMut.boneAlloc[frameIndex]);
instMut.boneBuffer[frameIndex] = VK_NULL_HANDLE;
instMut.boneAlloc[frameIndex] = VK_NULL_HANDLE;
instMut.boneMapped[frameIndex] = nullptr;
instance.boneBuffer[frameIndex], instance.boneAlloc[frameIndex]);
instance.boneBuffer[frameIndex] = VK_NULL_HANDLE;
instance.boneAlloc[frameIndex] = VK_NULL_HANDLE;
instance.boneMapped[frameIndex] = nullptr;
}
}
if (instMut.boneSet[frameIndex]) {
if (instance.boneSet[frameIndex]) {
VkDescriptorBufferInfo bufInfo{};
bufInfo.buffer = instMut.boneBuffer[frameIndex];
bufInfo.buffer = instance.boneBuffer[frameIndex];
bufInfo.offset = 0;
bufInfo.range = bci.size;
VkWriteDescriptorSet write{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET};
write.dstSet = instMut.boneSet[frameIndex];
write.dstSet = instance.boneSet[frameIndex];
write.dstBinding = 0;
write.descriptorCount = 1;
write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
@ -2101,15 +2100,15 @@ void CharacterRenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet,
}
// Upload bone matrices
if (instMut.boneMapped[frameIndex]) {
memcpy(instMut.boneMapped[frameIndex], instance.boneMatrices.data(),
if (instance.boneMapped[frameIndex]) {
memcpy(instance.boneMapped[frameIndex], instance.boneMatrices.data(),
numBones * sizeof(glm::mat4));
}
// Bind bone descriptor set (set 2)
if (instMut.boneSet[frameIndex]) {
if (instance.boneSet[frameIndex]) {
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
pipelineLayout_, 2, 1, &instMut.boneSet[frameIndex], 0, nullptr);
pipelineLayout_, 2, 1, &instance.boneSet[frameIndex], 0, nullptr);
}
}

View file

@ -10,6 +10,7 @@
#include "core/coordinates.hpp"
#include "core/input.hpp"
#include "core/logger.hpp"
#include "ui/ui_colors.hpp"
#include <imgui.h>
#include <cmath>
#include <cstdio>
@ -1295,7 +1296,7 @@ void WorldMap::renderImGuiOverlay(const glm::vec3& playerRenderPos, int screenWi
ImGui::SetCursorPos(ImVec2(mapX + 8.0f, mapY + 8.0f));
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.15f, 0.15f, 0.15f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.3f, 0.3f, 0.1f, 0.9f));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.85f, 0.0f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kBrightGold);
if (ImGui::Button("< Back")) goBack = true;
ImGui::PopStyleColor(3);
@ -1323,7 +1324,7 @@ void WorldMap::renderImGuiOverlay(const glm::vec3& playerRenderPos, int screenWi
ImGui::SetCursorPos(ImVec2(mapX + 8.0f, worldBtnY));
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.15f, 0.15f, 0.15f, 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.3f, 0.3f, 0.1f, 0.9f));
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.85f, 0.0f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kBrightGold);
if (ImGui::Button("< World")) goWorld = true;
ImGui::PopStyleColor(3);

View file

@ -1634,7 +1634,7 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
: gameHandler.getSpellName(sp.spellId);
if (!spText.empty()) {
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + 300.0f);
ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f),
ImGui::TextColored(colors::kCyan,
"%s: %s", triggerLabel, spText.c_str());
ImGui::PopTextWrapPos();
}
@ -1667,7 +1667,7 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
auto skPit = skills.find(info->requiredSkill);
if (skPit != skills.end()) playerSkillVal = skPit->second.effectiveValue();
bool meetsSkill = (playerSkillVal == 0 || playerSkillVal >= info->requiredSkillRank);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : colors::kPaleRed;
auto skIt = s_skillNames.find(info->requiredSkill);
if (skIt != s_skillNames.end())
ImGui::TextColored(skColor, "Requires %s (%u)", skIt->second.c_str(), info->requiredSkillRank);
@ -1734,7 +1734,7 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
uint8_t pc = gameHandler.getPlayerClass();
uint32_t pmask = (pc > 0 && pc <= 10) ? (1u << (pc - 1)) : 0u;
bool playerAllowed = (pmask == 0 || (info->allowableClass & pmask));
ImVec4 clColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 clColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : colors::kPaleRed;
ImGui::TextColored(clColor, "%s", classBuf);
}
}
@ -1769,7 +1769,7 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
uint8_t pr = gameHandler.getPlayerRace();
uint32_t pmask = (pr > 0 && pr <= 11) ? (1u << (pr - 1)) : 0u;
bool playerAllowed = (pmask == 0 || (info->allowableRace & pmask));
ImVec4 rColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 rColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : colors::kPaleRed;
ImGui::TextColored(rColor, "%s", raceBuf);
}
}
@ -2032,7 +2032,7 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
} else {
// --- Achievement link ---
std::string display = "[" + linkName + "]";
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.85f, 0.0f, 1.0f)); // gold
ImGui::PushStyleColor(ImGuiCol_Text, colors::kBrightGold); // gold
ImGui::TextWrapped("%s", display.c_str());
ImGui::PopStyleColor();
@ -2503,14 +2503,14 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
ImVec4 inputColor;
switch (selectedChatType) {
case 1: inputColor = kColorRed; break; // YELL - red
case 2: inputColor = ImVec4(0.4f, 0.6f, 1.0f, 1.0f); break; // PARTY - blue
case 2: inputColor = colors::kLightBlue; break; // PARTY - blue
case 3: inputColor = kColorBrightGreen; break; // GUILD - green
case 4: inputColor = ImVec4(1.0f, 0.5f, 1.0f, 1.0f); break; // WHISPER - pink
case 5: inputColor = ImVec4(1.0f, 0.5f, 0.0f, 1.0f); break; // RAID - orange
case 6: inputColor = kColorBrightGreen; break; // OFFICER - green
case 7: inputColor = ImVec4(1.0f, 0.5f, 0.0f, 1.0f); break; // BG - orange
case 8: inputColor = ImVec4(1.0f, 0.3f, 0.0f, 1.0f); break; // RAID WARNING - red-orange
case 9: inputColor = ImVec4(0.4f, 0.6f, 1.0f, 1.0f); break; // INSTANCE - blue
case 9: inputColor = colors::kLightBlue; break; // INSTANCE - blue
case 10: inputColor = ImVec4(0.3f, 0.9f, 0.9f, 1.0f); break; // CHANNEL - cyan
default: inputColor = ui::colors::kWhite; break; // SAY - white
}
@ -3301,7 +3301,7 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
ImVec4 playerBorder = isDead
? kColorDarkGray
: (inCombatConfirmed
? ImVec4(1.0f, 0.2f, 0.2f, 1.0f)
? colors::kBrightRed
: (attackIntentOnly
? ImVec4(1.0f, 0.7f, 0.2f, 1.0f)
: ImVec4(0.4f, 0.4f, 0.4f, 1.0f)));
@ -3468,7 +3468,7 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
float pulse = 0.6f + 0.4f * std::sin(static_cast<float>(ImGui::GetTime()) * 3.0f);
powerColor = ImVec4(0.1f, 0.1f, 0.8f * pulse, 1.0f);
} else {
powerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f);
powerColor = colors::kManaBlue;
}
break;
}
@ -3478,7 +3478,7 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
case 4: powerColor = ImVec4(0.5f, 0.9f, 0.3f, 1.0f); break; // Happiness (green)
case 6: powerColor = ImVec4(0.8f, 0.1f, 0.2f, 1.0f); break; // Runic Power (crimson)
case 7: powerColor = ImVec4(0.4f, 0.1f, 0.6f, 1.0f); break; // Soul Shards (purple)
default: powerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break;
default: powerColor = colors::kManaBlue; break;
}
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, powerColor);
char mpOverlay[64];
@ -3807,11 +3807,11 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
float mpPct = static_cast<float>(power) / static_cast<float>(maxPower);
ImVec4 powerColor;
switch (powerType) {
case 0: powerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break; // Mana
case 0: powerColor = colors::kManaBlue; break; // Mana
case 1: powerColor = ImVec4(0.9f, 0.2f, 0.2f, 1.0f); break; // Rage
case 2: powerColor = ImVec4(0.9f, 0.6f, 0.1f, 1.0f); break; // Focus (hunter pets)
case 3: powerColor = ImVec4(0.9f, 0.9f, 0.2f, 1.0f); break; // Energy
default: powerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break;
default: powerColor = colors::kManaBlue; break;
}
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, powerColor);
char mpText[32];
@ -3858,7 +3858,7 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
static const char* kReactLabels[] = { "Psv", "Def", "Agg" };
static const char* kReactTooltips[] = { "Passive", "Defensive", "Aggressive" };
static const ImVec4 kReactColors[] = {
ImVec4(0.4f, 0.6f, 1.0f, 1.0f), // passive — blue
colors::kLightBlue, // passive — blue
ImVec4(0.3f, 0.85f, 0.3f, 1.0f), // defensive — green
ImVec4(1.0f, 0.35f, 0.35f, 1.0f),// aggressive — red
};
@ -4300,7 +4300,7 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
QGS qgs = gameHandler.getQuestGiverStatus(target->getGuid());
if (qgs == QGS::AVAILABLE) {
ImGui::SameLine(0, 4);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "!");
ImGui::TextColored(colors::kBrightGold, "!");
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Has a quest available");
} else if (qgs == QGS::AVAILABLE_LOW) {
ImGui::SameLine(0, 4);
@ -4308,7 +4308,7 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Has a low-level quest available");
} else if (qgs == QGS::REWARD || qgs == QGS::REWARD_REP) {
ImGui::SameLine(0, 4);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "?");
ImGui::TextColored(colors::kBrightGold, "?");
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Quest ready to turn in");
} else if (qgs == QGS::INCOMPLETE) {
ImGui::SameLine(0, 4);
@ -4489,14 +4489,14 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
float mpPct = static_cast<float>(targetPower) / static_cast<float>(targetMaxPower);
ImVec4 targetPowerColor;
switch (targetPowerType) {
case 0: targetPowerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break; // Mana (blue)
case 0: targetPowerColor = colors::kManaBlue; break; // Mana (blue)
case 1: targetPowerColor = ImVec4(0.9f, 0.2f, 0.2f, 1.0f); break; // Rage (red)
case 2: targetPowerColor = ImVec4(0.9f, 0.6f, 0.1f, 1.0f); break; // Focus (orange)
case 3: targetPowerColor = ImVec4(0.9f, 0.9f, 0.2f, 1.0f); break; // Energy (yellow)
case 4: targetPowerColor = ImVec4(0.5f, 0.9f, 0.3f, 1.0f); break; // Happiness (green)
case 6: targetPowerColor = ImVec4(0.8f, 0.1f, 0.2f, 1.0f); break; // Runic Power (crimson)
case 7: targetPowerColor = ImVec4(0.4f, 0.1f, 0.6f, 1.0f); break; // Soul Shards (purple)
default: targetPowerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break;
default: targetPowerColor = colors::kManaBlue; break;
}
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, targetPowerColor);
char mpOverlay[64];
@ -5237,13 +5237,13 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
QGS qgs = gameHandler.getQuestGiverStatus(focus->getGuid());
if (qgs == QGS::AVAILABLE) {
ImGui::SameLine(0, 4);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "!");
ImGui::TextColored(colors::kBrightGold, "!");
} else if (qgs == QGS::AVAILABLE_LOW) {
ImGui::SameLine(0, 4);
ImGui::TextColored(kColorGray, "!");
} else if (qgs == QGS::REWARD || qgs == QGS::REWARD_REP) {
ImGui::SameLine(0, 4);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "?");
ImGui::TextColored(colors::kBrightGold, "?");
} else if (qgs == QGS::INCOMPLETE) {
ImGui::SameLine(0, 4);
ImGui::TextColored(kColorGray, "?");
@ -5363,11 +5363,11 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
float mpPct = static_cast<float>(pwr) / static_cast<float>(maxPwr);
ImVec4 pwrColor;
switch (pType) {
case 0: pwrColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break;
case 0: pwrColor = colors::kManaBlue; break;
case 1: pwrColor = ImVec4(0.9f, 0.2f, 0.2f, 1.0f); break;
case 3: pwrColor = ImVec4(0.9f, 0.9f, 0.2f, 1.0f); break;
case 6: pwrColor = ImVec4(0.8f, 0.1f, 0.2f, 1.0f); break;
default: pwrColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break;
default: pwrColor = colors::kManaBlue; break;
}
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, pwrColor);
ImGui::ProgressBar(mpPct, ImVec2(-1, 10), "");
@ -8289,7 +8289,7 @@ ImVec4 GameScreen::getChatTypeColor(game::ChatType type) const {
case game::ChatType::GUILD_ACHIEVEMENT:
return ImVec4(1.0f, 0.84f, 0.0f, 1.0f); // Gold
case game::ChatType::SKILL:
return ImVec4(0.0f, 0.8f, 1.0f, 1.0f); // Cyan
return colors::kCyan; // Cyan
case game::ChatType::LOOT:
return ImVec4(0.8f, 0.5f, 1.0f, 1.0f); // Light purple
case game::ChatType::MONSTER_WHISPER:
@ -12489,7 +12489,7 @@ void GameScreen::renderPartyFrames(game::GameHandler& gameHandler) {
// Clickable name to target — use WoW class colors when entity is loaded,
// fall back to gold for leader / light gray for others
ImVec4 nameColor = isLeader
? ImVec4(1.0f, 0.85f, 0.0f, 1.0f)
? colors::kBrightGold
: ImVec4(0.85f, 0.85f, 0.85f, 1.0f);
{
auto memberEntity = gameHandler.getEntityManager().getEntity(member.guid);
@ -12631,7 +12631,7 @@ void GameScreen::renderPartyFrames(game::GameHandler& gameHandler) {
float powerPct = static_cast<float>(member.curPower) / static_cast<float>(member.maxPower);
ImVec4 powerColor;
switch (member.powerType) {
case 0: powerColor = ImVec4(0.2f, 0.2f, 0.9f, 1.0f); break; // Mana (blue)
case 0: powerColor = colors::kManaBlue; break; // Mana (blue)
case 1: powerColor = ImVec4(0.9f, 0.2f, 0.2f, 1.0f); break; // Rage (red)
case 2: powerColor = ImVec4(0.9f, 0.6f, 0.1f, 1.0f); break; // Focus (orange)
case 3: powerColor = ImVec4(0.9f, 0.9f, 0.2f, 1.0f); break; // Energy (yellow)
@ -13667,7 +13667,7 @@ void GameScreen::renderSharedQuestPopup(game::GameHandler& gameHandler) {
if (ImGui::Begin("Shared Quest", nullptr, kDialogFlags)) {
ImGui::Text("%s has shared a quest with you:", gameHandler.getSharedQuestSharerName().c_str());
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "\"%s\"", gameHandler.getSharedQuestTitle().c_str());
ImGui::TextColored(colors::kBrightGold, "\"%s\"", gameHandler.getSharedQuestTitle().c_str());
ImGui::Spacing();
if (ImGui::Button("Accept", ImVec2(130, 30))) {
@ -17866,7 +17866,7 @@ void GameScreen::renderDeathScreen(game::GameHandler& gameHandler) {
const char* deathText = "You are dead.";
float textW = ImGui::CalcTextSize(deathText).x;
ImGui::SetCursorPosX((dlgW - textW) / 2);
ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), "%s", deathText);
ImGui::TextColored(colors::kBrightRed, "%s", deathText);
// Respawn timer: show how long until the server auto-releases the spirit
float timeLeft = kForcedReleaseSec - deathElapsed_;
@ -18784,9 +18784,6 @@ void GameScreen::renderSettingsWindow() {
constexpr bool kDefaultFullscreen = false;
constexpr bool kDefaultVsync = true;
constexpr bool kDefaultShadows = true;
constexpr int kDefaultMusicVolume = 30;
constexpr float kDefaultMouseSensitivity = 0.2f;
constexpr bool kDefaultInvertMouse = false;
constexpr int kDefaultGroundClutterDensity = 100;
int defaultResIndex = 0;
@ -21450,7 +21447,7 @@ void GameScreen::renderMailWindow(game::GameHandler& gameHandler) {
ImGui::SameLine();
int daysLeft = static_cast<int>(secsLeft / 86400.0f);
if (daysLeft == 0) {
ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), " [expires today!]");
ImGui::TextColored(colors::kBrightRed, " [expires today!]");
} else {
ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.1f, 1.0f),
" [expires in %dd]", daysLeft);
@ -24077,7 +24074,7 @@ void GameScreen::renderBattlegroundScore(game::GameHandler& gameHandler) {
// BG name centred at top
float nameW = ImGui::CalcTextSize(def->name).x;
ImGui::SetCursorPosX((frameW - nameW) / 2.0f);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "%s", def->name);
ImGui::TextColored(colors::kBrightGold, "%s", def->name);
// Alliance score | separator | Horde score
float innerW = frameW - 12.0f;
@ -24092,7 +24089,7 @@ void GameScreen::renderBattlegroundScore(game::GameHandler& gameHandler) {
snprintf(aBuf, sizeof(aBuf), "\xF0\x9F\x94\xB5 %u / %u", allianceScore, maxScore);
else
snprintf(aBuf, sizeof(aBuf), "\xF0\x9F\x94\xB5 %u", allianceScore);
ImGui::TextColored(ImVec4(0.4f, 0.6f, 1.0f, 1.0f), "%s", aBuf);
ImGui::TextColored(colors::kLightBlue, "%s", aBuf);
}
ImGui::EndGroup();
@ -24319,7 +24316,7 @@ void GameScreen::renderCombatLog(game::GameHandler& gameHandler) {
break;
case T::CRIT_DAMAGE:
snprintf(desc, sizeof(desc), "%s crits %s for %d!", src, tgt, e.amount);
color = e.isPlayerSource ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
color = e.isPlayerSource ? ImVec4(1.0f, 1.0f, 0.0f, 1.0f) : colors::kBrightRed;
break;
case T::SPELL_DAMAGE:
if (spell)
@ -24462,7 +24459,7 @@ void GameScreen::renderCombatLog(game::GameHandler& gameHandler) {
snprintf(desc, sizeof(desc), "%s gains %d %s (%s)", tgt, e.amount, pwrName, spell);
else
snprintf(desc, sizeof(desc), "%s gains %d %s", tgt, e.amount, pwrName);
color = ImVec4(0.4f, 0.6f, 1.0f, 1.0f);
color = colors::kLightBlue;
break;
}
case T::POWER_DRAIN: {
@ -24535,11 +24532,11 @@ void GameScreen::renderCombatLog(game::GameHandler& gameHandler) {
snprintf(desc, sizeof(desc), "You instantly kill %s", tgt);
else
snprintf(desc, sizeof(desc), "%s instantly kills %s", src, tgt);
color = ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
color = colors::kBrightRed;
break;
case T::HONOR_GAIN:
snprintf(desc, sizeof(desc), "You gain %d honor", e.amount);
color = ImVec4(1.0f, 0.85f, 0.0f, 1.0f);
color = colors::kBrightGold;
break;
case T::GLANCING:
snprintf(desc, sizeof(desc), "%s glances %s for %d", src, tgt, e.amount);
@ -24628,7 +24625,7 @@ void GameScreen::renderAchievementWindow(game::GameHandler& gameHandler) {
if (lower.find(filter) == std::string::npos) continue;
}
ImGui::PushID(static_cast<int>(id));
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "\xE2\x98\x85");
ImGui::TextColored(colors::kBrightGold, "\xE2\x98\x85");
ImGui::SameLine();
ImGui::TextUnformatted(display.c_str());
if (ImGui::IsItemHovered()) {
@ -24636,7 +24633,7 @@ void GameScreen::renderAchievementWindow(game::GameHandler& gameHandler) {
// Points badge
uint32_t pts = gameHandler.getAchievementPoints(id);
if (pts > 0) {
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f),
ImGui::TextColored(colors::kBrightGold,
"%u Achievement Point%s", pts, pts == 1 ? "" : "s");
ImGui::Separator();
}
@ -24984,7 +24981,7 @@ void GameScreen::renderBgScoreboard(game::GameHandler& gameHandler) {
if (at.teamName.empty()) continue;
int32_t ratingDelta = static_cast<int32_t>(at.ratingChange);
ImVec4 teamCol = (t == 0) ? ImVec4(1.0f, 0.35f, 0.35f, 1.0f) // team 0: red
: ImVec4(0.4f, 0.6f, 1.0f, 1.0f); // team 1: blue
: colors::kLightBlue; // team 1: blue
ImGui::TextColored(teamCol, "%s", at.teamName.c_str());
ImGui::SameLine();
char ratingBuf[32];
@ -25006,17 +25003,17 @@ void GameScreen::renderBgScoreboard(game::GameHandler& gameHandler) {
const auto& winTeam = data->arenaTeams[data->winner & 1];
winnerStr = winTeam.teamName.empty() ? "Team 1" : winTeam.teamName.c_str();
winnerColor = (data->winner == 0) ? ImVec4(1.0f, 0.35f, 0.35f, 1.0f)
: ImVec4(0.4f, 0.6f, 1.0f, 1.0f);
: colors::kLightBlue;
} else {
winnerStr = (data->winner == 1) ? "Alliance" : "Horde";
winnerColor = (data->winner == 1) ? ImVec4(0.4f, 0.6f, 1.0f, 1.0f)
winnerColor = (data->winner == 1) ? colors::kLightBlue
: ImVec4(1.0f, 0.35f, 0.35f, 1.0f);
}
float textW = ImGui::CalcTextSize(winnerStr).x + ImGui::CalcTextSize(" Victory!").x;
ImGui::SetCursorPosX((ImGui::GetContentRegionAvail().x - textW) * 0.5f);
ImGui::TextColored(winnerColor, "%s", winnerStr);
ImGui::SameLine(0, 4);
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "Victory!");
ImGui::TextColored(colors::kBrightGold, "Victory!");
ImGui::Separator();
}
@ -25082,14 +25079,14 @@ void GameScreen::renderBgScoreboard(game::GameHandler& gameHandler) {
// Team
ImGui::TableNextColumn();
if (ps->team == 1)
ImGui::TextColored(ImVec4(0.4f, 0.6f, 1.0f, 1.0f), "Alliance");
ImGui::TextColored(colors::kLightBlue, "Alliance");
else
ImGui::TextColored(ImVec4(1.0f, 0.35f, 0.35f, 1.0f), "Horde");
// Name (highlight player's own row)
ImGui::TableNextColumn();
bool isSelf = (ps->guid == playerGuid);
if (isSelf) ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.85f, 0.0f, 1.0f));
if (isSelf) ImGui::PushStyleColor(ImGuiCol_Text, colors::kBrightGold);
const char* nameStr = ps->name.empty() ? "Unknown" : ps->name.c_str();
ImGui::TextUnformatted(nameStr);
if (isSelf) ImGui::PopStyleColor();
@ -25433,7 +25430,7 @@ void GameScreen::renderTitlesWindow(game::GameHandler& gameHandler) {
}
if (noTitle) {
ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "<-- active");
ImGui::TextColored(colors::kBrightGold, "<-- active");
}
ImGui::Separator();
@ -25452,7 +25449,7 @@ void GameScreen::renderTitlesWindow(game::GameHandler& gameHandler) {
ImGui::PushID(static_cast<int>(bit));
if (isActive) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.85f, 0.0f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Text, colors::kBrightGold);
}
if (ImGui::Selectable(display.c_str(), isActive)) {
if (!isActive) gameHandler.sendSetTitle(static_cast<int32_t>(bit));

View file

@ -2613,7 +2613,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
else if (qi->itemClass == 4 && qi->subClass > 0) // Armor (skip subclass 0 = misc)
canUse = gameHandler_->canUseArmorSubclass(qi->subClass);
if (!canUse)
ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), "You can't use this type of item.");
ImGui::TextColored(ui::colors::kBrightRed, "You can't use this type of item.");
}
}
}
@ -2728,7 +2728,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
if (item.requiredLevel > 1) {
uint32_t playerLvl = gameHandler_ ? gameHandler_->getPlayerLevel() : 0;
bool meetsReq = (playerLvl >= item.requiredLevel);
ImVec4 reqColor = meetsReq ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 reqColor = meetsReq ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
ImGui::TextColored(reqColor, "Requires Level %u", item.requiredLevel);
}
if (item.maxDurability > 0) {
@ -2736,7 +2736,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
ImVec4 durColor;
if (durPct > 0.5f) durColor = ImVec4(0.1f, 1.0f, 0.1f, 1.0f); // green
else if (durPct > 0.25f) durColor = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); // yellow
else durColor = ImVec4(1.0f, 0.2f, 0.2f, 1.0f); // red
else durColor = ui::colors::kBrightRed; // red
ImGui::TextColored(durColor, "Durability %u / %u",
item.curDurability, item.maxDurability);
}
@ -2761,11 +2761,11 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
const std::string& spText = spDesc.empty() ? gameHandler_->getSpellName(sp.spellId) : spDesc;
if (!spText.empty()) {
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + 320.0f);
ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f),
ImGui::TextColored(ui::colors::kCyan,
"%s: %s", trigger, spText.c_str());
ImGui::PopTextWrapPos();
} else {
ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f),
ImGui::TextColored(ui::colors::kCyan,
"%s: Spell #%u", trigger, sp.spellId);
}
}
@ -2800,7 +2800,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
auto skPit = skills.find(qInfo->requiredSkill);
if (skPit != skills.end()) playerSkillVal = skPit->second.effectiveValue();
bool meetsSkill = (playerSkillVal == 0 || playerSkillVal >= qInfo->requiredSkillRank);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
auto skIt = s_skillNamesB.find(qInfo->requiredSkill);
if (skIt != s_skillNamesB.end())
ImGui::TextColored(skColor, "Requires %s (%u)", skIt->second.c_str(), qInfo->requiredSkillRank);
@ -3024,7 +3024,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
if (permId != 0) {
auto it2 = s_enchLookupB.find(permId);
const char* ename = (it2 != s_enchLookupB.end()) ? it2->second.c_str() : nullptr;
if (ename) ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f), "Enchanted: %s", ename);
if (ename) ImGui::TextColored(ui::colors::kCyan, "Enchanted: %s", ename);
}
if (tempId != 0) {
auto it2 = s_enchLookupB.find(tempId);
@ -3226,7 +3226,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
else if (info.itemClass == 4 && info.subClass > 0) // Armor (skip subclass 0 = misc)
canUse = gameHandler_->canUseArmorSubclass(info.subClass);
if (!canUse)
ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), "You can't use this type of item.");
ImGui::TextColored(ui::colors::kBrightRed, "You can't use this type of item.");
}
}
@ -3306,7 +3306,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
if (info.requiredLevel > 1) {
uint32_t playerLvl = gameHandler_ ? gameHandler_->getPlayerLevel() : 0;
bool meetsReq = (playerLvl >= info.requiredLevel);
ImVec4 reqColor = meetsReq ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 reqColor = meetsReq ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
ImGui::TextColored(reqColor, "Requires Level %u", info.requiredLevel);
}
@ -3338,7 +3338,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
if (skPit != skills.end()) playerSkillVal = skPit->second.effectiveValue();
}
bool meetsSkill = (playerSkillVal == 0 || playerSkillVal >= info.requiredSkillRank);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 skColor = meetsSkill ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
auto skIt = s_skillNames.find(info.requiredSkill);
if (skIt != s_skillNames.end())
ImGui::TextColored(skColor, "Requires %s (%u)", skIt->second.c_str(), info.requiredSkillRank);
@ -3413,7 +3413,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
uint32_t pmask = (pc > 0 && pc <= 10) ? (1u << (pc - 1)) : 0;
playerAllowed = (pmask == 0 || (info.allowableClass & pmask));
}
ImVec4 clColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 clColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
ImGui::TextColored(clColor, "%s", classBuf);
}
}
@ -3453,7 +3453,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
uint32_t pmask = (pr > 0 && pr <= 11) ? (1u << (pr - 1)) : 0;
playerAllowed = (pmask == 0 || (info.allowableRace & pmask));
}
ImVec4 rColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ImVec4(1.0f, 0.5f, 0.5f, 1.0f);
ImVec4 rColor = playerAllowed ? ImVec4(1.0f, 1.0f, 1.0f, 0.75f) : ui::colors::kPaleRed;
ImGui::TextColored(rColor, "%s", raceBuf);
}
}
@ -3480,10 +3480,10 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
const std::string& spName = spDesc.empty() ? gameHandler_->getSpellName(sp.spellId) : spDesc;
if (!spName.empty()) {
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + 320.0f);
ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f), "%s: %s", trigger, spName.c_str());
ImGui::TextColored(ui::colors::kCyan, "%s: %s", trigger, spName.c_str());
ImGui::PopTextWrapPos();
} else {
ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f), "%s: Spell #%u", trigger, sp.spellId);
ImGui::TextColored(ui::colors::kCyan, "%s: Spell #%u", trigger, sp.spellId);
}
}
}
@ -3535,7 +3535,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
if (permId != 0) {
auto it2 = s_enchLookup.find(permId);
const char* ename = (it2 != s_enchLookup.end()) ? it2->second.c_str() : nullptr;
if (ename) ImGui::TextColored(ImVec4(0.0f, 0.8f, 1.0f, 1.0f), "Enchanted: %s", ename);
if (ename) ImGui::TextColored(ui::colors::kCyan, "Enchanted: %s", ename);
}
if (tempId != 0) {
auto it2 = s_enchLookup.find(tempId);

View file

@ -695,7 +695,7 @@ void TalentScreen::renderGlyphs(game::GameHandler& gameHandler) {
const auto& glyphs = gameHandler.getGlyphs();
ImGui::Spacing();
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "Major Glyphs");
ImGui::TextColored(ui::colors::kBrightGold, "Major Glyphs");
ImGui::Separator();
// WotLK: 6 glyph slots total. Slots 0,2,4 are major by convention from the server,