hedgewars/HHHandlers.inc
changeset 149 aae256899c49
parent 113 d975a426ebf7
child 183 57c2ef19f719
equal deleted inserted replaced
148:c0355acf07c8 149:aae256899c49
   319             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -1, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.96; Gear.Y:= Gear.Y - 1 end else
   319             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -1, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.96; Gear.Y:= Gear.Y - 1 end else
   320             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -2, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.93; Gear.Y:= Gear.Y - 2 end else
   320             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -2, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.93; Gear.Y:= Gear.Y - 2 end else
   321             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -3, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 3 end else
   321             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -3, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 3 end else
   322             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -4, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.87; Gear.Y:= Gear.Y - 4 end else
   322             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -4, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.87; Gear.Y:= Gear.Y - 4 end else
   323             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -5, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 5 end else
   323             if not TestCollisionXwithXYShift(Gear, hwSign(Gear.dX) - Gear.dX, -5, hwSign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 5 end else
   324             if abs(Gear.dX) > 0.02 then Gear.dX:= -0.2 * Gear.dX
   324             if abs(Gear.dX) > 0.02 then Gear.dX:= -Gear.Elasticity * Gear.dX
   325                                    else begin
   325                                    else begin
   326                                         Gear.State:= Gear.State and not gstMoving;
   326                                         Gear.State:= Gear.State and not gstMoving;
   327                                         Gear.dX:= 0.0000001 * hwSign(Gear.dX)
   327                                         Gear.dX:= 0.0000001 * hwSign(Gear.dX)
   328                                         end
   328                                         end
   329                                    else begin
   329             else begin
   330                                         Gear.State:= Gear.State and not gstMoving;
   330                  Gear.State:= Gear.State and not gstMoving;
   331                                         Gear.dX:= 0.0000001 * hwSign(Gear.dX)
   331                  Gear.dX:= 0.0000001 * hwSign(Gear.dX)
   332                                         end
   332                  end
   333          else Gear.dX:= -Gear.dX;
   333          else Gear.dX:= -Gear.Elasticity * Gear.dX;
   334 
   334 
   335 if ((Gear.State and gstFalling) = 0)and
   335 if ((Gear.State and gstFalling) = 0)and
   336    (sqr(Gear.dX) + sqr(Gear.dY) < 0.0008) then
   336    (sqr(Gear.dX) + sqr(Gear.dY) < 0.0008) then
   337    begin
   337    begin
   338    Gear.State:= Gear.State and not gstMoving;
   338    Gear.State:= Gear.State and not gstMoving;