hedgewars/HHHandlers.inc
changeset 2376 ece7b87f1334
parent 2302 0f122917d799
child 2428 6800f8aa0184
equal deleted inserted replaced
2375:99f05a01a6a3 2376:ece7b87f1334
    23 slot:= Gear^.MsgParam;
    23 slot:= Gear^.MsgParam;
    24 
    24 
    25 with PHedgehog(Gear^.Hedgehog)^ do
    25 with PHedgehog(Gear^.Hedgehog)^ do
    26 	begin
    26 	begin
    27 	Gear^.Message:= Gear^.Message and not gm_Slot;
    27 	Gear^.Message:= Gear^.Message and not gm_Slot;
    28 	
    28 
    29 	if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
    29 	if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
    30 		or (AttacksNum > 0)
    30 		or (AttacksNum > 0)
    31 		or ((Gear^.State and gstHHDriven) = 0) then exit;
    31 		or ((Gear^.State and gstHHDriven) = 0) then exit;
    32 
    32 
    33 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
    33 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
    49 		i:= 0;
    49 		i:= 0;
    50 		// check whether there is ammo in slot
    50 		// check whether there is ammo in slot
    51 		while (i <= cMaxSlotAmmoIndex)
    51 		while (i <= cMaxSlotAmmoIndex)
    52 		  and ((Ammo^[slot, i].Count = 0)
    52 		  and ((Ammo^[slot, i].Count = 0)
    53 		       or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
    53 		       or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
    54 		
    54 
    55 		if i <= cMaxSlotAmmoIndex then
    55 		if i <= cMaxSlotAmmoIndex then
    56 			begin
    56 			begin
    57 			CurSlot:= slot;
    57 			CurSlot:= slot;
    58 			CurAmmo:= i
    58 			CurAmmo:= i
    59 			end
    59 			end
   105 with Gear^,
   105 with Gear^,
   106      PHedgehog(Gear^.Hedgehog)^ do
   106      PHedgehog(Gear^.Hedgehog)^ do
   107      begin
   107      begin
   108      if ((State and gstHHDriven) <> 0)and
   108      if ((State and gstHHDriven) <> 0)and
   109         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   109         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
   110         (((State and gstMoving) = 0) or 
   110         (((State and gstMoving) = 0) or
   111             // Allow attacks while moving on ammo with AltAttack
   111             // Allow attacks while moving on ammo with AltAttack
   112             ((CurAmmoGear <> nil) and ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)) or 
   112             ((CurAmmoGear <> nil) and ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)) or
   113             ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0)) and
   113             ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0)) and
   114         ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
   114         ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
   115         begin
   115         begin
   116         State:= State or gstAttacking;
   116         State:= State or gstAttacking;
   117         if Power = cMaxPower then Message:= Message and not gm_Attack
   117         if Power = cMaxPower then Message:= Message and not gm_Attack
   632    HedgehogChAngle(Gear);
   632    HedgehogChAngle(Gear);
   633 
   633 
   634 if (Gear^.State and gstMoving) <> 0 then
   634 if (Gear^.State and gstMoving) <> 0 then
   635 	begin
   635 	begin
   636 	wasJumping:= ((Gear^.State and gstHHJumping) <> 0);
   636 	wasJumping:= ((Gear^.State and gstHHJumping) <> 0);
   637 	
   637 
   638 	if ((Gear^.Message and gm_HJump) <> 0) and
   638 	if ((Gear^.Message and gm_HJump) <> 0) and
   639 		wasJumping and
   639 		wasJumping and
   640 		((Gear^.State and gstHHHJump) = 0) then
   640 		((Gear^.State and gstHHHJump) = 0) then
   641 		if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   641 		if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   642 			begin
   642 			begin
   643 			Gear^.State:= Gear^.State or gstHHHJump;
   643 			Gear^.State:= Gear^.State or gstHHHJump;
   644 			Gear^.dY:= -_0_25;
   644 			Gear^.dY:= -_0_25;
   645 			if not cArtillery then Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   645 			if not cArtillery then Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   646 			PlaySound(sndJump2, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
   646 			PlaySound(sndJump2, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
   647 			end;
   647 			end;
   648 	
   648 
   649 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   649 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   650 
   650 
   651 	if (not cArtillery) and wasJumping and
   651 	if (not cArtillery) and wasJumping and
   652 		TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   652 		TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   653 
   653