hedgewars/GSHandlers.inc
changeset 1784 dfe9bafb4590
parent 1781 28f674367d68
child 1785 26c28fa8f56c
equal deleted inserted replaced
1783:169ebeefd7ab 1784:dfe9bafb4590
   614 if b then
   614 if b then
   615    DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7,
   615    DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7,
   616               Gear^.dX, Gear^.dY,
   616               Gear^.dX, Gear^.dY,
   617               cHHRadius * 5, cHHRadius * 2 + 7);
   617               cHHRadius * 5, cHHRadius * 2 + 7);
   618 
   618 
   619 if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then
   619 if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) or (Land[hwRound(HHGear^.Y), hwRound(HHGear^.X + Gear^.dX * 32)] = COLOR_INDESTRUCTIBLE) then
   620 	begin
   620 	begin
   621 	HHGear^.Message:= 0;
   621 	HHGear^.Message:= 0;
   622 	HHGear^.State:= HHGear^.State and (not gstNotKickable);
   622 	HHGear^.State:= HHGear^.State and (not gstNotKickable);
   623 	DeleteGear(Gear);
   623 	DeleteGear(Gear);
   624 	AfterAttack
   624 	AfterAttack
  1377 	begin
  1377 	begin
  1378 	Gear^.Tag:= -1;
  1378 	Gear^.Tag:= -1;
  1379 	Gear^.X:= int2hwFloat(LAND_WIDTH + 1024);
  1379 	Gear^.X:= int2hwFloat(LAND_WIDTH + 1024);
  1380 	end;
  1380 	end;
  1381 
  1381 
  1382 Gear^.Y:= -_300;  // TODO - consider making this proportional to topY to reduce spread on low maps
  1382 Gear^.Y:= int2hwFloat(topY-300);
  1383 Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
  1383 Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
  1384 
  1384 
  1385 if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then
  1385 if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then
  1386 	Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 / cGravity) * Gear^.Tag;
  1386 	Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 / cGravity) * Gear^.Tag;
  1387 
  1387 
  1928 
  1928 
  1929 t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug
  1929 t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug
  1930 if (Gear^.Timer = 0)
  1930 if (Gear^.Timer = 0)
  1931 or (t^.Count <> 0)
  1931 or (t^.Count <> 0)
  1932 or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  1932 or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
  1933 and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then
  1933 and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
       
  1934 or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] = COLOR_INDESTRUCTIBLE) then
  1934 	begin //out of time or exited ground
  1935 	begin //out of time or exited ground
  1935 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  1936 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  1936 	DeleteGear(Gear);
  1937 	DeleteGear(Gear);
  1937 	exit
  1938 	exit
  1938 	end;
  1939 	end;