Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
--- a/hedgewars/GSHandlers.inc Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/GSHandlers.inc Tue May 14 08:57:30 2013 -0400
@@ -178,6 +178,12 @@
if Gear^.dY.Round > 2 then
Gear^.dY.QWordValue:= 8589934592;
+ if (Gear^.State and gstSubmersible <> 0) and (hwRound(Gear^.Y) > cWaterLine) then
+ begin
+ Gear^.dX:= Gear^.dX * _0_999;
+ Gear^.dY:= Gear^.dY * _0_999
+ end;
+
Gear^.State := Gear^.State and (not gstCollision);
collV := 0;
collH := 0;
@@ -185,6 +191,7 @@
tdY := Gear^.dY;
+
// might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
if (hwRound(Gear^.X) < min(LAND_WIDTH div -2, -2048))
or (hwRound(Gear^.X) > max(LAND_WIDTH * 3 div 2, 6144)) then
--- a/hedgewars/uAmmos.pas Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/uAmmos.pas Tue May 14 08:57:30 2013 -0400
@@ -278,7 +278,9 @@
PackAmmo(Ammo, Ammoz[AmmoType].Slot);
//SwitchNotHeldAmmo(Hedgehog);
if CurAmmoType = amKnife then LoadHedgehogHat(Hedgehog, Hedgehog.Hat);
- CurAmmoType:= amNothing
+ if CurAmmoGear <> nil then
+ SetWeapon(CurAmmoGear^.AmmoType)
+ else CurAmmoType:= amNothing;
end
end
end;
--- a/hedgewars/uConsts.pas Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/uConsts.pas Tue May 14 08:57:30 2013 -0400
@@ -212,7 +212,7 @@
gstLoser = $00080000;
gstHHGone = $00100000;
gstInvisible = $00200000;
- gstNoDrown = $00400000;
+ gstSubmersible = $00400000;
// gear messages
gmLeft = $00000001;
--- a/hedgewars/uGearsHedgehog.pas Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/uGearsHedgehog.pas Tue May 14 08:57:30 2013 -0400
@@ -259,16 +259,8 @@
begin
if (CurAmmoGear^.AmmoType = amJetpack) and (Gear^.Message and gmPrecise <> 0) then
begin
- if hwRound(Gear^.Y) > cWaterLine then
- begin
- newDx:= xx*cMaxPower/cPowerDivisor/2;
- newDy:= yy*cMaxPower/cPowerDivisor/2
- end
- else
- begin
- newDx:= xx*cMaxPower/cPowerDivisor;
- newDy:= yy*cMaxPower/cPowerDivisor
- end
+ newDx:= xx*cMaxPower/cPowerDivisor;
+ newDy:= yy*cMaxPower/cPowerDivisor
end
else
begin
@@ -409,7 +401,7 @@
end;
if (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack) and
(Gear^.Message and gmPrecise <> 0) and (hwRound(Y) > cWaterLine) then
- newGear^.State:= newGear^.State or gstNoDrown;
+ newGear^.State:= newGear^.State or gstSubmersible;
case CurAmmoType of
amGrenade, amMolotov,
@@ -534,7 +526,9 @@
begin
if TagTurnTimeLeft = 0 then
TagTurnTimeLeft:= TurnTimeLeft;
- TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
+ if (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0) and (hwRound(CurAmmoGear^.Y) > cWaterLine) then
+ TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 25
+ else TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
end;
if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then
HHGear^.State:= HHGear^.State or gstAttacked;
--- a/hedgewars/uGearsList.pas Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/uGearsList.pas Tue May 14 08:57:30 2013 -0400
@@ -470,7 +470,7 @@
gtJetpack: begin
gear^.Health:= 2000;
gear^.Damage:= 100;
- gear^.State:= gstNoDrown
+ gear^.State:= gstSubmersible
end;
gtMolotov: begin
gear^.Radius:= 6;
--- a/hedgewars/uGearsUtils.pas Tue May 14 07:16:14 2013 -0400
+++ b/hedgewars/uGearsUtils.pas Tue May 14 08:57:30 2013 -0400
@@ -361,7 +361,7 @@
else DeleteGear(Gear);
exit
end;
- isSubmersible:= ((Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack)) or (Gear^.State and gstNoDrown <> 0);
+ isSubmersible:= ((Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0)) or (Gear^.State and gstSubmersible <> 0);
skipSpeed := _0_25;
skipAngle := _1_9;
skipDecay := _0_87;
@@ -408,7 +408,7 @@
exit // skip splashes
end
else if (Y > cWaterLine + cVisibleWater*4) and
- ((Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.AmmoType <> amJetpack)) then
+ ((Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.State and gstSubmersible = 0)) then
Gear^.doStep:= @doStepDrowningGear;
if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius))
or (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and (Gear = CurAmmoGear) and ((CurAmmoGear^.Pos = 0)