Don't send taunt message for automatically happening taunt animation
authorunc0rr
Wed, 01 Nov 2017 20:52:06 +0100
changeset 12815 92218a06c9ff
parent 12814 b4e20bb485f9
child 12816 be7f05f83f8e
Don't send taunt message for automatically happening taunt animation
hedgewars/uCommandHandlers.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uCommandHandlers.pas	Wed Nov 01 00:04:45 2017 +0100
+++ b/hedgewars/uCommandHandlers.pas	Wed Nov 01 20:52:06 2017 +0100
@@ -27,7 +27,7 @@
 
 implementation
 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions
-    , uVisualGearsList
+    , uVisualGearsList, uGearsHedgehog
      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
 
 var prevGState: TGameState = gsConfirm;
@@ -474,12 +474,7 @@
 if not isExternalSource then
     SendIPC('t' + s);
 
-with CurrentHedgehog^.Gear^ do
-    begin
-    Message:= Message or (gmAnimate and InputMask);
-    MsgParam:= byte(s[1]) ;
-    ScriptCall('onTaunt', MsgParam);
-    end
+PlayTaunt(byte(s[1]))
 end;
 
 procedure chPut(var s: shortstring);
--- a/hedgewars/uGearsHandlersMess.pas	Wed Nov 01 00:04:45 2017 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Wed Nov 01 20:52:06 2017 +0100
@@ -3894,8 +3894,10 @@
             end;
 
         if HHGear <> nil then
+            begin
             HHGear^.Message := 0;
-        ParseCommand('/taunt ' + #1, true)
+            PlayTaunt(1)
+            end
         end
 end;
 
--- a/hedgewars/uGearsHedgehog.pas	Wed Nov 01 00:04:45 2017 +0100
+++ b/hedgewars/uGearsHedgehog.pas	Wed Nov 01 20:52:06 2017 +0100
@@ -30,6 +30,7 @@
 procedure PickUp(HH, Gear: PGear);
 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
 procedure CheckIce(Gear: PGear); inline;
+procedure PlayTaunt(taunt: Longword);
 
 implementation
 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions,
@@ -1551,4 +1552,15 @@
     end;
 end;
 
+procedure PlayTaunt(taunt: Longword);
+begin
+    if CurrentHedgehog^.Gear <> nil then
+        with CurrentHedgehog^.Gear^ do
+            begin
+            Message:= Message or (gmAnimate and InputMask);
+            MsgParam:= taunt;
+            ScriptCall('onTaunt', MsgParam);
+            end
+end;
+
 end.