Drown the hog using the piano
authornemo
Sun, 02 May 2010 14:38:46 +0000
changeset 3399 885304636abf
parent 3398 ede254e24545
child 3400 4003bf74588a
Drown the hog using the piano
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
--- 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);
--- a/hedgewars/HHHandlers.inc	Sun May 02 04:51:29 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Sun May 02 14:38:46 2010 +0000
@@ -250,6 +250,10 @@
                       amLaserSight: cLaserSighting:= true;
                       amVampiric: cVampiric:= true;
                       amPiano: begin
+                               // Tuck the hedgehog away until the piano attack is completed
+                               Unplaced:= true;
+                               X:= _0;
+                               Y:= _0;
                                FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
                                PauseMusic
                                end;
--- a/hedgewars/uGears.pas	Sun May 02 04:51:29 2010 +0000
+++ b/hedgewars/uGears.pas	Sun May 02 14:38:46 2010 +0000
@@ -523,7 +523,7 @@
             begin
             t:= max(Gear^.Damage, Gear^.Health);
             Gear^.Damage:= t;
-            if cWaterOpacity < $FF then
+            if (cWaterOpacity < $FF) and (hwRound(Gear^.Y) < cWaterLine + 256) then
                 AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
             uStats.HedgehogDamaged(Gear)
             end;