summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 14:04:39 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 14:04:39 +0100
commit8cd07c04efafcd3e927a21152d10e9fafea54517 (patch)
treec89fdf577c90e82080ff5c15982d016cc3f5f7fa /src/esp.cpp
parentAdd ESP, aim, view and movement batch (diff)
downloadhl2h-8cd07c04efafcd3e927a21152d10e9fafea54517.tar.gz
hl2h-8cd07c04efafcd3e927a21152d10e9fafea54517.zip
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.
Diffstat (limited to 'src/esp.cpp')
-rw-r--r--src/esp.cpp64
1 files changed, 37 insertions, 27 deletions
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() {
1769static void draw_transitions() { 1769static void draw_transitions() {
1770 if (!g_surface || !g_ntrans) 1770 if (!g_surface || !g_ntrans)
1771 return; 1771 return;
1772 // Corner bits: +x, +y, +z. Twelve edges connect corners differing by one
1773 // bit; projecting the corners and joining them gives a proper 3D wireframe
1774 // instead of a screen-space rectangle.
1775 static const int edges[12][2] = {
1776 {0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 2}, {1, 3},
1777 {4, 6}, {5, 7}, {0, 4}, {1, 5}, {2, 6}, {3, 7}};
1772 for (int i = 0; i < g_ntrans; i++) { 1778 for (int i = 0; i < g_ntrans; i++) {
1773 const TransitionBox &b = g_trans[i]; 1779 const TransitionBox &b = g_trans[i];
1774 float minx = 1e9f, miny = 1e9f, maxx = -1e9f, maxy = -1e9f; 1780 Vector corners[8];
1781 float xs[8], ys[8];
1782 bool ok[8];
1775 int seen = 0; 1783 int seen = 0;
1776 for (int c = 0; c < 8; c++) { 1784 for (int c = 0; c < 8; c++) {
1777 Vector p{(c & 1) ? b.maxs.x : b.mins.x, (c & 2) ? b.maxs.y : b.mins.y, 1785 corners[c] = Vector{(c & 1) ? b.maxs.x : b.mins.x,
1778 (c & 4) ? b.maxs.z : b.mins.z}; 1786 (c & 2) ? b.maxs.y : b.mins.y,
1779 float sx, sy; 1787 (c & 4) ? b.maxs.z : b.mins.z};
1780 if (!world_to_screen(p, sx, sy) || !std::isfinite(sx) || 1788 ok[c] = world_to_screen(corners[c], xs[c], ys[c]) &&
1781 !std::isfinite(sy)) 1789 std::isfinite(xs[c]) && std::isfinite(ys[c]);
1782 continue; 1790 if (ok[c])
1783 if (sx < minx) minx = sx; 1791 seen++;
1784 if (sx > maxx) maxx = sx;
1785 if (sy < miny) miny = sy;
1786 if (sy > maxy) maxy = sy;
1787 seen++;
1788 } 1792 }
1789 if (!seen) 1793 if (!seen)
1790 continue; 1794 continue;
1791 int x0 = (int)minx, x1 = (int)maxx, y0 = (int)miny, y1 = (int)maxy; 1795 // The trigger whose target is the map we came from is the way back.
1792 if (x1 < -2000 || x0 > g_scr_w + 2000 || y1 < -2000 || 1796 bool back = g_map_prev[0] && strcmp(b.next, g_map_prev) == 0;
1793 y0 > g_scr_h + 2000) 1797 int r = back ? 200 : 255, g = back ? 200 : 170, bl = back ? 200 : 60;
1794 continue; 1798 surf_color(r, g, bl, 210);
1795 surf_color(255, 170, 60, 200); 1799 for (int e = 0; e < 12; e++) {
1796 surf_rect(0, x0, y0, x1, y1); 1800 int a = edges[e][0], c = edges[e][1];
1801 if (ok[a] && ok[c])
1802 surf_line((int)xs[a], (int)ys[a], (int)xs[c], (int)ys[c]);
1803 }
1804 // Tag above the highest projected corner.
1805 float topx = 0.0f, topy = 1e9f;
1806 for (int c = 0; c < 8; c++) {
1807 if (ok[c] && ys[c] < topy) {
1808 topy = ys[c];
1809 topx = xs[c];
1810 }
1811 }
1797 char line[128]; 1812 char line[128];
1798 snprintf(line, sizeof(line), "-> %.100s", b.next); 1813 snprintf(line, sizeof(line), "%s %.100s", back ? "<-" : "->", b.next);
1799 int tx = x0; 1814 int tx = (int)topx;
1800 if (tx < 4) tx = 4; 1815 if (tx < 4) tx = 4;
1801 if (tx > g_scr_w - 120) tx = g_scr_w - 120; 1816 if (tx > g_scr_w - 120) tx = g_scr_w - 120;
1802 int ty = y0 - 16; 1817 int ty = (int)topy - 16;
1803 if (ty < 4) ty = 4; 1818 if (ty < 4) ty = 4;
1804 draw_text_small_col(tx + 1, ty + 1, line, 0, 0, 0); 1819 draw_text_small_col(tx + 1, ty + 1, line, 0, 0, 0);
1805 draw_text_small_col(tx, ty, line, 255, 180, 70); 1820 draw_text_small_col(tx, ty, line, r, g, bl);
1806 if (g_map_prev[0]) {
1807 snprintf(line, sizeof(line), "prev %.48s", g_map_prev);
1808 draw_text_small_col(tx + 1, ty + 13, line, 0, 0, 0);
1809 draw_text_small_col(tx, ty + 12, line, 200, 200, 200);
1810 }
1811 } 1821 }
1812} 1822}
1813 1823