--- a/hedgewars/uGearsHandlersMess.pas Sun Sep 02 00:07:33 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas Sun Sep 02 01:25:37 2018 +0200
@@ -307,9 +307,28 @@
AddVisualGear(bubbleX, bubbleY, vgtBubble)
else if Random(12) = 0 then
AddVisualGear(bubbleX, bubbleY, vgtBubble);
+// Insta-delete gear and skip drowning animation if water is 100% opaque
if (not SuddenDeathDmg and (WaterOpacity > $FE))
-or (SuddenDeathDmg and (SDWaterOpacity > $FE))
-or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
+or (SuddenDeathDmg and (SDWaterOpacity > $FE)) then
+ begin
+ // Teleport gear to a suitable position for the damage tag in the water
+ if (WorldEdge = weSea) and (hwRound(Gear^.X) - Gear^.Radius < leftX) then
+ begin
+ if (hwRound(Gear^.X) - Gear^.Radius > leftX - 90) then
+ Gear^.X := Gear^.X - _90
+ end
+ else if (WorldEdge = weSea) and (hwRound(Gear^.X) + Gear^.Radius > rightX) then
+ begin
+ if (hwRound(Gear^.X) - Gear^.Radius < rightX + 90) then
+ Gear^.X := Gear^.X + _90
+ end
+ else
+ Gear^.Y := int2hwFloat(Gear^.Radius + cWaterLine + cVisibleWater);
+ DeleteGear(Gear);
+ exit;
+ end;
+// Delete normally if gear is outside of visible range
+if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
DeleteGear(Gear);
end;