--- a/ChangeLog.txt Tue May 07 13:56:11 2019 +0200
+++ b/ChangeLog.txt Tue May 07 14:17:09 2019 +0200
@@ -57,6 +57,7 @@
+ 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
+ + Precise + cursor move keys move camera slower
+ New chat command: “/help room” (shows room chat commands within the game)
* Fix broken default keyboard controls for team chat and camera movement
--- a/hedgewars/hwengine.pas Tue May 07 13:56:11 2019 +0200
+++ b/hedgewars/hwengine.pas Tue May 07 14:17:09 2019 +0200
@@ -290,7 +290,7 @@
ResetMouseWheel();
if (CursorMovementX <> 0) or (CursorMovementY <> 0) then
- handlePositionUpdate(CursorMovementX * cameraKeyboardSpeed, CursorMovementY * cameraKeyboardSpeed);
+ handlePositionUpdate(CursorMovementX, CursorMovementY);
if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and
((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then
--- a/hedgewars/uCommandHandlers.pas Tue May 07 13:56:11 2019 +0200
+++ b/hedgewars/uCommandHandlers.pas Tue May 07 14:17:09 2019 +0200
@@ -125,53 +125,53 @@
procedure chCurU_p(var s: shortstring);
begin
s:= s; // avoid compiler hint
-CursorMovementY:= -1;
+updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, -1, CursorMovementY);
end;
procedure chCurU_m(var s: shortstring);
begin
s:= s; // avoid compiler hint
if CursorMovementY < 0 then
- CursorMovementY:= 0;
+ updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 0, CursorMovementY);
end;
procedure chCurD_p(var s: shortstring);
begin
s:= s; // avoid compiler hint
-CursorMovementY:= 1;
+updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 1, CursorMovementY);
end;
procedure chCurD_m(var s: shortstring);
begin
s:= s; // avoid compiler hint
if CursorMovementY > 0 then
- CursorMovementY:= 0;
+ updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 0, CursorMovementY);
end;
procedure chCurL_p(var s: shortstring);
begin
s:= s; // avoid compiler hint
-CursorMovementX:= -1;
+updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, -1, CursorMovementX);
end;
procedure chCurL_m(var s: shortstring);
begin
s:= s; // avoid compiler hint
if CursorMovementX < 0 then
- CursorMovementX:= 0;
+ updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 0, CursorMovementX);
end;
procedure chCurR_p(var s: shortstring);
begin
s:= s; // avoid compiler hint
-CursorMovementX:= 1;
+updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 1, CursorMovementX);
end;
procedure chCurR_m(var s: shortstring);
begin
s:= s; // avoid compiler hint
if CursorMovementX > 0 then
- CursorMovementX:= 0;
+ updateCursorMovementDelta((LocalMessage and gmPrecise) <> 0, 0, CursorMovementX);
end;
procedure chLeft_p(var s: shortstring);
--- a/hedgewars/uConsts.pas Tue May 07 13:56:11 2019 +0200
+++ b/hedgewars/uConsts.pas Tue May 07 14:17:09 2019 +0200
@@ -66,7 +66,8 @@
msgGettingConfig = 'Getting game config...';
// camera movement multipliers
- cameraKeyboardSpeed : ShortInt = 10;
+ cameraKeyboardSpeed : LongInt = 10;
+ cameraKeyboardSpeedSlow : LongInt = 3;
// color constants
cWhiteColorChannels : TSDL_Color = (r:$FF; g:$FF; b:$FF; a:$FF);
--- a/hedgewars/uInputHandler.pas Tue May 07 13:56:11 2019 +0200
+++ b/hedgewars/uInputHandler.pas Tue May 07 14:17:09 2019 +0200
@@ -249,6 +249,8 @@
begin
LocalMessage:= LocalMessage or gmPrecise;
updateVolumeDelta(true);
+ updateCursorMovementDelta(true, CursorMovementX, CursorMovementX);
+ updateCursorMovementDelta(true, CursorMovementY, CursorMovementY);
end;
ParseCommand(CurrentBinds.binds[CurrentBinds.indices[code]], Trusted);
@@ -261,6 +263,8 @@
begin
LocalMessage:= LocalMessage and (not gmPrecise);
updateVolumeDelta(false);
+ updateCursorMovementDelta(false, CursorMovementX, CursorMovementX);
+ updateCursorMovementDelta(false, CursorMovementY, CursorMovementY);
end;
s:= CurrentBinds.binds[CurrentBinds.indices[code]];
s[1]:= '-';
--- a/hedgewars/uUtils.pas Tue May 07 13:56:11 2019 +0200
+++ b/hedgewars/uUtils.pas Tue May 07 14:17:09 2019 +0200
@@ -84,6 +84,7 @@
function CalcWorldWrap(X, radius: LongInt): LongInt;
procedure updateVolumeDelta(precise: boolean);
+procedure updateCursorMovementDelta(precise: boolean; dir: LongInt; var cursorVar: LongInt);
function read1stLn(filePath: shortstring): shortstring;
function readValueFromINI(key, filePath: shortstring): shortstring;
@@ -717,6 +718,23 @@
cVolumeDelta:= 0;
end;
+// helper function for cursor movement change controls
+procedure updateCursorMovementDelta(precise: boolean; dir: LongInt; var cursorVar: LongInt);
+begin
+if dir > 0 then
+ if precise then
+ cursorVar:= cameraKeyboardSpeedSlow
+ else
+ cursorVar:= cameraKeyboardSpeed
+else if dir < 0 then
+ if precise then
+ cursorVar:= - cameraKeyboardSpeedSlow
+ else
+ cursorVar:= - cameraKeyboardSpeed
+else
+ cursorVar:= 0;
+end;
+
function read1stLn(filePath: shortstring): shortstring;
var f: pfsFile;
begin