diff --git a/src/am_map.c b/src/am_map.c index eb08d3b38..33c0b8949 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -28,6 +28,7 @@ #include "doomdef.h" #include "doomstat.h" #include "doomtype.h" +#include "g_input.h" #include "hu_stuff.h" #include "i_video.h" #include "m_config.h" @@ -128,6 +129,8 @@ static int m_zoomin_mouse = M2_ZOOMIN; static int m_zoomout_mouse = M2_ZOOMOUT; static boolean mousewheelzoom; +static boolean scrollmode; + // translates between frame-buffer and map distances // [FG] fix int overflow that causes map and grid lines to disappear #define FTOM(x) ((((int64_t)(x)<<16)*scale_ftom)>>16) @@ -485,6 +488,12 @@ static void AM_changeWindowLoc(void) incy = m_paninc.y; } + if (scrollmode) + { + m_paninc.x = 0; + m_paninc.y = 0; + } + if (automaprotate) { AM_rotate(&incx, &incy, ANGLE_MAX - mapangle); @@ -916,6 +925,10 @@ boolean AM_Responder automaprotate = !automaprotate; togglemsg("%s", automaprotate ? s_AMSTR_ROTATEON : s_AMSTR_ROTATEOFF); } + else if (M_InputActivated(input_strafe)) + { + scrollmode = true; + } else { rc = false; @@ -955,11 +968,25 @@ boolean AM_Responder { buttons_state[ZOOM_IN] = 0; } + else if (M_InputDeactivated(input_strafe)) + { + scrollmode = false; + } } m_paninc.x = 0; m_paninc.y = 0; + if (scrollmode) + { + if (ev->type == ev_mouse) + { + m_paninc.x -= (int)G_CalcMouseSide(ev->data1) * MAPUNIT; + m_paninc.y += (int)G_CalcMouseVert(ev->data2) * MAPUNIT; + rc = true; + } + } + if (!followplayer) { int scaled_f_paninc = (f_paninc * video.xscale) >> FRACBITS;