hedgewars/GSHandlers.inc
changeset 3399 885304636abf
parent 3398 ede254e24545
child 3401 d5d31d16eccc
--- a/hedgewars/GSHandlers.inc	Sun May 02 04:51:29 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun May 02 14:38:46 2010 +0000
@@ -79,10 +79,11 @@
             Gear^.State:= Gear^.State and (not gstHHDriven);
             AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
             end;
-        PlaySound(sndSplash)
+        if hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius then // don't play splash if they are already way past the surface
+            PlaySound(sndSplash)
         end;
     
-    if not cReducedQuality then 
+    if not cReducedQuality and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius) then 
         begin
         AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash);
        
@@ -3158,7 +3159,17 @@
 doStepFallingGear(Gear);
 
 if (Gear^.State and gstDrowning) <> 0 then
+    begin
+    if CurrentHedgehog^.Gear <> nil then
+        begin
+        // Drown the hedgehog.  Could also just delete it, but hey, this gets a caption
+        CurrentHedgehog^.Gear^.Active:= true;
+        CurrentHedgehog^.Gear^.X:= Gear^.X;
+        CurrentHedgehog^.Gear^.Y:=int2hwFloat(cWaterLine+cVisibleWater)+_128;
+        CurrentHedgehog^.Unplaced:= false
+        end;
     ResumeMusic
+    end
 else if (Gear^.State and gstCollision) <> 0 then
     begin
     r0:= GetRandom(21);