From a704043fd2ab01b3609dfaf80bf7a0165714bcc8 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 7 Feb 2009 00:01:58 +0000 Subject: [PATCH] - Removed automap scroll clamping for rotated maps. If it's going to scroll out of sight, at least it'll do so at a fixed right. SVN r1407 (trunk) --- src/am_map.cpp | 51 +++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 541d3a5d0..0de79fc0d 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -493,50 +493,63 @@ static void AM_findMinMaxBoundaries () static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty) { - fixed_t rmin_x, rmin_y, rmax_x, rmax_y; - if (am_rotate == 0 || (am_rotate == 2 && !viewactive)) { - rmin_x = min_x; - rmin_y = min_y; - rmax_x = max_x; - rmax_y = max_y; + if (m_x + m_w/2 > max_x) + m_x = max_x - m_w/2; + else if (m_x + m_w/2 < min_x) + m_x = min_x - m_w/2; + + if (m_y + m_h/2 > max_y) + m_y = max_y - m_h/2; + else if (m_y + m_h/2 < min_y) + m_y = min_y - m_h/2; } else { - fixed_t xs[4], ys[4]; +#if 0 + fixed_t rmin_x, rmin_y, rmax_x, rmax_y; + fixed_t xs[5], ys[5]; int i; xs[0] = min_x; ys[0] = min_y; xs[1] = max_x; ys[1] = min_y; xs[2] = max_x; ys[2] = max_y; xs[3] = min_x; ys[3] = max_y; + xs[4] = m_x + m_w/2; ys[4] = m_y + m_h/2; rmin_x = rmin_y = FIXED_MAX; rmax_x = rmax_y = FIXED_MIN; - for (i = 0; i < 4; ++i) + for (i = 0; i < 5; ++i) { xs[i] -= pivotx; ys[i] -= pivoty; AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->angle); - xs[i] += pivotx; - ys[i] += pivoty; + + if (i == 5) + break; +// xs[i] += pivotx; +// ys[i] += pivoty; if (xs[i] < rmin_x) rmin_x = xs[i]; if (xs[i] > rmax_x) rmax_x = xs[i]; if (ys[i] < rmin_y) rmin_y = ys[i]; if (ys[i] > rmax_y) rmax_y = ys[i]; } + if (rmax_x < 0) + xs[4] = -rmax_x; + else if (rmin_x > 0) + xs[4] = -rmin_x; + +// if (ys[4] > rmax_y) +// ys[4] = rmax_y; +// else if (ys[4] < rmin_y) +// ys[4] = rmin_y; + AM_rotate (&xs[4], &ys[4], ANG270 - players[consoleplayer].camera->angle); + m_x = xs[4] + pivotx - m_w/2; + m_y = ys[4] + pivoty - m_h/2; +#endif } - if (m_x + m_w/2 > rmax_x) - m_x = rmax_x - m_w/2; - else if (m_x + m_w/2 < rmin_x) - m_x = rmin_x - m_w/2; - - if (m_y + m_h/2 > rmax_y) - m_y = rmax_y - m_h/2; - else if (m_y + m_h/2 < rmin_y) - m_y = rmin_y - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h;