hedgewars/uGearsUtils.pas
changeset 9071 df85fad2c7f7
parent 8992 5b0be812dcdb
child 9080 9b42757d7e71
--- a/hedgewars/uGearsUtils.pas	Tue May 28 13:58:01 2013 -0400
+++ b/hedgewars/uGearsUtils.pas	Tue May 28 14:09:19 2013 -0400
@@ -263,6 +263,7 @@
     
 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
 begin
+if Hedgehog^.Effects[heFrozen] <> 0 then exit;
 if (Source = dsFall) or (Source = dsExplosion) then
     case random(3) of
         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
@@ -289,32 +290,34 @@
     i: LongWord;
     particle: PVisualGear;
 begin
-    if _0_4 < Gear^.dY then
-        begin
-        dmg := ModifyDamage(1 + hwRound((Gear^.dY - _0_4) * 70), Gear);
-        PlaySound(sndBump);
-        if dmg < 1 then
-            exit;
+if _0_4 < Gear^.dY then
+    begin
+    dmg := ModifyDamage(1 + hwRound((Gear^.dY - _0_4) * 70), Gear);
+    if Gear^.Hedgehog^.Effects[heFrozen] = 0 then
+         PlaySound(sndBump)
+    else PlaySound(sndFrozenHogImpact);
+    if dmg < 1 then
+        exit;
 
-        for i:= min(12, (3 + dmg div 10)) downto 0 do
-            begin
-            particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
-            if particle <> nil then
-                particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480);
-            end;
+    for i:= min(12, (3 + dmg div 10)) downto 0 do
+        begin
+        particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
+        if particle <> nil then
+            particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480);
+        end;
 
-        if (Gear^.Invulnerable) then
-            exit;
+    if (Gear^.Invulnerable) then
+        exit;
 
-        //if _0_6 < Gear^.dY then
-        //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
-        //else
-        //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
+    //if _0_6 < Gear^.dY then
+    //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
+    //else
+    //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
 
-        if Gear^.LastDamage <> nil then
-            ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
-        else
-            ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
+    if Gear^.LastDamage <> nil then
+        ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
+    else
+        ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
     end
 end;