3050 //if (Gear^.IntersectGear <> nil) then |
3050 //if (Gear^.IntersectGear <> nil) then |
3051 begin |
3051 begin |
3052 iterator:= GearsList; |
3052 iterator:= GearsList; |
3053 while iterator <> nil do |
3053 while iterator <> nil do |
3054 begin |
3054 begin |
3055 if (iterator^.Kind <> gtPortal) then |
3055 if (iterator^.Kind <> gtPortal) and (iterator^.PortedCounter < 20) then |
3056 if (((iterator^.State and gstMoving) <> 0) or (Gear^.IntersectGear^.dY.isNegative and not Gear^.dY.isNegative)) |
3056 if (((iterator^.State and gstMoving) <> 0) or (Gear^.IntersectGear^.dY.isNegative and not Gear^.dY.isNegative)) |
3057 and (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < iterator^.Radius+Gear^.Radius) then // Let's check this one more closely |
3057 and (hwRound(Distance(Gear^.X-iterator^.X,Gear^.Y-iterator^.Y)) < iterator^.Radius+Gear^.Radius) then // Let's check this one more closely |
3058 if (Gear^.dX*iterator^.dX + Gear^.dY*iterator^.dY).isNegative then // make sure object moves towards the portal |
3058 if (Gear^.dX*iterator^.dX + Gear^.dY*iterator^.dY).isNegative then // make sure object moves towards the portal |
3059 begin |
3059 begin |
|
3060 inc(iterator^.PortedCounter); |
3060 s:= (_1+(Int2hwFloat(Gear^.Radius))) / Distance(Gear^.IntersectGear^.dX, Gear^.IntersectGear^.dY); |
3061 s:= (_1+(Int2hwFloat(Gear^.Radius))) / Distance(Gear^.IntersectGear^.dX, Gear^.IntersectGear^.dY); |
3061 iterator^.X:= Gear^.IntersectGear^.X + s * Gear^.IntersectGear^.dX; |
3062 iterator^.X:= Gear^.IntersectGear^.X + s * Gear^.IntersectGear^.dX; |
3062 iterator^.Y:= Gear^.IntersectGear^.Y + s * Gear^.IntersectGear^.dY; |
3063 iterator^.Y:= Gear^.IntersectGear^.Y + s * Gear^.IntersectGear^.dY; |
3063 s:= Distance(iterator^.dX, iterator^.dY) / Distance(Gear^.IntersectGear^.dX, Gear^.IntersectGear^.dY); |
3064 s:= Distance(iterator^.dX, iterator^.dY) / Distance(Gear^.IntersectGear^.dX, Gear^.IntersectGear^.dY); |
3064 iterator^.dX:= s * Gear^.IntersectGear^.dX; |
3065 iterator^.dX:= s * Gear^.IntersectGear^.dX; |