hedgewars/uCollisions.pas
changeset 7767 d1ea9b3f543e
parent 7756 b89bd0ffb8aa
child 8744 6c87486fd89b
equal deleted inserted replaced
7766:98edc0724a28 7767:d1ea9b3f543e
   247                     with cGear^ do
   247                     with cGear^ do
   248                         begin
   248                         begin
   249                         dX:= Gear^.dX;
   249                         dX:= Gear^.dX;
   250                         dY:= Gear^.dY * _0_5;
   250                         dY:= Gear^.dY * _0_5;
   251                         State:= State or gstMoving;
   251                         State:= State or gstMoving;
   252                         if Kind = gtKnife then State:= State and not gstCollision;
   252                         if Kind = gtKnife then State:= State and (not gstCollision);
   253                         Active:= true
   253                         Active:= true
   254                         end;
   254                         end;
   255                     DeleteCI(cGear);
   255                     DeleteCI(cGear);
   256                     TestCollisionXKick:= false;
   256                     TestCollisionXKick:= false;
   257                     exit;
   257                     exit;
   310                         begin
   310                         begin
   311                         if (Kind <> gtExplosives) or ((State and gsttmpflag) <> 0) then
   311                         if (Kind <> gtExplosives) or ((State and gsttmpflag) <> 0) then
   312                             dX:= Gear^.dX * _0_5;
   312                             dX:= Gear^.dX * _0_5;
   313                         dY:= Gear^.dY;
   313                         dY:= Gear^.dY;
   314                         State:= State or gstMoving;
   314                         State:= State or gstMoving;
   315                         if Kind = gtKnife then State:= State and not gstCollision;
   315                         if Kind = gtKnife then State:= State and (not gstCollision);
   316                         Active:= true
   316                         Active:= true
   317                         end;
   317                         end;
   318                     DeleteCI(cGear);
   318                     DeleteCI(cGear);
   319                     TestCollisionYKick:= false;
   319                     TestCollisionYKick:= false;
   320                     exit
   320                     exit
   601         x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   601         x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   602         i:= x + Gear^.Radius * 2 - 2;
   602         i:= x + Gear^.Radius * 2 - 2;
   603         repeat
   603         repeat
   604         if (x and LAND_WIDTH_MASK) = 0 then
   604         if (x and LAND_WIDTH_MASK) = 0 then
   605             if Land[y, x] <> 0 then
   605             if Land[y, x] <> 0 then
   606                 if not isColl or (abs(x-gx) < abs(collX-gx)) then
   606                 if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
   607                     begin
   607                     begin
   608                     isColl:= true;
   608                     isColl:= true;
   609                     collX := x;
   609                     collX := x;
   610                     end;
   610                     end;
   611         inc(x)
   611         inc(x)
   624         y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
   624         y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
   625         i:= y + Gear^.Radius * 2 - 2;
   625         i:= y + Gear^.Radius * 2 - 2;
   626         repeat
   626         repeat
   627         if (y and LAND_HEIGHT_MASK) = 0 then
   627         if (y and LAND_HEIGHT_MASK) = 0 then
   628             if Land[y, x] <> 0 then
   628             if Land[y, x] <> 0 then
   629                 if not isColl or (abs(y-gy) < abs(collY-gy)) then
   629                 if (not isColl) or (abs(y-gy) < abs(collY-gy)) then
   630                     begin
   630                     begin
   631                     isColl:= true;
   631                     isColl:= true;
   632                     collY := y;
   632                     collY := y;
   633                     end;
   633                     end;
   634         inc(y)
   634         inc(y)
   693     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   693     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   694     i:= x + Gear^.Radius * 2 - 2;
   694     i:= x + Gear^.Radius * 2 - 2;
   695     repeat
   695     repeat
   696     if (x and LAND_WIDTH_MASK) = 0 then
   696     if (x and LAND_WIDTH_MASK) = 0 then
   697         if Land[y, x] > 255 then
   697         if Land[y, x] > 255 then
   698             if not isColl or (abs(x-gx) < abs(collX-gx)) then
   698             if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
   699                 begin
   699                 begin
   700                 isColl:= true;
   700                 isColl:= true;
   701                 collX := x;
   701                 collX := x;
   702                 end;
   702                 end;
   703     inc(x)
   703     inc(x)