hedgewars/uGearsHandlersMess.pas
changeset 9505 56e0cca99e20
parent 9487 fbe203c1d11e
child 9521 8054d9d775fd
child 9526 2fd51591b260
equal deleted inserted replaced
9503:8f9b04138456 9505:56e0cca99e20
  2397 
  2397 
  2398 procedure doStepGirder(Gear: PGear);
  2398 procedure doStepGirder(Gear: PGear);
  2399 var
  2399 var
  2400     HHGear: PGear;
  2400     HHGear: PGear;
  2401     x, y, tx, ty: hwFloat;
  2401     x, y, tx, ty: hwFloat;
       
  2402     rx: LongInt;
  2402 begin
  2403 begin
  2403     AllInactive := false;
  2404     AllInactive := false;
  2404 
  2405 
  2405     HHGear := Gear^.Hedgehog^.Gear;
  2406     HHGear := Gear^.Hedgehog^.Gear;
  2406     tx := int2hwFloat(Gear^.Target.X);
  2407     tx := int2hwFloat(Gear^.Target.X);
  2407     ty := int2hwFloat(Gear^.Target.Y);
  2408     ty := int2hwFloat(Gear^.Target.Y);
  2408     x := HHGear^.X;
  2409     x := HHGear^.X;
  2409     y := HHGear^.Y;
  2410     y := HHGear^.Y;
  2410 
  2411     rx:= hwRound(x);
  2411     if (Distance(tx - x, ty - y) > _256)
  2412 
       
  2413     if ((Distance(tx - x, ty - y) > _256) and ((WorldEdge <> weWrap) or 
       
  2414             (
       
  2415             (Distance(tx - int2hwFloat(rightX+(rx-leftX)), ty - y) > _256) and
       
  2416             (Distance(tx - int2hwFloat(leftX-(rightX-rx)), ty - y) > _256)
       
  2417             )))
  2412     or (not TryPlaceOnLand(Gear^.Target.X - SpritesData[sprAmGirder].Width div 2, Gear^.Target.Y - SpritesData[sprAmGirder].Height div 2, sprAmGirder, Gear^.State, true, false)) then
  2418     or (not TryPlaceOnLand(Gear^.Target.X - SpritesData[sprAmGirder].Width div 2, Gear^.Target.Y - SpritesData[sprAmGirder].Height div 2, sprAmGirder, Gear^.State, true, false)) then
  2413         begin
  2419         begin
  2414         PlaySound(sndDenied);
  2420         PlaySound(sndDenied);
  2415         HHGear^.Message := HHGear^.Message and (not gmAttack);
  2421         HHGear^.Message := HHGear^.Message and (not gmAttack);
  2416         HHGear^.State := HHGear^.State and (not gstAttacking);
  2422         HHGear^.State := HHGear^.State and (not gstAttacking);