# HG changeset patch # User nemo # Date 1289622551 18000 # Node ID 4866cc130b8d493592dc3897395eb833b63a2fdc # Parent d23f8a25fc3fab63c6d25e848f5b22e734f51ed8 Apply wind while roping too (with the game flag set) diff -r d23f8a25fc3f -r 4866cc130b8d hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Fri Nov 12 21:30:00 2010 -0500 +++ b/hedgewars/GSHandlers.inc Fri Nov 12 23:29:11 2010 -0500 @@ -320,7 +320,7 @@ if isFalling then begin Gear^.dY := Gear^.dY + cGravity; - if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed * _16 / max(12,sqr(Gear^.Radius)); + if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed * _16 / max(12,sqr(Gear^.Radius)) end; Gear^.X := Gear^.X + Gear^.dX; @@ -1110,6 +1110,7 @@ HHGear^.X := HHGear^.X + HHGear^.dX; HHGear^.Y := HHGear^.Y + HHGear^.dY; HHGear^.dY := HHGear^.dY + cGravity; + if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed * _0_2; if (Gear^.Message and gmAttack) <> 0 then begin @@ -1172,7 +1173,11 @@ else if (Gear^.Message and gmRight <> 0) then HHGear^.dX := HHGear^.dX + _0_0002; - if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY := HHGear^.dY + cGravity; + if not TestCollisionYwithGear(HHGear, 1) then + begin + HHGear^.dY := HHGear^.dY + cGravity; + if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed * _0_2 + end; ropeDx := HHGear^.X - Gear^.X; // vector between hedgehog and rope attaching point @@ -1373,7 +1378,8 @@ begin HHGear^.Y := HHGear^.Y + HHGear^.dY; Gear^.Y := Gear^.Y + HHGear^.dY; - HHGear^.dY := HHGear^.dY + cGravity + HHGear^.dY := HHGear^.dY + cGravity; + if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed * _0_2 end; tt := Gear^.Elasticity; @@ -3089,7 +3095,6 @@ Gear^.Timer := GameTicks end end; - if not isUnderwater and ((GameFlags and gfMoreWind) <> 0) then HHGear^.dX := HHGear^.dX + cWindSpeed * _16 / sqr(cHHRadius); // erases them all at once :-/ if (Gear^.Timer <> 0) and (GameTicks - Gear^.Timer > 250) then @@ -3221,7 +3226,6 @@ dec(Gear^.Health, fuel div 5); Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight)); end; - if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed * _16 / sqr(cHHRadius); if Gear^.Health < 0 then Gear^.Health := 0; if ((GameTicks and $FF) = 0) and (Gear^.Health < 500) then diff -r d23f8a25fc3f -r 4866cc130b8d hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Fri Nov 12 21:30:00 2010 -0500 +++ b/hedgewars/HHHandlers.inc Fri Nov 12 23:29:11 2010 -0500 @@ -662,11 +662,22 @@ if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0; Gear^.State:= Gear^.State or gstMoving; if isUnderwater then Gear^.dY:= Gear^.dY + cGravity / _2 - else Gear^.dY:= Gear^.dY + cGravity + else + begin + Gear^.dY:= Gear^.dY + cGravity; +// this set of circumstances could be less complex if jumping was more clearly identified + if ((GameFlags and gfMoreWind) <> 0) and + (Gear^.Damage <> 0) or + ((CurAmmoGear <> nil) and + ((CurAmmoGear^.AmmoType = amJetpack) or + (CurAmmoGear^.AmmoType = amBirdy))) or + ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue) + then Gear^.dX := Gear^.dX + cWindSpeed * _0_2 + end end else begin - if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55) + if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX); if not Gear^.dY.isNegative then