keep the map static in overlay mode if not following the player (#276)

* keep the map static in overlay mode if not following the player

Closes: #275

* update mapcenter and mapangle in the drawing routine
This commit is contained in:
Fabian Greffrath 2021-09-10 21:04:52 +02:00 committed by GitHub
parent a7a784d54b
commit 97ebf4be37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,8 +421,18 @@ void AM_addMark(void)
(markpointnum_max = markpointnum_max ?
markpointnum_max*2 : 16) * sizeof(*markpoints));
// [crispy] keep the map static in overlay mode
// if not following the player
if (followplayer || !automapoverlay)
{
markpoints[markpointnum].x = mapcenter.x;
markpoints[markpointnum].y = mapcenter.y;
}
else
{
markpoints[markpointnum].x = m_x + m_w/2;
markpoints[markpointnum].y = m_y + m_h/2;
}
markpointnum++;
}
@ -780,22 +790,22 @@ boolean AM_Responder
rc = true;
ch = ev->data1; // phares
if (ch == key_map_right) // |
if (!followplayer) // V
if (!followplayer && !automapoverlay) // V
m_paninc.x = FTOM(F_PANINC);
else
rc = false;
else if (ch == key_map_left)
if (!followplayer)
if (!followplayer && !automapoverlay)
m_paninc.x = -FTOM(F_PANINC);
else
rc = false;
else if (ch == key_map_up)
if (!followplayer)
if (!followplayer && !automapoverlay)
m_paninc.y = FTOM(F_PANINC);
else
rc = false;
else if (ch == key_map_down)
if (!followplayer)
if (!followplayer && !automapoverlay)
m_paninc.y = -FTOM(F_PANINC);
else
rc = false;
@ -993,14 +1003,6 @@ void AM_Ticker (void)
{
AM_changeWindowLoc();
}
// [crispy] required for AM_rotatePoint()
if (automaprotate)
{
mapcenter.x = m_x + m_w / 2;
mapcenter.y = m_y + m_h / 2;
mapangle = ANG90 - viewangle;
}
}
@ -1633,17 +1635,16 @@ void AM_rotate
static void AM_rotatePoint(mpoint_t *pt)
{
int64_t tmpx;
const angle_t actualangle = ANG90 - viewangle;
pt->x -= mapcenter.x;
pt->y -= mapcenter.y;
tmpx = (int64_t)FixedMul(pt->x, finecosine[actualangle>>ANGLETOFINESHIFT])
- (int64_t)FixedMul(pt->y, finesine[actualangle>>ANGLETOFINESHIFT])
tmpx = (int64_t)FixedMul(pt->x, finecosine[mapangle>>ANGLETOFINESHIFT])
- (int64_t)FixedMul(pt->y, finesine[mapangle>>ANGLETOFINESHIFT])
+ mapcenter.x;
pt->y = (int64_t)FixedMul(pt->x, finesine[actualangle>>ANGLETOFINESHIFT])
+ (int64_t)FixedMul(pt->y, finecosine[actualangle>>ANGLETOFINESHIFT])
pt->y = (int64_t)FixedMul(pt->x, finesine[mapangle>>ANGLETOFINESHIFT])
+ (int64_t)FixedMul(pt->y, finecosine[mapangle>>ANGLETOFINESHIFT])
+ mapcenter.y;
pt->x = tmpx;
@ -1980,6 +1981,19 @@ void AM_Drawer (void)
{
if (!automapactive) return;
// [crispy] required for AM_rotatePoint()
if (automaprotate)
{
mapcenter.x = m_x + m_w / 2;
mapcenter.y = m_y + m_h / 2;
// [crispy] keep the map static in overlay mode
// if not following the player
if (followplayer || !automapoverlay)
{
mapangle = ANG90 - viewangle;
}
}
if (!automapoverlay)
AM_clearFB(mapcolor_back); //jff 1/5/98 background default color
if (automap_grid) // killough 2/28/98: change var name