- fixed automap positioning with linked portals and a camera actor that is transitioning a sector portal.

This commit is contained in:
Christoph Oelckers 2017-05-14 13:12:39 +02:00
parent 437dd68d79
commit 6a34092742

View file

@ -1564,27 +1564,31 @@ CCMD(am_zoom)
void AM_doFollowPlayer () void AM_doFollowPlayer ()
{ {
double sx, sy; double sx, sy;
auto cam = players[consoleplayer].camera;
if (players[consoleplayer].camera != NULL && if (cam != nullptr)
(f_oldloc.x != players[consoleplayer].camera->X() ||
f_oldloc.y != players[consoleplayer].camera->Y()))
{ {
m_x = players[consoleplayer].camera->X() - m_w/2; double delta = cam->player ? cam->player->viewz - cam->Z() : cam->GetCameraHeight();
m_y = players[consoleplayer].camera->Y() - m_h/2; DVector3 ampos = cam->GetPortalTransition(delta);
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
// do the parallax parchment scrolling. if (f_oldloc.x != ampos.X || f_oldloc.y != ampos.Y)
sx = (players[consoleplayer].camera->X() - f_oldloc.x);
sy = (f_oldloc.y - players[consoleplayer].camera->Y());
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotate (&sx, &sy, players[consoleplayer].camera->Angles.Yaw - 90); m_x = ampos.X - m_w / 2;
} m_y = ampos.Y - m_h / 2;
AM_ScrollParchment (sx, sy); m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
f_oldloc.x = players[consoleplayer].camera->X(); // do the parallax parchment scrolling.
f_oldloc.y = players[consoleplayer].camera->Y(); sx = (ampos.X - f_oldloc.x);
sy = (f_oldloc.y - ampos.Y);
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotate(&sx, &sy, cam->Angles.Yaw - 90);
}
AM_ScrollParchment(sx, sy);
f_oldloc.x = ampos.X;
f_oldloc.y = ampos.Y;
}
} }
} }