From d98bf9ba621e7b5d6204c479fe0ab5c8edae3af7 Mon Sep 17 00:00:00 2001 From: ny00123 Date: Sat, 7 Mar 2020 23:11:31 +0000 Subject: [PATCH] sw/src/draw.cpp:ResizeView: Make map zooming less dependent on the frame rate git-svn-id: https://svn.eduke32.com/eduke32@8700 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/draw.cpp --- source/sw/src/draw.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index ba5e04ef0..fb48f8950 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1035,6 +1035,8 @@ post_analyzesprites(void) } #endif +static ClockTicks mapzoomclock; + void ResizeView(PLAYERp pp) { @@ -1043,15 +1045,13 @@ ResizeView(PLAYERp pp) if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6) { - if (inputState.GetKeyStatus(KEYSC_DASH)||inputState.GetKeyStatus(KEYSC_GMINUS)) - { - if ((zoom -= (zoom >> 4)) < 48) zoom = 48; - } + int32_t timepassed = (int32_t)(totalclock - mapzoomclock); + mapzoomclock += timepassed; + if (inputState.GetKeyStatus(KEYSC_DASH)||inputState.GetKeyStatus(KEYSC_GMINUS)) + zoom = max(zoom - mulscale7(timepassed * synctics, zoom), 48); if (inputState.GetKeyStatus(KEYSC_EQUAL)||inputState.GetKeyStatus(KEYSC_GPLUS)) - { - if ((zoom += (zoom >> 4)) > 4096) zoom = 4096; - } + zoom = min(zoom + mulscale7(timepassed * synctics, zoom), 4096); if (inputState.GetKeyStatus(KEYSC_ESC)) {