Precise+zoom/volume change makes changes in smaller steps
authorWuzzy <Wuzzy2@mail.ru>
Tue, 05 Feb 2019 02:46:41 +0100
changeset 14684 4eaeba349179
parent 14683 c96889bf5796
child 14685 d74517fdb34f
Precise+zoom/volume change makes changes in smaller steps
ChangeLog.txt
README.md
hedgewars/uCommandHandlers.pas
hedgewars/uVariables.pas
--- a/ChangeLog.txt	Tue Feb 05 02:18:13 2019 +0100
+++ b/ChangeLog.txt	Tue Feb 05 02:46:41 2019 +0100
@@ -46,6 +46,10 @@
 Controls:
  + Add control to unselect current weapon (no key chosen by default)
  + Allow to leave a control unused
+ + Reset zoom resets zoom to zoom level set in options
+ + Precise + Reset zoom resets zoom to 100% (instead of zoom in options)
+ + Precise + zoom in/out changes zoom in smaller steps
+ + Precise + volume up/down changes volume in smaller steps
  + New chat command: “/help room” (shows room chat commands within the game)
 
 Graphics:
--- a/README.md	Tue Feb 05 02:18:13 2019 +0100
+++ b/README.md	Tue Feb 05 02:46:41 2019 +0100
@@ -100,6 +100,8 @@
 * Switch  + Toggle hedgehog tags: Toggle hedgehog tag translucency
 * Precise + Toggle team bars + Switch: Toggle HUD
 * Precise + Capture (screenshot key): Save current map + mask into Screenshot directory
+* Precise + zoom in/out: Change zoom in smaller steps
+* Precise + volume up/down: Change volume in smaller steps
 * Precise + Reset zoom: Set zoom to 100% (instead of the zoom level in the settings)
 
 System requirements
--- a/hedgewars/uCommandHandlers.pas	Tue Feb 05 02:18:13 2019 +0100
+++ b/hedgewars/uCommandHandlers.pas	Tue Feb 05 02:46:41 2019 +0100
@@ -285,6 +285,10 @@
 with CurrentHedgehog^.Gear^ do
     Message:= Message or (gmPrecise and InputMask);
     ScriptCall('onPrecise');
+if cVolumeDelta > 0 then
+    cVolumeDelta:= 1;
+if cVolumeDelta < 0 then
+    cVolumeDelta:= -1;
 end;
 
 procedure chPrecise_m(var s: shortstring);
@@ -297,6 +301,10 @@
 with CurrentHedgehog^.Gear^ do
     Message:= Message and (not (gmPrecise and InputMask));
     ScriptCall('onPreciseUp');
+if cVolumeDelta > 0 then
+    cVolumeDelta:= 3;
+if cVolumeDelta < 0 then
+    cVolumeDelta:= -3;
 end;
 
 procedure chLJump(var s: shortstring);
@@ -595,13 +603,19 @@
 procedure chVol_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-inc(cVolumeDelta, 3)
+if (LocalMessage and gmPrecise) <> 0 then
+    inc(cVolumeDelta, 1)
+else
+    inc(cVolumeDelta, 3);
 end;
 
 procedure chVol_m(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-dec(cVolumeDelta, 3)
+if (LocalMessage and gmPrecise) <> 0 then
+    dec(cVolumeDelta, 1)
+else
+    dec(cVolumeDelta, 3);
 end;
 
 procedure chMute(var s: shortstring);
@@ -719,14 +733,20 @@
 begin
     s:= s; // avoid compiler hint
     if ZoomValue < cMinZoomLevel then
-        ZoomValue:= ZoomValue + cZoomDelta;
+        if (LocalMessage and gmPrecise <> 0) then
+            ZoomValue:= ZoomValue + cZoomDeltaSmall
+        else
+            ZoomValue:= ZoomValue + cZoomDelta;
 end;
 
 procedure chZoomOut(var s: shortstring);
 begin
     s:= s; // avoid compiler hint
     if ZoomValue > cMaxZoomLevel then
-        ZoomValue:= ZoomValue - cZoomDelta;
+        if (LocalMessage and gmPrecise <> 0) then
+            ZoomValue:= ZoomValue - cZoomDeltaSmall
+        else
+            ZoomValue:= ZoomValue - cZoomDelta;
 end;
 
 procedure chZoomReset(var s: shortstring);
--- a/hedgewars/uVariables.pas	Tue Feb 05 02:18:13 2019 +0100
+++ b/hedgewars/uVariables.pas	Tue Feb 05 02:46:41 2019 +0100
@@ -214,6 +214,7 @@
     cMaxZoomLevel   : real;
     cMinZoomLevel   : real;
     cZoomDelta      : real;
+    cZoomDeltaSmall : real;
     cMinMaxZoomLevelDelta : real;
 
 
@@ -2631,13 +2632,15 @@
     ZoomValue       := cDefaultZoomLevel;
 
 {$IFDEF MOBILE}
-    cMaxZoomLevel:= 0.5;
-    cMinZoomLevel:= 3.5;
-    cZoomDelta:=    0.20;
+    cMaxZoomLevel   := 0.5;
+    cMinZoomLevel   := 3.5;
+    cZoomDelta      := 0.20;
+    cZoomDeltaSmall := 0.10;
 {$ELSE}
-    cMaxZoomLevel:= 1.0;
-    cMinZoomLevel:= 3.0;
-    cZoomDelta:=    0.25;
+    cMaxZoomLevel   := 1.0;
+    cMinZoomLevel   := 3.0;
+    cZoomDelta      := 0.25;
+    cZoomDeltaSmall := 0.125;
 {$ENDIF}
 
 {$IFDEF USE_VIDEO_RECORDING}