- 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)
This commit is contained in:
Randy Heit 2009-02-07 00:01:58 +00:00
parent 64b783f4bd
commit a704043fd2

View file

@ -493,50 +493,63 @@ static void AM_findMinMaxBoundaries ()
static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty) 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)) if (am_rotate == 0 || (am_rotate == 2 && !viewactive))
{ {
rmin_x = min_x; if (m_x + m_w/2 > max_x)
rmin_y = min_y; m_x = max_x - m_w/2;
rmax_x = max_x; else if (m_x + m_w/2 < min_x)
rmax_y = max_y; 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 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; int i;
xs[0] = min_x; ys[0] = min_y; xs[0] = min_x; ys[0] = min_y;
xs[1] = max_x; ys[1] = min_y; xs[1] = max_x; ys[1] = min_y;
xs[2] = max_x; ys[2] = max_y; xs[2] = max_x; ys[2] = max_y;
xs[3] = min_x; ys[3] = 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; rmin_x = rmin_y = FIXED_MAX;
rmax_x = rmax_y = FIXED_MIN; rmax_x = rmax_y = FIXED_MIN;
for (i = 0; i < 4; ++i) for (i = 0; i < 5; ++i)
{ {
xs[i] -= pivotx; xs[i] -= pivotx;
ys[i] -= pivoty; ys[i] -= pivoty;
AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->angle); 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] < rmin_x) rmin_x = xs[i];
if (xs[i] > rmax_x) rmax_x = xs[i]; if (xs[i] > rmax_x) rmax_x = xs[i];
if (ys[i] < rmin_y) rmin_y = ys[i]; if (ys[i] < rmin_y) rmin_y = ys[i];
if (ys[i] > rmax_y) rmax_y = ys[i]; if (ys[i] > rmax_y) rmax_y = ys[i];
} }
} if (rmax_x < 0)
if (m_x + m_w/2 > rmax_x) xs[4] = -rmax_x;
m_x = rmax_x - m_w/2; else if (rmin_x > 0)
else if (m_x + m_w/2 < rmin_x) xs[4] = -rmin_x;
m_x = rmin_x - m_w/2;
if (m_y + m_h/2 > rmax_y) // if (ys[4] > rmax_y)
m_y = rmax_y - m_h/2; // ys[4] = rmax_y;
else if (m_y + m_h/2 < rmin_y) // else if (ys[4] < rmin_y)
m_y = rmin_y - m_h/2; // 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
}
m_x2 = m_x + m_w; m_x2 = m_x + m_w;
m_y2 = m_y + m_h; m_y2 = m_y + m_h;