hedgewars/uCollisions.pas
changeset 7374 514138949c76
parent 7305 b242e91a92a9
child 7489 43a998fbacfe
equal deleted inserted replaced
7304:8b3575750cd2 7374:514138949c76
   134                 end
   134                 end
   135 end;
   135 end;
   136 
   136 
   137 function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
   137 function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
   138 var x, y, i: LongInt;
   138 var x, y, i: LongInt;
   139     TestWord: LongWord;
       
   140 begin
   139 begin
   141 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
   140 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
   142 if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
   141 if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
   143     ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.X) - Gear^.Radius) or
   142     ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.X) - Gear^.Radius) or
   144      (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.X) + Gear^.Radius)) then
   143      (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.X) + Gear^.Radius)) then
   165 TestCollisionXwithGear:= false
   164 TestCollisionXwithGear:= false
   166 end;
   165 end;
   167 
   166 
   168 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word;
   167 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word;
   169 var x, y, i: LongInt;
   168 var x, y, i: LongInt;
   170     TestWord: LongWord;
       
   171 begin
   169 begin
   172 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
   170 // Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
   173 if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
   171 if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
   174     ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.Y) - Gear^.Radius) or
   172     ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.Y) - Gear^.Radius) or
   175      (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.Y) + Gear^.Radius)) then
   173      (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.Y) + Gear^.Radius)) then