hedgewars/GSHandlers.inc
changeset 3398 ede254e24545
parent 3397 c47af0694a7d
child 3399 885304636abf
equal deleted inserted replaced
3397:c47af0694a7d 3398:ede254e24545
  3039 end;
  3039 end;
  3040 
  3040 
  3041 procedure doStepPortal(Gear: PGear);
  3041 procedure doStepPortal(Gear: PGear);
  3042 var tmpGear, iterator: PGear;
  3042 var tmpGear, iterator: PGear;
  3043 begin
  3043 begin
  3044 AddFileLog('...');
  3044     //if not AllInactive and (Gear^.IntersectGear <> nil) then
  3045     if not AllInactive and (Gear^.IntersectGear <> nil) then
  3045     if (Gear^.IntersectGear <> nil) then
  3046         begin
  3046         begin
  3047 AddFileLog('!!!');
       
  3048         iterator:= GearsList;
  3047         iterator:= GearsList;
  3049         while iterator <> nil do
  3048         while iterator <> nil do
  3050             begin
  3049             begin
  3051             if
  3050             if iterator^.Active and (iterator^.Kind <> gtPortal) and 
  3052 // iterator^.Active and 
  3051                (hwRound(hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)) < Gear^.Radius) and 
  3053 (iterator^.Kind <> gtPortal) and 
  3052                ((hwAbs(Gear^.X-(iterator^.X+iterator^.dX))+hwAbs(Gear^.Y-(iterator^.Y+iterator^.dY))).QWordValue < (hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)).QWordValue) and
  3054               // (hwRound(hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)) < Gear^.Radius) and 
       
  3055               // ((hwAbs(Gear^.X-(iterator^.X+iterator^.dX))+hwAbs(Gear^.Y-(iterator^.Y+iterator^.dY))).QWordValue < (hwAbs(Gear^.X-iterator^.X)+hwAbs(Gear^.Y-iterator^.Y)).QWordValue) and
       
  3056                (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < Gear^.Radius) then // Let's check this one more closely
  3053                (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < Gear^.Radius) then // Let's check this one more closely
  3057                 begin
  3054                 begin
  3058 AddFileLog(inttostr(iterator^.uid));
       
  3059                 iterator^.X:=Gear^.IntersectGear^.X+_128;
  3055                 iterator^.X:=Gear^.IntersectGear^.X+_128;
  3060                 iterator^.Y:=Gear^.IntersectGear^.Y+_128;
  3056                 iterator^.Y:=Gear^.IntersectGear^.Y+_128;
  3061                 iterator^.dX.isNegative:= not iterator^.dX.isNegative;
  3057                 iterator^.dX.isNegative:= not iterator^.dX.isNegative;
  3062                 end;
  3058                 end;
  3063 
  3059