summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/heretic/am_map.c35
-rw-r--r--src/hexen/am_map.c34
2 files changed, 45 insertions, 24 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.
diff --git a/src/hexen/am_map.c b/src/hexen/am_map.c
index 05d03d8f..465df9ba 100644
--- a/src/hexen/am_map.c
+++ b/src/hexen/am_map.c
@@ -255,18 +255,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 Hexen 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;
}
@@ -682,6 +687,10 @@ void AM_clearFB(int color)
}
else
{
+ // The released Hexen 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)
@@ -692,6 +701,7 @@ void AM_clearFB(int color)
mapystart -= finit_height;
if (mapystart < 0)
mapystart += finit_height;
+ */
}
//blit the automap background to the screen.