Palewolf adds bubbles and splashes when firing bullets into the water
authornemo
Sun, 14 Mar 2010 20:46:29 +0000
changeset 2994 7ae3067546f2
parent 2993 d83edb74e92d
child 2995 b90745d87332
Palewolf adds bubbles and splashes when firing bullets into the water
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Mar 14 20:32:56 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Mar 14 20:46:29 2010 +0000
@@ -69,7 +69,8 @@
         CheckGearDrowning:= true;
         Gear^.State:= gstDrowning;
         Gear^.RenderTimer:= false;
-        Gear^.doStep:= @doStepDrowningGear;
+        if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) then
+          Gear^.doStep:= @doStepDrowningGear;
         if Gear^.Kind = gtHedgehog then
             begin
             Gear^.State:= Gear^.State and (not gstHHDriven);
@@ -88,7 +89,7 @@
             particle := AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), LAND_HEIGHT, vgtDroplet);
             if particle <> nil then
                 begin
-                particle^.dX := particle^.dX + (Gear^.dX / 5);
+                particle^.dX := particle^.dX - (Gear^.dX / 10);
                 particle^.dY := particle^.dY - (Gear^.dY / 5)
                 end
             end
@@ -536,6 +537,13 @@
     Gear^.doStep:= @doStepShotIdle;
     exit
     end;
+
+CheckGearDrowning(Gear);
+if (Gear^.State and gstDrowning) <> 0 then
+    begin
+    Gear^.doStep:= @doStepShotIdle;
+    exit
+    end;
 dec(i)
 until i = 0;
 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
@@ -564,14 +572,25 @@
           AmmoShove(Gear, 7, 20)
       else
           AmmoShove(Gear, Gear^.Timer, 20);
+  CheckGearDrowning(Gear);
   dec(i)
-until (i = 0) or (Gear^.Damage > Gear^.Health);
+until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
 if Gear^.Damage > 0 then
    begin
    DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1);
    dec(Gear^.Health, Gear^.Damage);
    Gear^.Damage:= 0
    end;
+if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and (cWaterOpacity < $FF) then
+    begin
+    for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do
+        begin
+        if Random(6) = 0 then
+            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble);
+        Gear^.X:= Gear^.X + Gear^.dX;
+        Gear^.Y:= Gear^.Y + Gear^.dY;
+        end;
+    end;
 
 if (Gear^.Health <= 0)
     or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0)
--- a/hedgewars/uGears.pas	Sun Mar 14 20:32:56 2010 +0000
+++ b/hedgewars/uGears.pas	Sun Mar 14 20:46:29 2010 +0000
@@ -914,7 +914,7 @@
             0);
     defaultPos:= false
     end else
-if (Gear^.State and gstLoser) <> 0 then // for now using the jackhammer for its kind of bemused "oops" look
+if (Gear^.State and gstLoser) <> 0 then
     begin
     DrawHedgehog(sx, sy,
             hwSign(Gear^.dX),