- Added the am_zoom command to zoom the automap by a specific step and set default mouse wheel

bindings for it. I'm not sure how this should be exposed through the menu, however. Technically,
  it's different from the pan keys, but from an end user's point of view, they both zoom the
  automap, so they should both be listed under the Zoom in and out controls. But the menu code
  can't handle that.

SVN r2663 (trunk)
This commit is contained in:
Randy Heit 2010-09-01 05:03:17 +00:00
parent 7bf0cd13a6
commit 0202c0c3a9
2 changed files with 30 additions and 5 deletions

View file

@ -246,10 +246,10 @@ CUSTOM_CVAR (Int, am_showalllines, -1, 0) // This is a cheat so don't save it.
#define F_PANINC (140/TICRATE)
// how much zoom-in per tic
// goes to 2x in 1 second
#define M_ZOOMIN ((int) (1.02*MAPUNIT))
#define M_ZOOMIN (1.02*MAPUNIT)
// how much zoom-out per tic
// pulls out to 0.5x in 1 second
#define M_ZOOMOUT ((int) (MAPUNIT/1.02))
#define M_ZOOMOUT (MAPUNIT/1.02)
// translates between frame-buffer and map coordinates
#define CXMTOF(x) (MTOF((x)-m_x)/* - f_x*/)
@ -413,6 +413,7 @@ static int amclock;
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
static float am_zoomdir;
static fixed_t m_x, m_y; // LL x,y where the window is on the map (map coords)
static fixed_t m_x2, m_y2; // UR x,y where the window is on the map (map coords)
@ -1258,8 +1259,23 @@ void AM_changeWindowScale ()
{
int mtof_zoommul;
if (Button_AM_ZoomIn.bDown) mtof_zoommul = M_ZOOMIN;
else if (Button_AM_ZoomOut.bDown) mtof_zoommul = M_ZOOMOUT;
if (am_zoomdir > 0)
{
mtof_zoommul = int(M_ZOOMIN * am_zoomdir);
}
else if (am_zoomdir < 0)
{
mtof_zoommul = int(M_ZOOMOUT / -am_zoomdir);
}
else if (Button_AM_ZoomIn.bDown)
{
mtof_zoommul = int(M_ZOOMIN);
}
else if (Button_AM_ZoomOut.bDown)
{
mtof_zoommul = int(M_ZOOMOUT);
}
am_zoomdir = 0;
// Change the scaling multipliers
scale_mtof = MapMul(scale_mtof, mtof_zoommul);
@ -1271,6 +1287,13 @@ void AM_changeWindowScale ()
AM_maxOutWindowScale();
}
CCMD(am_zoom)
{
if (argv.argc() >= 2)
{
am_zoomdir = (float)atof(argv[1]);
}
}
//=============================================================================
//
@ -1332,7 +1355,7 @@ void AM_Ticker ()
}
// Change the zoom if necessary
if (Button_AM_ZoomIn.bDown || Button_AM_ZoomOut.bDown)
if (Button_AM_ZoomIn.bDown || Button_AM_ZoomOut.bDown || am_zoomdir != 0)
AM_changeWindowScale();
// Change x,y location

View file

@ -188,6 +188,8 @@ static const FBinding DefAutomapBindings[] =
{ "=", "+am_zoomin" },
{ "kp-", "+am_zoomout" },
{ "kp+", "+am_zoomin" },
{ "mwheelup", "am_zoom 1.2" },
{ "mwheeldown", "am_zoom -1.2" },
{ NULL }
};