// Numeric tests for on-map sign labels (render::sign_layout, a port of the original's sign draw). Per the project // rule "verify visuals numerically, not by eye", this locks the plaque + signpost geometry against the // constants measured from the original game, and pins the two bugs the user reported: // // 1. Signs "spread out" at different zoom levels — the draw code hardcoded the zoom-2 projection while // the camera tracked the live zoom, so a sign was laid out 4×/2× too far from its tile at zoom 0/1 // (and at the 2× extra zoom 3). FIX: project at the live zoom. Part 3 is the load-bearing A/B. // 2. The signpost was a fixed 6 px stub floating ~14 px above the tile. FIX: the post runs from the // plaque bottom DOWN to the tile anchor (height 15·zoom+20), so it points at the labelled tile. // Part 2 pins post bottom == anchor and the per-zoom length. #include "sc2k/render/sign_layout.hpp" #include "sc2k/render/iso_projection.hpp" #include using namespace sc2k::render; #include "test_harness.hpp" int main() { CHECK(sign_font_pixel_size(1.f) == 12); CHECK(sign_font_pixel_size(1.5f) == 18); CHECK(sign_font_pixel_size(2.f) == 24); // ── Part 1: the per-zoom constants are the original's (x += 4< 0); CHECK(s.postY + s.postH == s.anchorY); // tip on the anchor at EVERY zoom } // ── Part 3 (load-bearing): a sign tracks its tile across all zoom levels. ── // Centre the camera so tile (r,c) at altitude `alt` sits at a fixed screen point (sx,sy) for the // current zoom (origin_centering_tile, the engine's own centring inverse). The sign anchor must then // land at (sx + 4<