hedgewars/uGearsHandlersMess.pas
changeset 13855 4e4111a75256
parent 13796 096cc009e0b8
child 13856 f01798038c2e
--- a/hedgewars/uGearsHandlersMess.pas	Fri Oct 05 16:36:41 2018 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Oct 05 16:49:17 2018 +0200
@@ -138,7 +138,6 @@
 procedure doStepGenericFaller(Gear: PGear);
 procedure doStepCreeper(Gear: PGear);
 procedure doStepKnife(Gear: PGear);
-procedure doStepDuck(Gear: PGear);
 procedure doStepMinigunWork(Gear: PGear);
 procedure doStepMinigun(Gear: PGear);
 procedure doStepMinigunBullet(Gear: PGear);
@@ -6839,179 +6838,6 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
-procedure doStepDuck(Gear: PGear);
-begin
-    // Mirror duck on bounce world edge, even turn around later
-    if WorldWrap(Gear) and (WorldEdge = weBounce) then
-        begin
-        Gear^.Tag:= Gear^.Tag * -1;
-        if Gear^.Pos = 2 then
-            Gear^.Pos:= 1
-        else if Gear^.Pos = 1 then
-            Gear^.Pos:= 2
-        else if Gear^.Pos = 5 then
-            Gear^.Pos:= 6
-        else if Gear^.Pos = 5 then
-            Gear^.Pos:= 5;
-        end;
-
-    AllInactive := false;
-
-    // Duck falls (Pos = 0)
-    if Gear^.Pos = 0 then
-        doStepFallingGear(Gear);
-
-    (* Check if duck is near water surface
-           (Karma is distance from water) *)
-    if (Gear^.Pos <> 1) and (Gear^.Pos <> 2) and (cWaterLine <= hwRound(Gear^.Y) + Gear^.Karma) then
-        begin
-        if cWaterLine = hwRound(Gear^.Y) + Gear^.Karma then
-            begin
-            // Let's make that duck swim!
-            // Does the duck come FROM the Sea edge? (left or right)
-            if (((Gear^.Pos = 3) or (Gear^.Pos = 7)) and (cWindSpeed > _0)) or (((Gear^.Pos = 4) or (Gear^.Pos = 8)) and (cWindSpeed < _0)) then
-                begin
-                PlaySound(sndDuckWater);
-                Gear^.DirAngle:= 0;
-                Gear^.Pos:= 1;
-                Gear^.dY:= _0;
-                end;
-
-            // Duck comes either falling (usual case) or was rising from below
-            if (Gear^.Pos = 0) or (Gear^.Pos = 5) or (Gear^.Pos = 6) then
-                begin
-                PlaySound(sndDroplet2);
-                if Gear^.dY > _0_4 then
-                    PlaySound(sndDuckWater);
-                Gear^.Pos:= 1;
-                Gear^.dY:= _0;
-                end;
-            end
-        else if Gear^.Pos = 0 then
-            Gear^.Pos:= 5;
-        end;
-
-    // Manual speed handling when duck is on water
-    if Gear^.Pos <> 0 then
-        begin
-        Gear^.X:= Gear^.X + Gear^.dX;
-        Gear^.Y:= Gear^.Y + Gear^.dY;
-        end;
-
-    // Handle speed
-    // 1-4: On water: Let's swim!
-    if Gear^.Pos = 1 then
-        // On water (normal)
-        Gear^.dX:= cWindSpeed * Gear^.Damage
-    else if Gear^.Pos = 2 then
-        // On water, mirrored (after bounce edge bounce)
-        Gear^.dX:= -cWindSpeed * Gear^.Damage
-    else if Gear^.Pos = 3 then
-        // On left Sea edge
-        Gear^.dY:= cWindSpeed * Gear^.Damage
-    else if Gear^.Pos = 4 then
-        // On right Sea edge
-        Gear^.dY:= -cWindSpeed * Gear^.Damage
-    // 5-8: Underwater: Slowly rise to the surface and slightly follow wind
-    else if Gear^.Pos = 5 then
-        // Underwater (normal)
-        begin
-        Gear^.dX:= (cWindSpeed / 4) * Gear^.Damage;
-        Gear^.dY:= -_0_07;
-        end
-    else if Gear^.Pos = 6 then
-        // Underwater, mirrored duck (after bounce edge bounce)
-        begin
-        Gear^.dX:= -(cWindSpeed / 4) * Gear^.Damage;
-        Gear^.dY:= -_0_07;
-        end
-    else if Gear^.Pos = 7 then
-        // Inside left Sea edge
-        begin
-        Gear^.dX:= _0_07;
-        Gear^.dY:= (cWindSpeed / 4) * Gear^.Damage;
-        end
-    else if Gear^.Pos = 8 then
-        // Inside right Sea edge
-        begin
-        Gear^.dX:= -_0_07;
-        Gear^.dY:= -(cWindSpeed / 4) * Gear^.Damage;
-        end;
- 
-    
-    // Rotate duck and change direction when reaching Sea world edge (Pos 3 or 4)
-    if (WorldEdge = weSea) and (Gear^.Pos <> 3) and (Gear^.Pos <> 4) then
-        // Swimming TOWARDS left edge
-        if (LeftX >= hwRound(Gear^.X) - Gear^.Karma) and ((cWindSpeed < _0) or ((Gear^.Pos = 0) or (Gear^.Pos = 7))) then
-            begin
-            // Turn duck when reaching edge the first time
-            if (Gear^.Pos <> 3) and (Gear^.Pos <> 7) then
-                begin
-                if Gear^.Tag = 1 then
-                    Gear^.DirAngle:= 90
-                else
-                    Gear^.DirAngle:= 270;
-                end;
-
-            // Reaching the edge surface
-            if (LeftX = hwRound(Gear^.X) - Gear^.Karma) and (Gear^.Pos <> 3) then
-                // We are coming from the horizontal side
-                begin
-                PlaySound(sndDuckWater);
-                Gear^.dX:= _0;
-                Gear^.Pos:= 3;
-                end
-            else 
-                // We are coming from inside the Sea, go into “surfacing” mode
-                Gear^.Pos:= 7;
-
-            end
-
-        // Swimming TOWARDS right edge (similar to left edge)
-        else if (RightX <= hwRound(Gear^.X) + Gear^.Karma) and ((cWindSpeed > _0) or ((Gear^.Pos = 0) or (Gear^.Pos = 8))) then
-            begin
-            if (Gear^.Pos <> 4) and (Gear^.Pos <> 8) then
-                begin
-                if Gear^.Tag = 1 then
-                    Gear^.DirAngle:= 270
-                else
-                    Gear^.DirAngle:= 90;
-                end;
-
-            if (RightX = hwRound(Gear^.X) + Gear^.Karma) and (Gear^.Pos <> 4) then
-                begin
-                PlaySound(sndDuckWater);
-                Gear^.dX:= _0;
-                Gear^.Pos:= 4;
-                end
-            else 
-                Gear^.Pos:= 8;
-
-            end;
-
-
-    if Gear^.Pos <> 0 then
-        // Manual collision check required because we don't use onStepFallingGear in this case
-        CheckCollision(Gear);
-    if (Gear^.Timer = 0) or ((Gear^.State and gstCollision) <> 0) then
-        // Explode duck
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
-        PlaySound(sndDuckDie);
-        DeleteGear(Gear);
-        exit;
-        end;
-
-    // Update timer stuff
-    if Gear^.Timer < 6000 then
-        Gear^.RenderTimer:= true
-    else
-        Gear^.RenderTimer:= false;
-
-    dec(Gear^.Timer);
-end;
-
-////////////////////////////////////////////////////////////////////////////////
 procedure doStepMinigunWork(Gear: PGear);
 var HHGear: PGear;
     bullet: PGear;