summaryrefslogtreecommitdiff
path: root/src/heretic
diff options
context:
space:
mode:
authorSimon Howard2014-03-22 16:54:47 -0400
committerSimon Howard2014-03-22 16:54:47 -0400
commit4788fd8387b4206df42a95c3c2f9b848bf4eac20 (patch)
tree433d783dc003f01a3edde0241eee8ef41eb09e3c /src/heretic
parentedfbfe1d5da7ace84e102e3b68cddfb1a7b1d6c1 (diff)
downloadchocolate-doom-4788fd8387b4206df42a95c3c2f9b848bf4eac20.tar.gz
chocolate-doom-4788fd8387b4206df42a95c3c2f9b848bf4eac20.tar.bz2
chocolate-doom-4788fd8387b4206df42a95c3c2f9b848bf4eac20.zip
heretic/hexen: Fix automap background scrolling.
There was a bug where it was possible to keep moving the background when the boundaries of the map were reached. This is because the code to move the background was done in calls to AM_Drawer(), which is fundamentally a bad idea. Some old commented-out code shows that this was previously done in AM_Drawer (same location that scrolls the map itself), but it was moved. Move it back. Thanks to Chris Fielder for the bug report; this fixes #321.
Diffstat (limited to 'src/heretic')
-rw-r--r--src/heretic/am_map.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c
index b753d96b..5454ba54 100644
--- a/src/heretic/am_map.c
+++ b/src/heretic/am_map.c
@@ -309,18 +309,23 @@ void AM_changeWindowLoc(void)
m_y = min_y - m_h / 2;
m_paninc.y = 0;
}
-/*
- mapxstart += MTOF(m_paninc.x+FRACUNIT/2);
- mapystart -= MTOF(m_paninc.y+FRACUNIT/2);
- if(mapxstart >= finit_width)
- mapxstart -= finit_width;
- if(mapxstart < 0)
- mapxstart += finit_width;
- if(mapystart >= finit_height)
- mapystart -= finit_height;
- if(mapystart < 0)
- mapystart += finit_height;
-*/
+
+ // The following code was commented out in the released Heretic source,
+ // but I believe we need to do this here to stop the background moving
+ // when we reach the map boundaries. (In the released source it's done
+ // in AM_clearFB).
+ mapxstart += MTOF(m_paninc.x+FRACUNIT/2);
+ mapystart -= MTOF(m_paninc.y+FRACUNIT/2);
+ if(mapxstart >= finit_width)
+ mapxstart -= finit_width;
+ if(mapxstart < 0)
+ mapxstart += finit_width;
+ if(mapystart >= finit_height)
+ mapystart -= finit_height;
+ if(mapystart < 0)
+ mapystart += finit_height;
+ // - end of code that was commented-out
+
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
}
@@ -783,8 +788,13 @@ void AM_clearFB(int color)
}
else
{
+ // The released Heretic source does this here, but this causes a bug
+ // where the map background keeps moving when we reach the map
+ // boundaries. This is instead done in AM_changeWindowLoc.
+ /*
mapxstart += (MTOF(m_paninc.x) >> 1);
mapystart -= (MTOF(m_paninc.y) >> 1);
+
if (mapxstart >= finit_width)
mapxstart -= finit_width;
if (mapxstart < 0)
@@ -793,6 +803,7 @@ void AM_clearFB(int color)
mapystart -= finit_height;
if (mapystart < 0)
mapystart += finit_height;
+ */
}
//blit the automap background to the screen.