From 71837ade19e3adbafcfea78ad02a009d9c0ff090 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 18:12:23 -0700 Subject: [PATCH] feat: show zone name on loading screen during world transitions Add setZoneName() to LoadingScreen and display the map name from Map.dbc as large gold text with drop shadow above the progress bar. Shown in both render() and renderOverlay() paths. Zone name is resolved from gameHandler's getMapName(mapId) during world load. Improves feedback during zone transitions. --- include/rendering/loading_screen.hpp | 2 ++ src/core/application.cpp | 9 +++++++++ src/rendering/loading_screen.cpp | 30 ++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/rendering/loading_screen.hpp b/include/rendering/loading_screen.hpp index afd134b9..a0ed13a5 100644 --- a/include/rendering/loading_screen.hpp +++ b/include/rendering/loading_screen.hpp @@ -30,6 +30,7 @@ public: void setProgress(float progress) { loadProgress = progress; } void setStatus(const std::string& status) { statusText = status; } + void setZoneName(const std::string& name) { zoneName = name; } // Must be set before initialize() for Vulkan texture upload void setVkContext(VkContext* ctx) { vkCtx = ctx; } @@ -53,6 +54,7 @@ private: float loadProgress = 0.0f; std::string statusText = "Loading..."; + std::string zoneName; int imageWidth = 0; int imageHeight = 0; diff --git a/src/core/application.cpp b/src/core/application.cpp index ce3883db..a0c8e1a7 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -4286,6 +4286,15 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float window->swapBuffers(); }; + // Set zone name on loading screen from Map.dbc + if (gameHandler) { + std::string mapDisplayName = gameHandler->getMapName(mapId); + if (!mapDisplayName.empty()) + loadingScreen.setZoneName(mapDisplayName); + else + loadingScreen.setZoneName("Loading..."); + } + showProgress("Entering world...", 0.0f); // --- Clean up previous map's state on map change --- diff --git a/src/rendering/loading_screen.cpp b/src/rendering/loading_screen.cpp index a2e83a2b..92c1fe1c 100644 --- a/src/rendering/loading_screen.cpp +++ b/src/rendering/loading_screen.cpp @@ -261,6 +261,20 @@ void LoadingScreen::renderOverlay() { ImVec2(0, 0), ImVec2(screenW, screenH)); } + // Zone name header + if (!zoneName.empty()) { + ImFont* font = ImGui::GetFont(); + float zoneTextSize = 24.0f; + ImVec2 zoneSize = font->CalcTextSizeA(zoneTextSize, FLT_MAX, 0.0f, zoneName.c_str()); + float zoneX = (screenW - zoneSize.x) * 0.5f; + float zoneY = screenH * 0.06f - 44.0f; + ImDrawList* dl = ImGui::GetWindowDrawList(); + dl->AddText(font, zoneTextSize, ImVec2(zoneX + 2.0f, zoneY + 2.0f), + IM_COL32(0, 0, 0, 200), zoneName.c_str()); + dl->AddText(font, zoneTextSize, ImVec2(zoneX, zoneY), + IM_COL32(255, 220, 120, 255), zoneName.c_str()); + } + // Progress bar { const float barWidthFrac = 0.6f; @@ -332,6 +346,22 @@ void LoadingScreen::render() { ImVec2(0, 0), ImVec2(screenW, screenH)); } + // Zone name header (large text centered above progress bar) + if (!zoneName.empty()) { + ImFont* font = ImGui::GetFont(); + float zoneTextSize = 24.0f; + ImVec2 zoneSize = font->CalcTextSizeA(zoneTextSize, FLT_MAX, 0.0f, zoneName.c_str()); + float zoneX = (screenW - zoneSize.x) * 0.5f; + float zoneY = screenH * 0.06f - 44.0f; // above percentage text + ImDrawList* dl = ImGui::GetWindowDrawList(); + // Drop shadow + dl->AddText(font, zoneTextSize, ImVec2(zoneX + 2.0f, zoneY + 2.0f), + IM_COL32(0, 0, 0, 200), zoneName.c_str()); + // Gold text + dl->AddText(font, zoneTextSize, ImVec2(zoneX, zoneY), + IM_COL32(255, 220, 120, 255), zoneName.c_str()); + } + // Progress bar (top of screen) { const float barWidthFrac = 0.6f;