hedgewars/GSHandlers.inc
changeset 1200 b92323ccce45
parent 1158 d03d12ef8971
child 1206 d852883fcefe
equal deleted inserted replaced
1199:543d1268847b 1200:b92323ccce45
   424 begin
   424 begin
   425 AllInactive:= false;
   425 AllInactive:= false;
   426 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
   426 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
   427 dec(Gear^.Timer);
   427 dec(Gear^.Timer);
   428 if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then
   428 if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then
   429    begin
   429 	begin
   430    StopSound(sndPickhammer);
   430 	StopSound(sndPickhammer);
   431    DeleteGear(Gear);
   431 	DeleteGear(Gear);
   432    AfterAttack;
   432 	AfterAttack;
   433    exit
   433 	exit
   434    end;
   434 	end;
   435 
   435 
   436 if (Gear^.Timer mod 33) = 0 then
   436 if (Gear^.Timer mod 33) = 0 then
   437    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 6, 6, EXPLDontDraw);
   437 	begin
       
   438 	HHGear^.State:= HHGear^.State or gstNoDamage;
       
   439 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw);
       
   440 	HHGear^.State:= HHGear^.State and not gstNoDamage
       
   441 	end;
   438 
   442 
   439 if (Gear^.Timer mod 47) = 0 then
   443 if (Gear^.Timer mod 47) = 0 then
   440    begin
   444 	begin
   441    i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
   445 	i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
   442    ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
   446 	ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
   443    while i <= ei do
   447 	while i <= ei do
   444          begin
   448 		begin
   445          DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   449 		DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   446          inc(i, 1)
   450 		inc(i, 1)
   447          end;
   451 		end;
   448    Gear^.X:= Gear^.X + Gear^.dX;
   452 	Gear^.X:= Gear^.X + Gear^.dX;
   449    Gear^.Y:= Gear^.Y + _1_9;
   453 	Gear^.Y:= Gear^.Y + _1_9;
   450    SetAllHHToActive;
   454 	SetAllHHToActive;
   451    end;
   455 	end;
   452 if TestCollisionYwithGear(Gear, 1) then
   456 if TestCollisionYwithGear(Gear, 1) then
   453    begin
   457 	begin
   454    Gear^.dY:= _0;
   458 	Gear^.dY:= _0;
   455    SetLittle(HHGear^.dX);
   459 	SetLittle(HHGear^.dX);
   456    HHGear^.dY:= _0;
   460 	HHGear^.dY:= _0;
   457    end else
   461 	end else
   458    begin
   462 	begin
   459    Gear^.dY:= Gear^.dY + cGravity;
   463 	Gear^.dY:= Gear^.dY + cGravity;
   460    Gear^.Y:= Gear^.Y + Gear^.dY;
   464 	Gear^.Y:= Gear^.Y + Gear^.dY;
   461    if Gear^.Y > _1024 then Gear^.Timer:= 1
   465 	if Gear^.Y > _1024 then Gear^.Timer:= 1
   462    end;
   466 	end;
   463 
   467 
   464 Gear^.X:= Gear^.X + HHGear^.dX;
   468 Gear^.X:= Gear^.X + HHGear^.dX;
   465 HHGear^.X:= Gear^.X;
   469 HHGear^.X:= Gear^.X;
   466 HHGear^.Y:= Gear^.Y - int2hwFloat(cHHRadius);
   470 HHGear^.Y:= Gear^.Y - int2hwFloat(cHHRadius);
   467 
   471 
  1433 	HHGear^.X:= Gear^.X;
  1437 	HHGear^.X:= Gear^.X;
  1434 	HHGear^.Y:= Gear^.Y;
  1438 	HHGear^.Y:= Gear^.Y;
  1435 
  1439 
  1436 	inc(Gear^.Damage, 2);
  1440 	inc(Gear^.Damage, 2);
  1437 
  1441 
  1438 	if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX))
  1442 //	if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX))
  1439 		or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3);
  1443 //		or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3);
  1440 
  1444 
  1441 	dec(i)
  1445 	dec(i)
  1442 until (i = 0) or (Gear^.Damage > Gear^.Health);
  1446 until (i = 0) or (Gear^.Damage > Gear^.Health);
  1443 
  1447 
  1444 inc(upd);
  1448 inc(upd);
  1447 	if Gear^.Health < 1500 then Gear^.Pos:= 2;
  1451 	if Gear^.Health < 1500 then Gear^.Pos:= 2;
  1448 	
  1452 	
  1449 	AmmoShove(Gear, 30, 40);
  1453 	AmmoShove(Gear, 30, 40);
  1450 	
  1454 	
  1451 	DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  1455 	DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  1452 			HHGear^.Y - _3 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 5,
  1456 			HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
  1453 			HHGear^.dX,
  1457 			HHGear^.dX,
  1454 			HHGear^.dY,
  1458 			HHGear^.dY,
  1455 			20 + cHHRadius * 2,
  1459 			20 + cHHRadius * 2,
  1456 			cHHRadius * 2 + 4);
  1460 			cHHRadius * 2 + 6);
  1457 	
  1461 	
  1458 	upd:= 0
  1462 	upd:= 0
  1459 	end;
  1463 	end;
  1460 
  1464 
  1461 if Gear^.Health < Gear^.Damage then
  1465 if Gear^.Health < Gear^.Damage then