hedgewars/uGearsHandlersMess.pas
changeset 13610 f1b6070a6e14
parent 13609 13f68f3e7153
child 13613 d6b79a080a3e
equal deleted inserted replaced
13609:13f68f3e7153 13610:f1b6070a6e14
   323     land, xland: word;
   323     land, xland: word;
   324 begin
   324 begin
   325     tX:= Gear^.X;
   325     tX:= Gear^.X;
   326     gX:= hwRound(Gear^.X);
   326     gX:= hwRound(Gear^.X);
   327     gY:= hwRound(Gear^.Y);
   327     gY:= hwRound(Gear^.Y);
   328     if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.AdvBounce <> 0) and
   328     Gear^.State := Gear^.State and (not gstCollision);
       
   329 
       
   330     // World wrap
       
   331     if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and
   329       ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
   332       ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
   330         begin
   333         begin
   331         Gear^.X:= tX;
   334         // Collision with land that *just* behind the other side of the world wrap edge
   332         Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2)
   335         if (not Gear^.Sticky) then
       
   336             begin
       
   337             Gear^.X:= tX;
       
   338             Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2);
       
   339             Gear^.dX := Gear^.dX * Gear^.Friction;
       
   340             end;
       
   341         Gear^.State := Gear^.State or gstCollision;
   333         end;
   342         end;
   334 
   343 
   335     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
   344     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
   336     if Gear^.dX.Round > 1 then
   345     if Gear^.dX.Round > 1 then
   337         Gear^.dX.QWordValue:= 8589934592;
   346         Gear^.dX.QWordValue:= 8589934592;
   342         begin
   351         begin
   343         Gear^.dX:= Gear^.dX * _0_999;
   352         Gear^.dX:= Gear^.dX * _0_999;
   344         Gear^.dY:= Gear^.dY * _0_999
   353         Gear^.dY:= Gear^.dY * _0_999
   345         end;
   354         end;
   346 
   355 
   347     Gear^.State := Gear^.State and (not gstCollision);
       
   348     collV := 0;
   356     collV := 0;
   349     collH := 0;
   357     collH := 0;
   350     tdX := Gear^.dX;
   358     tdX := Gear^.dX;
   351     tdY := Gear^.dY;
   359     tdY := Gear^.dY;
   352 
   360