Spawn bubbles instead of sparkles when air mine is stunned underwater
authorWuzzy <Wuzzy2@mail.ru>
Thu, 11 Jul 2019 03:22:35 +0200
changeset 15231 eb61cf77b365
parent 15230 ebbc2f04b863
child 15232 263b9850c16d
Spawn bubbles instead of sparkles when air mine is stunned underwater
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Thu Jul 11 02:25:07 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Jul 11 03:22:35 2019 +0200
@@ -2104,16 +2104,20 @@
     if Gear^.Tag <> 0 then
         begin
         if ((Gear^.FlightTime and $FF) = 0) then
-            begin
-            sparkle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
-            if sparkle <> nil then
+            // spawn lots of particles when stunned (sparkles or bubbles)
+            if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) = false then
                 begin
-                    sparkle^.dX:= 0.004 * (random(100) - 50);
-                    sparkle^.dY:= -0.05 + 0.004 * (random(100) - 50);
-                    sparkle^.Tint:= $D5CD8CFF;
-                    sparkle^.Angle:= random(360);
-                end;
-            end;
+                sparkle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
+                if sparkle <> nil then
+                    begin
+                        sparkle^.dX:= 0.004 * (random(100) - 50);
+                        sparkle^.dY:= -0.05 + 0.004 * (random(100) - 50);
+                        sparkle^.Tint:= $D5CD8CFF;
+                        sparkle^.Angle:= random(360);
+                    end;
+                end
+            else
+                AddVisualGear(hwRound(Gear^.X) - 8 + random(16), hwRound(Gear^.Y) + 16 + random(8), vgtBubble);
 
         dec(Gear^.FlightTime);
         if Gear^.FlightTime = 0 then