hedgewars/GSHandlers.inc
changeset 4076 7ca17cb94992
parent 4050 8e4f4b72c132
child 4092 bf13068194b3
equal deleted inserted replaced
4075:f7412772f85d 4076:7ca17cb94992
  3469         poffs:= (Gear^.dX * ox + Gear^.dY * oy);
  3469         poffs:= (Gear^.dX * ox + Gear^.dY * oy);
  3470 
  3470 
  3471         if poffs < _0 then
  3471         if poffs < _0 then
  3472             continue;
  3472             continue;
  3473 
  3473 
  3474         // don't port stuff that isn't really close;
  3474         //
  3475         if not isbullet and (poffs > (r + _3)) then
  3475         // gears that make it till here will definately be ported
  3476             continue;
  3476         //
  3477 
  3477 
  3478         if isbullet then
  3478         if isbullet then
  3479             poffs:= _1_5;
  3479             poffs:= _1_5;
  3480 
  3480 
  3481         // create a normal of the portal vector, but ...
  3481         // create a normal of the portal vector, but ...
  3488             ny.isNegative := not ny.isNegative;
  3488             ny.isNegative := not ny.isNegative;
  3489 
  3489 
  3490         // calc gear offset in portal normal vector direction
  3490         // calc gear offset in portal normal vector direction
  3491         noffs:= (nx * ox + ny * oy);
  3491         noffs:= (nx * ox + ny * oy);
  3492 
  3492 
  3493         // don't port stuff that misses the portal entrance
       
  3494         if noffs > (r + _1_5) then
       
  3495             continue;
       
  3496 
       
  3497         // move stuff with high normal offset close to the portal's center
  3493         // move stuff with high normal offset close to the portal's center
  3498         if not isbullet then
  3494         if not isbullet then
  3499         begin
  3495         begin
  3500             s := hwAbs(noffs) + r - int2hwFloat(Gear^.Radius);
  3496             s := hwAbs(noffs) + r - int2hwFloat(Gear^.Radius);
  3501             if s > _0 then
  3497             if s > _0 then
  3502                 noffs:= noffs - SignAs(s,noffs)
  3498                 noffs:= noffs - SignAs(s,noffs)
  3503         end;
  3499         end;
  3504 
       
  3505         //
       
  3506         // gears that make it till here will definately be ported
       
  3507         //
       
  3508 
  3500 
  3509         iterator^.Active := true;
  3501         iterator^.Active := true;
  3510         iterator^.State := iterator^.State or gstMoving;
  3502         iterator^.State := iterator^.State or gstMoving;
  3511         DeleteCI(iterator);
  3503         DeleteCI(iterator);
  3512 
  3504