Drowning gears: Delete big gears when they're *completely* out of visible area
authorWuzzy <Wuzzy2@mail.ru>
Mon, 15 Jul 2019 21:13:01 +0200
changeset 15265 44533b2e4fb1
parent 15264 c70de34686ac
child 15266 395563ffc8b5
Drowning gears: Delete big gears when they're *completely* out of visible area
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Mon Jul 15 20:46:50 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Jul 15 21:13:01 2019 +0200
@@ -349,8 +349,21 @@
     DeleteGear(Gear);
     exit;
     end;
-// Delete normally if gear is outside of visible range
-if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
+// Delete gear normally if it is outside of visible range.
+// But first determine size tolerance for big gears to make sure the gear is REALLY out of range.
+if Gear^.Kind = gtPiano then
+    d:= SpritesData[sprPiano].height
+else if Gear^.Kind = gtRCPlane then
+    d:= SpritesData[sprPlane].width
+else if Gear^.Kind = gtKnife then
+    d:= SpritesData[sprKnife].height
+else if Gear^.Kind = gtDynamite then
+    d:= SpritesData[sprDynamite].height
+else if Gear^.Kind = gtSnowball then
+    d:= SpritesData[sprSnowball].height
+else
+    d:= Gear^.Radius * 2;
+if (hwRound(Gear^.Y) > d + cWaterLine + cVisibleWater) then
     DeleteGear(Gear);
 end;