From 80cea908549efc0decc1425c575d197b329d6c40 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 5 Sep 2020 09:10:24 +0200 Subject: [PATCH] - implemented zoom by mouse wheel for the automap. Fixes #121 --- source/core/gamecontrol.cpp | 19 +++++++++++++++++++ wadsrc/static/engine/commonbinds.txt | 2 ++ 2 files changed, 21 insertions(+) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index e164310b1..65c5563b7 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1201,6 +1201,7 @@ void GameInterface::FreeLevelData() // // //--------------------------------------------------------------------------- +static float am_zoomdir; int GetAutomapZoom(int gZoom) { @@ -1222,6 +1223,16 @@ int GetAutomapZoom(int gZoom) if (automapMode != am_off) { + if (am_zoomdir > 0) + { + gZoom = xs_CRoundToInt(gZoom * am_zoomdir); + } + else if (am_zoomdir < 0) + { + gZoom = xs_CRoundToInt(gZoom / -am_zoomdir); + } + am_zoomdir = 0; + double j = interval * (120. / 1000); if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) @@ -1234,3 +1245,11 @@ int GetAutomapZoom(int gZoom) } return gZoom; } + +CCMD(am_zoom) +{ + if (argv.argc() >= 2) + { + am_zoomdir = (float)atof(argv[1]); + } +} diff --git a/wadsrc/static/engine/commonbinds.txt b/wadsrc/static/engine/commonbinds.txt index 2d199ff9f..6c4cb7f96 100644 --- a/wadsrc/static/engine/commonbinds.txt +++ b/wadsrc/static/engine/commonbinds.txt @@ -39,6 +39,8 @@ Tab "togglemap" mapbind F "togglefollow" mapbind - "+Shrink_Screen" mapbind = "+Enlarge_Screen" +mapbind mwheelup "am_zoom 1.2" +mapbind mwheeldown "am_zoom -1.2" - "sizedown" = "sizeup" K "coop_view"