hedgewars/uCollisions.pas
changeset 11077 1fb80cd8ba7b
parent 11046 47a8c19ecb60
child 11532 bf86c6cb9341
equal deleted inserted replaced
11074:722567479fab 11077:1fb80cd8ba7b
   209     begin
   209     begin
   210     y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
   210     y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
   211     i:= y + Gear^.Radius * 2 - 2;
   211     i:= y + Gear^.Radius * 2 - 2;
   212     repeat
   212     repeat
   213         if (y and LAND_HEIGHT_MASK) = 0 then
   213         if (y and LAND_HEIGHT_MASK) = 0 then
   214             if Land[y, x] and Gear^.CollisionMask > 255 then
   214             begin
   215                 exit(Land[y, x] and Gear^.CollisionMask)
   215             if Land[y, x] and Gear^.CollisionMask <> 0 then
   216             else if Land[y, x] and Gear^.CollisionMask <> 0 then
   216                 begin
   217                 pixel:= Land[y, x] and Gear^.CollisionMask;
   217                 if Land[y, x] and Gear^.CollisionMask > 255 then
       
   218                     exit(Land[y, x] and Gear^.CollisionMask)
       
   219                 else
       
   220                     pixel:= Land[y, x] and Gear^.CollisionMask;
       
   221                 end;
       
   222             end;
   218     inc(y)
   223     inc(y)
   219     until (y > i);
   224     until (y > i);
   220     end;
   225     end;
   221 TestCollisionXKick:= pixel;
   226 TestCollisionXKick:= pixel;
   222 
   227 
   272     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   277     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
   273     i:= x + Gear^.Radius * 2 - 2;
   278     i:= x + Gear^.Radius * 2 - 2;
   274     repeat
   279     repeat
   275     if (x and LAND_WIDTH_MASK) = 0 then
   280     if (x and LAND_WIDTH_MASK) = 0 then
   276         if Land[y, x] > 0 then
   281         if Land[y, x] > 0 then
       
   282             begin
   277             if Land[y, x] and Gear^.CollisionMask > 255 then
   283             if Land[y, x] and Gear^.CollisionMask > 255 then
   278                 exit(Land[y, x] and Gear^.CollisionMask)
   284                 exit(Land[y, x] and Gear^.CollisionMask)
   279             else if Land[y, x] <> 0 then
   285             else // if Land[y, x] <> 0 then
   280                 pixel:= Land[y, x] and Gear^.CollisionMask;
   286                 pixel:= Land[y, x] and Gear^.CollisionMask;
       
   287             end;
   281     inc(x)
   288     inc(x)
   282     until (x > i);
   289     until (x > i);
   283     end;
   290     end;
   284 TestCollisionYKick:= pixel;
   291 TestCollisionYKick:= pixel;
   285 
   292