merge
authorkoda
Mon, 27 Sep 2010 04:58:26 +0200
changeset 3913 f9cb69eecefe
parent 3912 e11df2de6af2 (current diff)
parent 3909 4ba25a3d15af (diff)
child 3914 c5c903c6225b
merge
--- a/hedgewars/GSHandlers.inc	Mon Sep 27 04:58:15 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Mon Sep 27 04:58:26 2010 +0200
@@ -2959,9 +2959,12 @@
 procedure doStepJetpackWork(Gear: PGear);
 var 
     HHGear: PGear;
-    fuel: LongInt;
+    fuel, i: LongInt;
     move: hwFloat;
+    isUnderwater: Boolean;
+    bubble: PVisualGear;
 begin
+    isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
     if Gear^.Pos > 0 then dec(Gear^.Pos);
     AllInactive := false;
     HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
@@ -2979,15 +2982,43 @@
         if (HHGear^.Message and gmUp) <> 0 then
             begin
             if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then
-                HHGear^.dY := HHGear^.dY - move;
+                begin
+                if isUnderwater then
+                    begin
+                    HHGear^.dY := HHGear^.dY - (move * _0_7);
+                    for i:= random(10)+10 downto 0 do
+                        begin
+                        bubble := AddVisualGear(hwRound(HHGear^.X) - 8 + random(16), hwRound(HHGear^.Y) + 16 + random(8), vgtBubble);
+                        if bubble <> nil then bubble^.dY:= random(20)/10+0.1;
+                        end
+                    end
+                else HHGear^.dY := HHGear^.dY - move;
+                end;
             dec(Gear^.Health, fuel);
             Gear^.MsgParam := Gear^.MsgParam or gmUp;
             Gear^.Timer := GameTicks
             end;
-        if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true;
+        move.isNegative := (HHGear^.Message and gmLeft) <> 0;
         if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then
             begin
             HHGear^.dX := HHGear^.dX + (move * _0_1);
+            if isUnderwater then
+                begin
+                for i:= random(5)+5 downto 0 do
+                    begin
+                    bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble);
+                    if bubble <> nil then 
+                        begin
+                        bubble^.dX:= (random(10)/10 + 0.02) * -1;
+                        if (move.isNegative) then
+                            begin
+                            bubble^.X := bubble^.X + 28;
+                            bubble^.dX *= -1
+                            end
+                        else bubble^.X := bubble^.X - 28;
+                        end;
+                    end
+                end;
             dec(Gear^.Health, fuel div 5);
             Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight));
             Gear^.Timer := GameTicks
--- a/hedgewars/GearDrawing.inc	Mon Sep 27 04:58:15 2010 +0200
+++ b/hedgewars/GearDrawing.inc	Mon Sep 27 04:58:26 2010 +0200
@@ -599,9 +599,12 @@
         case CurAmmoGear^.Kind of
             gtJetpack: begin
                        DrawSprite(sprJetpack, sx-32, sy-32, 0);
-                       if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1);
-                       if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2);
-                       if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3);
+                       if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then
+                           begin
+                           if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1);
+                           if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2);
+                           if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3)
+                           end;
                        if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex);
                        DrawAltWeapon(Gear, sx, sy)
                        end;
--- a/hedgewars/HHHandlers.inc	Mon Sep 27 04:58:15 2010 +0200
+++ b/hedgewars/HHHandlers.inc	Mon Sep 27 04:58:26 2010 +0200
@@ -621,8 +621,10 @@
    begin
    if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0;
    Gear^.State:= Gear^.State or gstMoving;
-   Gear^.dY:= Gear^.dY + cGravity
-   end else
+   if isUnderwater then Gear^.dY:= Gear^.dY + cGravity / _2
+   else Gear^.dY:= Gear^.dY + cGravity
+   end 
+else
    begin
    if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
       and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
--- a/hedgewars/VGSHandlers.inc	Mon Sep 27 04:58:15 2010 +0200
+++ b/hedgewars/VGSHandlers.inc	Mon Sep 27 04:58:26 2010 +0200
@@ -201,9 +201,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepBubble(Gear: PVisualGear; Steps: Longword);
 begin
-    Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps;
+    Gear^.X:= Gear^.X + Gear^.dX * Steps;
+    Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
     Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps;
 
+    Gear^.dX /= (1.001 * Steps);
+    Gear^.dY /= (1.001 * Steps);
+
     if (Gear^.FrameTicks <= Steps) or (round(Gear^.Y) < cWaterLine) then
         DeleteVisualGear(Gear)
     else
--- a/hedgewars/uVisualGears.pas	Mon Sep 27 04:58:15 2010 +0200
+++ b/hedgewars/uVisualGears.pas	Mon Sep 27 04:58:26 2010 +0200
@@ -213,7 +213,7 @@
                 end;
     vgtBubble: begin
                 dx:= 0.0000038654705 * random(10000);
-                dy:= 0.001 * (random(85) + 95);
+                dy:= 0;
                 if random(2) = 0 then dx := -dx;
                 FrameTicks:= 250 + random(1751);
                 Frame:= random(5)