From 4788fd8387b4206df42a95c3c2f9b848bf4eac20 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 22 Mar 2014 16:54:47 -0400 Subject: 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. --- src/heretic/am_map.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'src/heretic') 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. -- cgit v1.2.3