hedgewars/GSHandlers.inc
changeset 4038 8972dd38bbad
parent 4036 69e535a0e43a
child 4044 de7170e51cc6
equal deleted inserted replaced
4037:0f8ec120e90d 4038:8972dd38bbad
  3411            or (iterator^.Y > Gear^.Y + acptRadius) then
  3411            or (iterator^.Y > Gear^.Y + acptRadius) then
  3412             continue;
  3412             continue;
  3413 
  3413 
  3414         hasdxy := ((iterator^.dX.QWordValue <> 0) or (iterator^.dY.QWordValue <> 0));
  3414         hasdxy := ((iterator^.dX.QWordValue <> 0) or (iterator^.dY.QWordValue <> 0));
  3415 
  3415 
       
  3416         // in case the object is not moving, let's asume it's moving towards the portal
       
  3417         if not hasdxy then
       
  3418         begin
       
  3419             ox:= Gear^.X - iterator^.X;
       
  3420             oy:= Gear^.Y - iterator^.Y;
       
  3421         end
       
  3422         else
       
  3423         begin
       
  3424             ox:= iterator^.dX;
       
  3425             oy:= iterator^.dY;
       
  3426         end;
       
  3427 
  3416         // won't port stuff that moves away from me!
  3428         // won't port stuff that moves away from me!
  3417         if hasdxy and not (Gear^.dX*iterator^.dX + Gear^.dY*iterator^.dY).isNegative then
  3429         if not (Gear^.dX*ox + Gear^.dY*oy).isNegative then
  3418                 continue;
  3430                 continue;
  3419 
  3431 
  3420         if (iterator^.Kind <> gtCake) then
  3432         if (iterator^.Kind <> gtCake) then
  3421         begin
  3433         begin
  3422             // wow! good candidate there, let's see if the distance and direction is okay!
  3434             // wow! good candidate there, let's see if the distance and direction is okay!