equal
deleted
inserted
replaced
342 begin |
342 begin |
343 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap |
343 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap |
344 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and |
344 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and |
345 ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.X) - Gear^.Radius) or |
345 ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.X) - Gear^.Radius) or |
346 (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.X) + Gear^.Radius)) then |
346 (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.X) + Gear^.Radius)) then |
347 Gear^.CollisionMask:= $FFFF; |
347 Gear^.CollisionMask:= lfAll; |
348 |
348 |
349 x:= hwRound(Gear^.X); |
349 x:= hwRound(Gear^.X); |
350 if Dir < 0 then |
350 if Dir < 0 then |
351 x:= x - Gear^.Radius |
351 x:= x - Gear^.Radius |
352 else |
352 else |
371 begin |
371 begin |
372 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap |
372 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap |
373 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and |
373 if (Gear^.CollisionMask = lfNotCurHogCrate) and (Gear^.Kind <> gtHedgehog) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and |
374 ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.Y) - Gear^.Radius) or |
374 ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 16 < hwRound(Gear^.Y) - Gear^.Radius) or |
375 (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.Y) + Gear^.Radius)) then |
375 (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 16 > hwRound(Gear^.Y) + Gear^.Radius)) then |
376 Gear^.CollisionMask:= $FFFF; |
376 Gear^.CollisionMask:= lfAll; |
377 |
377 |
378 y:= hwRound(Gear^.Y); |
378 y:= hwRound(Gear^.Y); |
379 if Dir < 0 then |
379 if Dir < 0 then |
380 y:= y - Gear^.Radius |
380 y:= y - Gear^.Radius |
381 else |
381 else |
415 repeat |
415 repeat |
416 if (y and LAND_HEIGHT_MASK) = 0 then |
416 if (y and LAND_HEIGHT_MASK) = 0 then |
417 begin |
417 begin |
418 if Land[y, x] and Gear^.CollisionMask <> 0 then |
418 if Land[y, x] and Gear^.CollisionMask <> 0 then |
419 begin |
419 begin |
420 if Land[y, x] and Gear^.CollisionMask > 255 then |
420 if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then |
421 exit(Land[y, x] and Gear^.CollisionMask) |
421 exit(Land[y, x] and Gear^.CollisionMask) |
422 else |
422 else |
423 pixel:= Land[y, x] and Gear^.CollisionMask; |
423 pixel:= Land[y, x] and Gear^.CollisionMask; |
424 end; |
424 end; |
425 end; |
425 end; |
481 i:= x + Gear^.Radius * 2 - 2; |
481 i:= x + Gear^.Radius * 2 - 2; |
482 repeat |
482 repeat |
483 if (x and LAND_WIDTH_MASK) = 0 then |
483 if (x and LAND_WIDTH_MASK) = 0 then |
484 if Land[y, x] > 0 then |
484 if Land[y, x] > 0 then |
485 begin |
485 begin |
486 if Land[y, x] and Gear^.CollisionMask > 255 then |
486 if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then |
487 exit(Land[y, x] and Gear^.CollisionMask) |
487 exit(Land[y, x] and Gear^.CollisionMask) |
488 else // if Land[y, x] <> 0 then |
488 else // if Land[y, x] <> 0 then |
489 pixel:= Land[y, x] and Gear^.CollisionMask; |
489 pixel:= Land[y, x] and Gear^.CollisionMask; |
490 end; |
490 end; |
491 inc(x) |
491 inc(x) |
556 begin |
556 begin |
557 y:= hwRound(Gear^.Y) - Gear^.Radius + 1; |
557 y:= hwRound(Gear^.Y) - Gear^.Radius + 1; |
558 i:= y + Gear^.Radius * 2 - 2; |
558 i:= y + Gear^.Radius * 2 - 2; |
559 repeat |
559 repeat |
560 if (y and LAND_HEIGHT_MASK) = 0 then |
560 if (y and LAND_HEIGHT_MASK) = 0 then |
561 if Land[y, x] and Gear^.CollisionMask > 255 then |
561 if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then |
562 exit(Land[y, x] and Gear^.CollisionMask); |
562 exit(Land[y, x] and Gear^.CollisionMask); |
563 inc(y) |
563 inc(y) |
564 until (y > i); |
564 until (y > i); |
565 end; |
565 end; |
566 TestCollisionX:= 0 |
566 TestCollisionX:= 0 |
579 begin |
579 begin |
580 x:= hwRound(Gear^.X) - Gear^.Radius + 1; |
580 x:= hwRound(Gear^.X) - Gear^.Radius + 1; |
581 i:= x + Gear^.Radius * 2 - 2; |
581 i:= x + Gear^.Radius * 2 - 2; |
582 repeat |
582 repeat |
583 if (x and LAND_WIDTH_MASK) = 0 then |
583 if (x and LAND_WIDTH_MASK) = 0 then |
584 if Land[y, x] and Gear^.CollisionMask > 255 then |
584 if ((Land[y, x] and Gear^.CollisionMask) and lfNotObjMask) <> 0 then |
585 exit(Land[y, x] and Gear^.CollisionMask); |
585 exit(Land[y, x] and Gear^.CollisionMask); |
586 inc(x) |
586 inc(x) |
587 until (x > i); |
587 until (x > i); |
588 end; |
588 end; |
589 TestCollisionY:= 0 |
589 TestCollisionY:= 0 |
895 begin |
895 begin |
896 x:= hwRound(Gear^.X) - Gear^.Radius + 1; |
896 x:= hwRound(Gear^.X) - Gear^.Radius + 1; |
897 i:= x + Gear^.Radius * 2 - 2; |
897 i:= x + Gear^.Radius * 2 - 2; |
898 repeat |
898 repeat |
899 if (x and LAND_WIDTH_MASK) = 0 then |
899 if (x and LAND_WIDTH_MASK) = 0 then |
900 if Land[y, x] > 255 then |
900 if (Land[y, x] and lfNotObjMask) <> 0 then |
901 if (not isColl) or (abs(x-gx) < abs(collX-gx)) then |
901 if (not isColl) or (abs(x-gx) < abs(collX-gx)) then |
902 begin |
902 begin |
903 isColl:= true; |
903 isColl:= true; |
904 collX := x; |
904 collX := x; |
905 end; |
905 end; |