hedgewars/uGearsHandlersRope.pas
changeset 8751 4609823efc94
parent 8744 6c87486fd89b
child 9080 9b42757d7e71
equal deleted inserted replaced
8749:1b9f026e9fc6 8751:4609823efc94
   200 
   200 
   201     while len > _3 do
   201     while len > _3 do
   202         begin
   202         begin
   203         lx := hwRound(nx);
   203         lx := hwRound(nx);
   204         ly := hwRound(ny);
   204         ly := hwRound(ny);
   205         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and ((Land[ly, lx] and $FF00) <> 0) then
   205         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] > lfAllObjMask) then
   206             begin
   206             begin
   207             tx := _1 / Distance(ropeDx, ropeDy);
   207             tx := _1 / Distance(ropeDx, ropeDy);
   208             // old rope pos
   208             // old rope pos
   209             nx := ropeDx * tx;
   209             nx := ropeDx * tx;
   210             ny := ropeDy * tx;
   210             ny := ropeDy * tx;
   423         tt := Gear^.Elasticity;
   423         tt := Gear^.Elasticity;
   424         tx := _0;
   424         tx := _0;
   425         ty := _0;
   425         ty := _0;
   426         while tt > _20 do
   426         while tt > _20 do
   427             begin
   427             begin
   428             if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] and $FF00) <> 0) then
   428             if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and (Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] > lfAllObjMask) then
   429                 begin
   429                 begin
   430                 Gear^.X := Gear^.X + tx;
   430                 Gear^.X := Gear^.X + tx;
   431                 Gear^.Y := Gear^.Y + ty;
   431                 Gear^.Y := Gear^.Y + ty;
   432                 Gear^.Elasticity := tt;
   432                 Gear^.Elasticity := tt;
   433                 Gear^.doStep := @doStepRopeWork;
   433                 Gear^.doStep := @doStepRopeWork;
   447             ty := ty + Gear^.dY + Gear^.dY;
   447             ty := ty + Gear^.dY + Gear^.dY;
   448             tt := tt - _2;
   448             tt := tt - _2;
   449             end;
   449             end;
   450         end;
   450         end;
   451 
   451 
   452     if Gear^.Elasticity < _20 then Gear^.CollisionMask:= $FF00
   452     if Gear^.Elasticity < _20 then Gear^.CollisionMask:= lfLandMask
   453     else Gear^.CollisionMask:= lfCurrentMask;
   453     else Gear^.CollisionMask:= lfNotCurrentMask;
   454     CheckCollision(Gear);
   454     CheckCollision(Gear);
   455 
   455 
   456     if (Gear^.State and gstCollision) <> 0 then
   456     if (Gear^.State and gstCollision) <> 0 then
   457         if Gear^.Elasticity < _10 then
   457         if Gear^.Elasticity < _10 then
   458             Gear^.Elasticity := _10000
   458             Gear^.Elasticity := _10000