--- a/hedgewars/uCommandHandlers.pas Thu Oct 06 20:58:54 2022 +0300
+++ b/hedgewars/uCommandHandlers.pas Sun Oct 16 13:14:16 2022 +0300
@@ -27,7 +27,7 @@
implementation
uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions
- , uVisualGearsList, uGearsHedgehog
+ , uVisualGearsList, uGearsHedgehog, uDrawing
{$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
var cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 0, 4, 5, 6, 15, 8, 8, 8, 8, 12, 13, 14);
@@ -514,10 +514,20 @@
PlayTaunt(byte(s[1]))
end;
-procedure chPut(var s: shortstring);
+procedure chPut_p(var s: shortstring);
begin
s:= s; // avoid compiler hint
- doPut(0, 0, false);
+ if uDrawing.isDrawingModeActive() then
+ uDrawing.onLeftMouseButtonPressed()
+ else
+ doPut(0, 0, false, false);
+end;
+
+procedure chPut_m(var s: shortstring);
+begin
+ s:= s; // avoid compiler hint
+ if uDrawing.isDrawingModeActive() then
+ uDrawing.onLeftMouseButtonReleased()
end;
procedure chCapture(var s: shortstring);
@@ -575,6 +585,13 @@
procedure chAmmoMenu(var s: shortstring);
begin
s:= s; // avoid compiler hint
+
+if uDrawing.isDrawingModeActive() then
+begin
+ uDrawing.onRightMouseButtonPressed();
+ exit;
+end;
+
if CheckNoTeamOrHH then
bShowAmmoMenu:= (not bShowAmmoMenu)
else
@@ -760,6 +777,11 @@
procedure chZoomReset(var s: shortstring);
begin
s:= s; // avoid compiler hint
+ if uDrawing.isDrawingModeActive() then
+ begin
+ uDrawing.onMiddleMouseButtonPressed();
+ exit;
+ end;
if (LocalMessage and gmPrecise <> 0) then
ZoomValue:= cDefaultZoomLevel
else
@@ -895,6 +917,18 @@
end
end;
+procedure chTeamDraw_p(var s: shortstring);
+begin
+ s:= s;
+ uDrawing.onModeButtonPressed();
+end;
+
+procedure chTeamDraw_m(var s: shortstring);
+begin
+ s:= s;
+ uDrawing.onModeButtonReleased();
+end;
+
procedure chFastForward(var cmd: shortstring);
var str0, str1, str2 : shortstring;
h, m, s : integer;
@@ -1002,6 +1036,8 @@
RegisterVariable('slot' , @chSlot , false);
RegisterVariable('setweap' , @chSetWeapon , false, true);
//////// End top by freq analysis
+ RegisterVariable('+teamdraw', @chTeamDraw_p , true);
+ RegisterVariable('-teamdraw', @chTeamDraw_m , true);
RegisterVariable('gencmd' , @chGenCmd , false);
RegisterVariable('script' , @chScript , false);
RegisterVariable('scriptparam', @chScriptParam, false);
@@ -1053,7 +1089,8 @@
RegisterVariable('switch' , @chSwitch , false);
RegisterVariable('timer' , @chTimer , false, true);
RegisterVariable('taunt' , @chTaunt , false);
- RegisterVariable('put' , @chPut , false);
+ RegisterVariable('+put' , @chPut_p , true);
+ RegisterVariable('-put' , @chPut_m , true);
RegisterVariable('+volup' , @chVolUp_p , true );
RegisterVariable('-volup' , @chVolUp_m , true );
RegisterVariable('+voldown', @chVolDown_p , true );