From 8cd07c04efafcd3e927a21152d10e9fafea54517 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:04:39 +0100 Subject: Transitions: per-trigger targets and 3D wireframe; FOV range fixes - Each changelevel trigger now shows its own target map. The trigger whose target is the map we came from is marked "<- map"; the forward one is "-> map". No more appending one global previous-map line to every box. - Draw the volume as a projected 8-corner / 12-edge wireframe with the tag above its highest visible corner instead of a screen-space rectangle. - Camera FOV is 40..140 (stock 75) and viewmodel FOV 20..120 (stock 54); 0 is no longer allowed and old configs using 0 migrate to the stock value. - Log the mat_monitorgamma readback via ICvar so we can tell whether the command is rejected or the OS/compositor ignores the gamma ramp. --- src/esp.cpp | 64 +++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 27 deletions(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 1e67a8a..7baf2c8 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -1769,45 +1769,55 @@ static void transitions_scan() { static void draw_transitions() { if (!g_surface || !g_ntrans) return; + // Corner bits: +x, +y, +z. Twelve edges connect corners differing by one + // bit; projecting the corners and joining them gives a proper 3D wireframe + // instead of a screen-space rectangle. + static const int edges[12][2] = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 2}, {1, 3}, + {4, 6}, {5, 7}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; for (int i = 0; i < g_ntrans; i++) { const TransitionBox &b = g_trans[i]; - float minx = 1e9f, miny = 1e9f, maxx = -1e9f, maxy = -1e9f; + Vector corners[8]; + float xs[8], ys[8]; + bool ok[8]; int seen = 0; for (int c = 0; c < 8; c++) { - Vector p{(c & 1) ? b.maxs.x : b.mins.x, (c & 2) ? b.maxs.y : b.mins.y, - (c & 4) ? b.maxs.z : b.mins.z}; - float sx, sy; - if (!world_to_screen(p, sx, sy) || !std::isfinite(sx) || - !std::isfinite(sy)) - continue; - if (sx < minx) minx = sx; - if (sx > maxx) maxx = sx; - if (sy < miny) miny = sy; - if (sy > maxy) maxy = sy; - seen++; + corners[c] = Vector{(c & 1) ? b.maxs.x : b.mins.x, + (c & 2) ? b.maxs.y : b.mins.y, + (c & 4) ? b.maxs.z : b.mins.z}; + ok[c] = world_to_screen(corners[c], xs[c], ys[c]) && + std::isfinite(xs[c]) && std::isfinite(ys[c]); + if (ok[c]) + seen++; } if (!seen) continue; - int x0 = (int)minx, x1 = (int)maxx, y0 = (int)miny, y1 = (int)maxy; - if (x1 < -2000 || x0 > g_scr_w + 2000 || y1 < -2000 || - y0 > g_scr_h + 2000) - continue; - surf_color(255, 170, 60, 200); - surf_rect(0, x0, y0, x1, y1); + // The trigger whose target is the map we came from is the way back. + bool back = g_map_prev[0] && strcmp(b.next, g_map_prev) == 0; + int r = back ? 200 : 255, g = back ? 200 : 170, bl = back ? 200 : 60; + surf_color(r, g, bl, 210); + for (int e = 0; e < 12; e++) { + int a = edges[e][0], c = edges[e][1]; + if (ok[a] && ok[c]) + surf_line((int)xs[a], (int)ys[a], (int)xs[c], (int)ys[c]); + } + // Tag above the highest projected corner. + float topx = 0.0f, topy = 1e9f; + for (int c = 0; c < 8; c++) { + if (ok[c] && ys[c] < topy) { + topy = ys[c]; + topx = xs[c]; + } + } char line[128]; - snprintf(line, sizeof(line), "-> %.100s", b.next); - int tx = x0; + snprintf(line, sizeof(line), "%s %.100s", back ? "<-" : "->", b.next); + int tx = (int)topx; if (tx < 4) tx = 4; if (tx > g_scr_w - 120) tx = g_scr_w - 120; - int ty = y0 - 16; + int ty = (int)topy - 16; if (ty < 4) ty = 4; draw_text_small_col(tx + 1, ty + 1, line, 0, 0, 0); - draw_text_small_col(tx, ty, line, 255, 180, 70); - if (g_map_prev[0]) { - snprintf(line, sizeof(line), "prev %.48s", g_map_prev); - draw_text_small_col(tx + 1, ty + 13, line, 0, 0, 0); - draw_text_small_col(tx, ty + 12, line, 200, 200, 200); - } + draw_text_small_col(tx, ty, line, r, g, bl); } } -- cgit v1.2.3