# HG changeset patch # User nemo # Date 1424113112 18000 # Node ID 2b717f687c72271fb1ae3e1e03151c9f3c2f9086 # Parent bc5215b2f9fbf523d01fa819ea2c709d1512fcab make mines submersible diff -r bc5215b2f9fb -r 2b717f687c72 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Sun Feb 15 21:27:27 2015 -0500 +++ b/hedgewars/uGearsHandlersMess.pas Mon Feb 16 13:58:32 2015 -0500 @@ -1762,11 +1762,16 @@ var i,t,targDist,tmpDist: LongWord; targ, tmpG: PGear; trackSpeed, airFriction, tX, tY: hwFloat; + isUnderwater: Boolean; begin + isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); if Gear^.Pos > 0 then begin airFriction:= _1; - dec(airFriction.QWordValue,Gear^.Pos); + if isUnderwater then + dec(airFriction.QWordValue,Gear^.Pos*2) + else + dec(airFriction.QWordValue,Gear^.Pos); Gear^.dX:= Gear^.dX*airFriction; Gear^.dY:= Gear^.dY*airFriction end; @@ -1837,7 +1842,10 @@ if targ <> nil then begin trackSpeed:= _0; - trackSpeed.QWordValue:= Gear^.Power; + if isUnderwater then + trackSpeed.QWordValue:= Gear^.Power div 2 + else + trackSpeed.QWordValue:= Gear^.Power; if (Gear^.X < targ^.X) and (Gear^.dX < _0_1) then Gear^.dX:= Gear^.dX+trackSpeed // please leave as an add. I like the effect else if (Gear^.X > targ^.X) and (Gear^.dX > -_0_1) then diff -r bc5215b2f9fb -r 2b717f687c72 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Sun Feb 15 21:27:27 2015 -0500 +++ b/hedgewars/uGearsList.pas Mon Feb 16 13:58:32 2015 -0500 @@ -364,7 +364,7 @@ gear^.ImpactSound:= sndDenied; gear^.nImpactSounds:= 1; gear^.Health:= 30; - gear^.State:= gear^.State or gstMoving or gstNoGravity; + gear^.State:= gear^.State or gstMoving or gstNoGravity or gstSubmersible; gear^.Radius:= 8; gear^.Elasticity:= _0_55; gear^.Friction:= _0_995; diff -r bc5215b2f9fb -r 2b717f687c72 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Sun Feb 15 21:27:27 2015 -0500 +++ b/hedgewars/uGearsUtils.pas Mon Feb 16 13:58:32 2015 -0500 @@ -82,6 +82,7 @@ vg: PVisualGear; i, cnt: LongInt; wrap: boolean; + bubble: PVisualGear; begin if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')'); if Radius > 25 then KickFlakes(Radius, X, Y); @@ -89,7 +90,17 @@ if ((Mask and EXPLNoGfx) = 0) then begin vg:= nil; - if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion) + if CheckCoordInWater(X, Y - Radius) then + begin + cnt:= 2 * Radius; + for i:= (Radius * Radius) div 4 downto 0 do + begin + bubble := AddVisualGear(X - Radius + random(cnt), Y - Radius + random(cnt), vgtBubble); + if bubble <> nil then + bubble^.dY:= 0.1 + random(20)/10; + end + end + else if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion) else if Radius > 10 then vg:= AddVisualGear(X, Y, vgtExplosion); if vg <> nil then vg^.Tint:= Tint;