hedgewars/uGearsHandlersMess.pas
branchios-revival
changeset 11407 7ed8fa4a2b6a
parent 11391 bc9650ec9b20
child 11468 2f6f8baa2a97
equal deleted inserted replaced
11388:1ae8d4582e1e 11407:7ed8fa4a2b6a
   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);
  3537     oldX, oldY, oldDx, oldDy: hwFloat;
  3535     oldX, oldY, oldDx, oldDy: hwFloat;
  3538     t2: hwFloat;
  3536     t2: hwFloat;
  3539 begin
  3537 begin
  3540     AllInactive := false;
  3538     AllInactive := false;
  3541 
  3539 
  3542     if (Gear^.State and gsttmpFlag) = 0 then
  3540     if (Gear^.State and gsttmpFlag = 0) and (GameFlags and gfMoreWind = 0) then
  3543         Gear^.dX := Gear^.dX + cWindSpeed;
  3541         Gear^.dX := Gear^.dX + cWindSpeed;
  3544 
  3542 
  3545     oldDx := Gear^.dX;
  3543     oldDx := Gear^.dX;
  3546     oldDy := Gear^.dY;
  3544     oldDy := Gear^.dY;
  3547     oldX := Gear^.X;
  3545     oldX := Gear^.X;