hedgewars/uGearsHandlersMess.pas
changeset 9809 1e32628eb167
parent 9769 5814e0c47c99
child 9811 66a7959869f0
equal deleted inserted replaced
9808:37891ba5e10b 9809:1e32628eb167
   290     gY:= hwRound(Gear^.Y);
   290     gY:= hwRound(Gear^.Y);
   291     if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.AdvBounce <> 0) and
   291     if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.AdvBounce <> 0) and
   292       ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
   292       ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0))  then
   293         begin
   293         begin
   294         Gear^.X:= tX;
   294         Gear^.X:= tX;
   295         Gear^.dX.isNegative:= (gX > leftX+Gear^.Radius*2)
   295         Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2)
   296         end;
   296         end;
   297 
   297 
   298     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
   298     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
   299     if Gear^.dX.Round > 2 then
   299     if Gear^.dX.Round > 2 then
   300         Gear^.dX.QWordValue:= 8589934592;
   300         Gear^.dX.QWordValue:= 8589934592;
   756     CheckCollision(Gear);
   756     CheckCollision(Gear);
   757     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then
   757     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then
   758         draw:= true;
   758         draw:= true;
   759     xx:= hwRound(Gear^.X);
   759     xx:= hwRound(Gear^.X);
   760     yy:= hwRound(Gear^.Y);
   760     yy:= hwRound(Gear^.Y);
   761     if draw and (WorldEdge = weWrap) and ((xx < leftX+3) or (xx > rightX-3)) then
   761     if draw and (WorldEdge = weWrap) and ((xx < LongInt(leftX) + 3) or (xx > LongInt(rightX) - 3)) then
   762         begin
   762         begin
   763         if xx < leftX+3 then 
   763         if xx < LongInt(leftX) + 3 then 
   764              xx:= rightX-3
   764              xx:= rightX-3
   765         else xx:= leftX+3;
   765         else xx:= leftX+3;
   766         Gear^.X:= int2hwFloat(xx)
   766         Gear^.X:= int2hwFloat(xx)
   767         end
   767         end
   768     end
   768     end
  2228                     for i:= Random(2) downto 0 do
  2228                     for i:= Random(2) downto 0 do
  2229                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2229                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2230 
  2230 
  2231                 if Gear^.Health > 0 then
  2231                 if Gear^.Health > 0 then
  2232                     dec(Gear^.Health);
  2232                     dec(Gear^.Health);
  2233                 Gear^.Timer := 450 - Gear^.Tag * 8 + GetRandom(2)
  2233                 Gear^.Timer := 450 - Gear^.Tag * 8 + LongInt(GetRandom(2))
  2234                 end
  2234                 end
  2235             else
  2235             else
  2236                 begin
  2236                 begin
  2237                 // Modified fire
  2237                 // Modified fire
  2238                 if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
  2238                 if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
  2242                     for i:= Random(3) downto 0 do
  2242                     for i:= Random(3) downto 0 do
  2243                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2243                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2244                     end;
  2244                     end;
  2245 
  2245 
  2246 // This one is interesting.  I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
  2246 // This one is interesting.  I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
  2247                 Gear^.Timer := 100 - Gear^.Tag * 3 + GetRandom(2);
  2247                 Gear^.Timer := 100 - Gear^.Tag * 3 + LongInt(GetRandom(2));
  2248                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then
  2248                 if (Gear^.Damage > 3000+Gear^.Tag*1500) then
  2249                     Gear^.Health := 0
  2249                     Gear^.Health := 0
  2250                 end
  2250                 end
  2251             end
  2251             end
  2252         end;
  2252         end;