Skip drawing some stuff if water is opaque. Affects simulation.
authornemo
Mon, 22 Feb 2010 00:53:04 +0000
changeset 2840 bb9117753fe4
parent 2839 95977f876122
child 2841 2c9013664ea3
Skip drawing some stuff if water is opaque. Affects simulation.
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Mon Feb 22 00:47:50 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Feb 22 00:53:04 2010 +0000
@@ -126,9 +126,9 @@
 AllInactive:= false;
 Gear^.Y:= Gear^.Y + cDrownSpeed;
 Gear^.X:= Gear^.X + Gear^.dX * cDrownSpeed;
-if hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater then DeleteGear(Gear);
+if (cWaterOpacity > $FE) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then DeleteGear(Gear);
 // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
-if (GameTicks and $1F) = 0 then
+if (cWaterOpacity < $FF) and ((GameTicks and $1F) = 0) then
     if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
         AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble)
     else if Random(12) = 0 then
--- a/hedgewars/uGears.pas	Mon Feb 22 00:47:50 2010 +0000
+++ b/hedgewars/uGears.pas	Mon Feb 22 00:53:04 2010 +0000
@@ -457,7 +457,8 @@
 			begin
 			t:= max(Gear^.Damage, Gear^.Health);
 			Gear^.Damage:= t;
-			AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
+            if cWaterOpacity < $FF then
+			    AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
 			uStats.HedgehogDamaged(Gear)
 			end;