remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
--- a/hedgewars/GSHandlers.inc Sun Sep 26 16:28:04 2010 -0400
+++ b/hedgewars/GSHandlers.inc Sun Sep 26 19:06:59 2010 -0400
@@ -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 Sun Sep 26 16:28:04 2010 -0400
+++ b/hedgewars/GearDrawing.inc Sun Sep 26 19:06:59 2010 -0400
@@ -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 Sun Sep 26 16:28:04 2010 -0400
+++ b/hedgewars/HHHandlers.inc Sun Sep 26 19:06:59 2010 -0400
@@ -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 Sun Sep 26 16:28:04 2010 -0400
+++ b/hedgewars/VGSHandlers.inc Sun Sep 26 19:06:59 2010 -0400
@@ -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 Sun Sep 26 16:28:04 2010 -0400
+++ b/hedgewars/uVisualGears.pas Sun Sep 26 19:06:59 2010 -0400
@@ -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)