hedgewars/HHHandlers.inc
changeset 836 150c7c87e66c
parent 835 6f567934cc44
child 838 1faae19f2116
equal deleted inserted replaced
835:6f567934cc44 836:150c7c87e66c
    72 with Gear^,
    72 with Gear^,
    73      PHedgehog(Gear^.Hedgehog)^ do
    73      PHedgehog(Gear^.Hedgehog)^ do
    74      begin
    74      begin
    75      if ((State and gstHHDriven) <> 0)and
    75      if ((State and gstHHDriven) <> 0)and
    76         ((State and (gstAttacked or gstHHChooseTarget)) = 0)and
    76         ((State and (gstAttacked or gstHHChooseTarget)) = 0)and
    77         (((State and gstMoving) = 0)or((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0))and
    77         (((State and gstMoving) = 0) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0))and
    78           ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
    78         ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then
    79         begin
    79         begin
    80         State:= State or gstAttacking;
    80         State:= State or gstAttacking;
    81         if Power = cMaxPower then Message:= Message and not gm_Attack
    81         if Power = cMaxPower then Message:= Message and not gm_Attack
    82         else if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack
    82         else if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack
    83         else begin
    83         else begin
   168 Gear^.Message:= gm_Destroy;
   168 Gear^.Message:= gm_Destroy;
   169 case Gear^.Pos of
   169 case Gear^.Pos of
   170        posCaseAmmo: begin
   170        posCaseAmmo: begin
   171                     a:= TAmmoType(Gear^.State);
   171                     a:= TAmmoType(Gear^.State);
   172                     AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
   172                     AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
   173                     s:= trammo[Ammoz[a].NameId] + '(+' + IntToStr(Ammoz[a].NumberInCase) + ')';
   173                     if not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven
   174                     AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
   174                       or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0)) then
       
   175                        begin
       
   176                        s:= trammo[Ammoz[a].NameId] + '(+' + IntToStr(Ammoz[a].NumberInCase) + ')';
       
   177                        AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
       
   178                        end
   175                     end;
   179                     end;
   176      posCaseHealth: begin
   180      posCaseHealth: begin
   177                     inc(HH^.Health, Gear^.Health);
   181                     inc(HH^.Health, Gear^.Health);
   178                     str(Gear^.Health, s);
   182                     str(Gear^.Health, s);
   179                     s:= '+' + s;
   183                     s:= '+' + s;
   405    if Gear^.Damage > 0 then
   409    if Gear^.Damage > 0 then
   406       Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump);
   410       Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump);
   407    exit
   411    exit
   408    end;
   412    end;
   409 
   413 
   410 if ((Gear^.State and gstMoving) <> 0) then
   414 if ((Gear^.State and gstMoving) <> 0)
       
   415     or (StepTicks = cHHStepTicks)
       
   416 	or (CurAmmoGear <> nil) then // we're moving
   411 	begin
   417 	begin
   412 	if (StepTicks = cHHStepTicks)
   418 	// check for case with ammo
   413 	or (CurAmmoGear <> nil) then // we're moving
   419 	t:= CheckGearNear(Gear, gtCase, 36, 36);
   414 		begin
   420 	if t <> nil then
   415 		// check for case with ammo
   421 		PickUp(Gear, t)
   416 		t:= CheckGearNear(Gear, gtCase, 36, 36);
   422 	end else
   417 		if t <> nil then
   423 	if ((Gear^.State and gstMoving) <> 0) then
   418 			PickUp(Gear, t)
       
   419 		end else
       
   420 		with PHedgehog(Gear^.Hedgehog)^ do
   424 		with PHedgehog(Gear^.Hedgehog)^ do
   421 			if (CurAmmoGear = nil)
   425 			if (CurAmmoGear = nil)
   422 			and (Gear^.dY > _0_39)
   426 			and (Gear^.dY > _0_39)
   423 			and (Ammo^[CurSlot, CurAmmo].AmmoType = amParachute) then Gear^.Message:= Gear^.Message or gm_Attack
   427 			and (Ammo^[CurSlot, CurAmmo].AmmoType = amParachute) then Gear^.Message:= Gear^.Message or gm_Attack;
   424 	end;
       
   425 
   428 
   426 if CurAmmoGear <> nil then
   429 if CurAmmoGear <> nil then
   427    begin
   430    begin
   428    CurAmmoGear^.Message:= Gear^.Message;
   431    CurAmmoGear^.Message:= Gear^.Message;
   429    exit
   432    exit