fix: resolve 7 code quality issues across PRs #59-63

- Remove stale kVOffset (-0.15) from zone_highlight_layer hover detection;
  the offset was removed from rendering but left in the hit-test path,
  shifting hover ~15% vertically
- Add null guard for cachedGameHandler_ in ChatPanel::inputTextCallback
  to prevent dereference before first render frame
- Zero WindowBorderSize in world map ImGui window to eliminate gap
  between window edge and map content
- Replace hardcoded cosmic highlight multipliers with displayH×displayH
  square rendering, preserving 1:1 aspect ratio at any resolution
- Skip transport waypoints where serverToCanonical zeroes nonzero input
  instead of silently building paths with broken (0,0,0) coordinates
- Use length-squared check (posLenSq > 1.0) for spline endpoint
  validation instead of per-component != 0 comparison, so entities
  near the world origin are no longer skipped
- Fix off-by-one in ChatPanel::insertChatLink buffer capacity check
This commit is contained in:
Kelsi 2026-04-14 02:41:55 -07:00
parent 9547feabf9
commit 3be40c3b69
5 changed files with 20 additions and 22 deletions

View file

@ -172,10 +172,6 @@ void ZoneHighlightLayer::render(const LayerContext& ctx) {
float mv = (mousePos.y - ctx.imgMin.y) / ctx.displayH;
if (mu >= 0.0f && mu <= 1.0f && mv >= 0.0f && mv <= 1.0f) {
// Undo the -0.15 vertical offset applied during continent rendering
constexpr float kVOffset = -0.15f;
mv -= kVOffset;
// Screen UV → world coordinates
float wowX = cLeft - mu * cDenomU;
float wowY = cTop - mv * cDenomV;

View file

@ -590,6 +590,7 @@ void WorldMapFacade::Impl::renderImGuiOverlay(const glm::vec3& playerRenderPos,
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
// Bug fix: pass nullptr instead of &open so ImGui's X-button doesn't
// set open=false directly — that bypasses cleanup (userMapOverride,
@ -979,19 +980,17 @@ void WorldMapFacade::Impl::renderImGuiOverlay(const glm::vec3& playerRenderPos,
// • Full stretch (like WoW original): hlW = displayW, hlH = displayH
// • Shift glow position: adjust hlX offset
//
float hlW,hlH,hlX, hlY;
// Render highlight as a square (side = displayH) to preserve
// the 1:1 aspect of the 512×512 glow textures at any resolution.
float hlW = displayH;
float hlH = displayH;
float hlX, hlY;
if (cosmicLabel == "azeroth") {
hlW = displayW * 0.90f; // width of highlight rect (= square)
hlH = displayH * 0.985f; // height of highlight rect (= square)
hlX = imgMax.x - hlW; // flush right
hlY = imgMax.y - hlH; // flush bottom + title bar
hlX = imgMax.x - hlW; // flush right (glow sits in right-center of texture)
hlY = imgMin.y; // flush top
} else {
hlW = displayW * 0.86f; // width of highlight rect (= square)
hlH = displayH * 0.91f; // height of highlight rect (= square)
hlX = imgMin.x + displayW * 0.02f; // flush left
hlY = imgMax.y - displayH * 0.95f; // flush bottom
hlX = imgMin.x; // flush left (glow sits in left-center of texture)
hlY = imgMin.y; // flush top
}
if (zoneHighlightLayer) {
@ -1064,7 +1063,7 @@ void WorldMapFacade::Impl::renderImGuiOverlay(const glm::vec3& playerRenderPos,
}
ImGui::End();
ImGui::PopStyleVar(2); // WindowPadding + ItemSpacing
ImGui::PopStyleVar(3); // WindowPadding + ItemSpacing + WindowBorderSize
}
} // namespace world_map