hedgewars/GSHandlers.inc
changeset 2090 4edb0d49a42d
parent 2089 a08758aed76a
child 2139 5a083e71a71d
equal deleted inserted replaced
2089:a08758aed76a 2090:4edb0d49a42d
   562 	while i <= ei do
   562 	while i <= ei do
   563 		begin
   563 		begin
   564 		DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   564 		DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
   565 		inc(i, 1)
   565 		inc(i, 1)
   566 		end;
   566 		end;
   567 	Gear^.X:= Gear^.X + Gear^.dX;
   567     if Land[hwRound(Gear^.Y + _1_9) , hwRound(Gear^.X + Gear^.dX)] <> COLOR_INDESTRUCTIBLE then
   568 	Gear^.Y:= Gear^.Y + _1_9;
   568         begin
       
   569         Gear^.X:= Gear^.X + Gear^.dX;
       
   570         Gear^.Y:= Gear^.Y + _1_9;
       
   571         end;
   569 	SetAllHHToActive;
   572 	SetAllHHToActive;
   570 	end;
   573 	end;
   571 if TestCollisionYwithGear(Gear, 1) then
   574 if TestCollisionYwithGear(Gear, 1) then
   572 	begin
   575 	begin
   573 	Gear^.dY:= _0;
   576 	Gear^.dY:= _0;
   658 
   661 
   659 	if ((HHGear^.State and gstMoving) = 0) then
   662 	if ((HHGear^.State and gstMoving) = 0) then
   660 		begin
   663 		begin
   661 		HHGear^.State:= HHGear^.State and not gstAttacking;
   664 		HHGear^.State:= HHGear^.State and not gstAttacking;
   662 		prevX:= hwRound(HHGear^.X);
   665 		prevX:= hwRound(HHGear^.X);
       
   666 	
       
   667 // why the call to HedgehogStep then a further increment of X?	
       
   668 		if (prevX = hwRound(HHGear^.X)) and (Land[hwRound(HHGear^.Y) , hwRound(HHGear^.X + SignAs(_1, HHGear^.dX))] <> COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear);
   663 		
   669 		
   664 		HedgehogStep(HHGear);
   670 		if (prevX = hwRound(HHGear^.X)) and (Land[hwRound(HHGear^.Y) , hwRound(HHGear^.X + SignAs(_1, HHGear^.dX))] <> COLOR_INDESTRUCTIBLE) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX);
   665 		
       
   666 		if (prevX = hwRound(HHGear^.X)) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX);
       
   667 		HHGear^.State:= HHGear^.State or gstAttacking
   671 		HHGear^.State:= HHGear^.State or gstAttacking
   668 		end;
   672 		end;
   669 
   673 
   670 	inc(BTSteps);
   674 	inc(BTSteps);
   671 	if BTSteps = 7 then
   675 	if BTSteps = 7 then
   672 		begin
   676 		begin
   673 		BTSteps:= 0;
   677 		BTSteps:= 0;
       
   678         if Land[hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)) , hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC))] <> COLOR_INDESTRUCTIBLE then
       
   679             begin
   674 		Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
   680 		Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
   675 		Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
   681 		Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
       
   682             end;
   676 		HHGear^.State:= HHGear^.State or gstNoDamage;
   683 		HHGear^.State:= HHGear^.State or gstNoDamage;
   677 		AmmoShove(Gear, 2, 15);
   684 		AmmoShove(Gear, 2, 15);
   678 		HHGear^.State:= HHGear^.State and not gstNoDamage
   685 		HHGear^.State:= HHGear^.State and not gstNoDamage
   679 		end;
   686 		end;
   680 	end;
   687 	end;
   682 if b then
   689 if b then
   683    DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7,
   690    DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7,
   684               Gear^.dX, Gear^.dY,
   691               Gear^.dX, Gear^.dY,
   685               cHHRadius * 5, cHHRadius * 2 + 7);
   692               cHHRadius * 5, cHHRadius * 2 + 7);
   686 
   693 
   687 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
   694 if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then
   688 	begin
   695 	begin
   689 	HHGear^.Message:= 0;
   696 	HHGear^.Message:= 0;
   690 	HHGear^.State:= HHGear^.State and (not gstNotKickable);
   697 	HHGear^.State:= HHGear^.State and (not gstNotKickable);
   691 	DeleteGear(Gear);
   698 	DeleteGear(Gear);
   692 	AfterAttack
   699 	AfterAttack