hedgewars/uGearsHandlersMess.pas
changeset 11389 c93f204a5a00
parent 11342 aa3f886c6298
child 11391 bc9650ec9b20
equal deleted inserted replaced
11385:4bf720dcef01 11389:c93f204a5a00
   341     tdY := Gear^.dY;
   341     tdY := Gear^.dY;
   342 
   342 
   343 // might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
   343 // might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
   344     if (gX < min(LAND_WIDTH div -2, -2048))
   344     if (gX < min(LAND_WIDTH div -2, -2048))
   345     or (gX > max(LAND_WIDTH * 3 div 2, 6144)) then
   345     or (gX > max(LAND_WIDTH * 3 div 2, 6144)) then
   346         Gear^.State := Gear^.State or gstCollision;
   346         Gear^.Message := Gear^.Message or gmDestroy;
   347 
   347 
   348     if Gear^.dY.isNegative then
   348     if Gear^.dY.isNegative then
   349         begin
   349         begin
   350         land:= TestCollisionYwithGear(Gear, -1);
   350         land:= TestCollisionYwithGear(Gear, -1);
   351         isFalling := land = 0;
   351         isFalling := land = 0;
   462         end;
   462         end;
   463 
   463 
   464     if Gear^.AdvBounce > 1 then
   464     if Gear^.AdvBounce > 1 then
   465         dec(Gear^.AdvBounce);
   465         dec(Gear^.AdvBounce);
   466 
   466 
   467     if isFalling then
   467     if isFalling and (Gear^.State and gstNoGravity = 0) then
   468         begin
   468         begin
   469         if Gear^.State and gstNoGravity = 0 then
   469         Gear^.dY := Gear^.dY + cGravity;
   470             Gear^.dY := Gear^.dY + cGravity;
   470         if (GameFlags and gfMoreWind <> 0) and 
   471         if (GameFlags and gfMoreWind) <> 0 then
   471            ((xland or land) = 0) and
       
   472            ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then
   472             Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   473             Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   473         end;
   474         end;
   474 
   475 
   475     Gear^.X := Gear^.X + Gear^.dX;
   476     Gear^.X := Gear^.X + Gear^.dX;
   476     Gear^.Y := Gear^.Y + Gear^.dY;
   477     Gear^.Y := Gear^.Y + Gear^.dY;
   480         Gear^.State := Gear^.State and (not gstMoving)
   481         Gear^.State := Gear^.State and (not gstMoving)
   481     else
   482     else
   482         Gear^.State := Gear^.State or gstMoving;
   483         Gear^.State := Gear^.State or gstMoving;
   483 
   484 
   484     if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
   485     if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
   485         begin
       
   486         Gear^.State := Gear^.State or gstCollision;
   486         Gear^.State := Gear^.State or gstCollision;
   487         AddFileLog('no more bounce for you!');
       
   488         end;
       
   489 
   487 
   490     if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and
   488     if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and
   491        ((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then
   489        ((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then
   492         begin
   490         begin
   493         AddBounceEffectForGear(Gear);
   491         AddBounceEffectForGear(Gear);