hedgewars/GSHandlers.inc
changeset 6131 4e8816cf9459
parent 6130 026fd01a5e2c
parent 5995 647d52370ce9
child 6154 72c6239a7cc6
equal deleted inserted replaced
6130:026fd01a5e2c 6131:4e8816cf9459
   172                 CheckGearDrowning := true;
   172                 CheckGearDrowning := true;
   173                 Gear^.State := gstDrowning;
   173                 Gear^.State := gstDrowning;
   174                 Gear^.RenderTimer := false;
   174                 Gear^.RenderTimer := false;
   175                 if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and 
   175                 if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and 
   176                    (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
   176                    (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
   177                     if Gear^.Kind = gtHedgehog then 
   177                     if Gear^.Kind = gtHedgehog then
   178                         begin
   178                         begin
   179                         if Gear^.Hedgehog^.Effects[heResurrectable] then
   179                         if Gear^.Hedgehog^.Effects[heResurrectable] then
   180                             ResurrectHedgehog(Gear)
   180                             ResurrectHedgehog(Gear)
   181                         else
   181                         else
   182                             begin
   182                             begin
   217         CheckGearDrowning := false;
   217         CheckGearDrowning := false;
   218 end;
   218 end;
   219 
   219 
   220 procedure CheckCollision(Gear: PGear); inline;
   220 procedure CheckCollision(Gear: PGear); inline;
   221 begin
   221 begin
   222     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0)
   222     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0) then
   223         then Gear^.State := Gear^.State or      gstCollision
   223         Gear^.State := Gear^.State or gstCollision
   224     else Gear^.State := Gear^.State and not gstCollision
   224     else Gear^.State := Gear^.State and not gstCollision
   225 end;
   225 end;
   226 
   226 
   227 procedure CheckCollisionWithLand(Gear: PGear); inline;
   227 procedure CheckCollisionWithLand(Gear: PGear); inline;
   228 begin
   228 begin
   359         collH := hwSign(Gear^.dX);
   359         collH := hwSign(Gear^.dX);
   360         Gear^.dX := - Gear^.dX * Gear^.Elasticity;
   360         Gear^.dX := - Gear^.dX * Gear^.Elasticity;
   361         Gear^.dY :=   Gear^.dY * Gear^.Elasticity;
   361         Gear^.dY :=   Gear^.dY * Gear^.Elasticity;
   362         Gear^.State := Gear^.State or gstCollision
   362         Gear^.State := Gear^.State or gstCollision
   363         end
   363         end
   364     else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then 
   364     else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then
   365         collH := -hwSign(Gear^.dX); 
   365         collH := -hwSign(Gear^.dX); 
   366     //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
   366     //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
   367     if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1) or ((tdX.QWordValue +
   367     if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1) or ((tdX.QWordValue +
   368        tdY.QWordValue) > _0_2.QWordValue)) then
   368        tdY.QWordValue) > _0_2.QWordValue)) then
   369         begin
   369         begin
   375         Gear^.AdvBounce := 10;
   375         Gear^.AdvBounce := 10;
   376         end;
   376         end;
   377 
   377 
   378     if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce);
   378     if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce);
   379 
   379 
   380     if isFalling then 
   380     if isFalling then
   381         begin
   381         begin
   382         Gear^.dY := Gear^.dY + cGravity;
   382         Gear^.dY := Gear^.dY + cGravity;
   383         if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   383         if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   384         end;
   384         end;
   385 
   385 
   475 
   475 
   476                 for i:= 0 to 127 do
   476                 for i:= 0 to 127 do
   477                     begin
   477                     begin
   478                     dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1);
   478                     dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1);
   479                     dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1);
   479                     dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1);
   480                     if i mod 2 = 0 then 
   480                     if i mod 2 = 0 then
   481                         begin
   481                         begin
   482                         AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0);
   482                         AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0);
   483                         AddGear(x, y, gtFlame, 0, dX, -dY, 0)
   483                         AddGear(x, y, gtFlame, 0, dX, -dY, 0)
   484                         end
   484                         end
   485                     else
   485                     else
   558                 glass^.Tint:= $41B83ED0 - i * $10081000;
   558                 glass^.Tint:= $41B83ED0 - i * $10081000;
   559                 glass^.dX:= 1/(10*(random(11)-5));
   559                 glass^.dX:= 1/(10*(random(11)-5));
   560                 glass^.dY:= -1/(random(4)+5);
   560                 glass^.dY:= -1/(random(4)+5);
   561                 end;*)
   561                 end;*)
   562             glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot);
   562             glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot);
   563             if glass <> nil then 
   563             if glass <> nil then
   564                 with glass^ do
   564                 with glass^ do
   565                     begin
   565                     begin
   566                     Frame:= 2;
   566                     Frame:= 2;
   567                     Tint:= $41B83ED0 - i * $10081000;
   567                     Tint:= $41B83ED0 - i * $10081000;
   568                     Angle:= random * 360;
   568                     Angle:= random * 360;
   734                 then move:=true
   734                 then move:=true
   735             else draw:= true
   735             else draw:= true
   736             end
   736             end
   737         end
   737         end
   738     end;
   738     end;
   739 if draw then 
   739 if draw then
   740     with Gear^ do
   740     with Gear^ do
   741         begin
   741         begin
   742         // we've collided with land. draw some stuff and get back into the clouds
   742         // we've collided with land. draw some stuff and get back into the clouds
   743         move:= true;
   743         move:= true;
   744         if (Pos > 20) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope)) then
   744         if (Pos > 20) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope)) then
   892         StopSound(Gear^.SoundChannel);
   892         StopSound(Gear^.SoundChannel);
   893         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
   893         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
   894         for i:= 0 to 31 do
   894         for i:= 0 to 31 do
   895             begin
   895             begin
   896             flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
   896             flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
   897             if flower <> nil then 
   897             if flower <> nil then
   898                 with flower^ do
   898                 with flower^ do
   899                     begin
   899                     begin
   900                     Scale:= 0.75;
   900                     Scale:= 0.75;
   901                     dx:= 0.001 * (random(200));
   901                     dx:= 0.001 * (random(200));
   902                     dy:= 0.001 * (random(200));
   902                     dy:= 0.001 * (random(200));
  1248         end;
  1248         end;
  1249 
  1249 
  1250     if (Gear^.Timer mod 47) = 0 then
  1250     if (Gear^.Timer mod 47) = 0 then
  1251         begin
  1251         begin
  1252         // ok. this was an attempt to turn off dust if not actually drilling land.  I have no idea why it isn't working as expected
  1252         // ok. this was an attempt to turn off dust if not actually drilling land.  I have no idea why it isn't working as expected
  1253         if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then 
  1253         if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then
  1254             for i:= 0 to 1 do
  1254             for i:= 0 to 1 do
  1255                 AddVisualGear(x - 5 + Random(10), y + 12, vgtDust);
  1255                 AddVisualGear(x - 5 + Random(10), y + 12, vgtDust);
  1256 
  1256 
  1257         i := x - Gear^.Radius - LongInt(GetRandom(2));
  1257         i := x - Gear^.Radius - LongInt(GetRandom(2));
  1258         ei := x + Gear^.Radius + LongInt(GetRandom(2));
  1258         ei := x + Gear^.Radius + LongInt(GetRandom(2));
  1975             end;
  1975             end;
  1976             dec(Gear^.Timer);
  1976             dec(Gear^.Timer);
  1977         end
  1977         end
  1978     end
  1978     end
  1979     else // gsttmpFlag = 0
  1979     else // gsttmpFlag = 0
  1980         if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))  then Gear^.State := Gear^.State or gsttmpFlag;
  1980         if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) then
       
  1981             Gear^.State := Gear^.State or gsttmpFlag;
  1981 end;
  1982 end;
  1982 
  1983 
  1983 ////////////////////////////////////////////////////////////////////////////////
  1984 ////////////////////////////////////////////////////////////////////////////////
  1984 procedure doStepDynamite(Gear: PGear);
  1985 procedure doStepDynamite(Gear: PGear);
  1985 begin
  1986 begin
  2824     Gear^.X := HHGear^.X;
  2825     Gear^.X := HHGear^.X;
  2825     Gear^.Y := HHGear^.Y;
  2826     Gear^.Y := HHGear^.Y;
  2826     if (GameTicks mod 2 = 0) and hasWishes then
  2827     if (GameTicks mod 2 = 0) and hasWishes then
  2827         begin
  2828         begin
  2828         sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
  2829         sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
  2829         if sparkles <> nil then 
  2830         if sparkles <> nil then
  2830             begin
  2831             begin
  2831             sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF;
  2832             sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF;
  2832             sparkles^.Angle:= random * 360;
  2833             sparkles^.Angle:= random * 360;
  2833             end
  2834             end
  2834         end;
  2835         end;
  3177         inc(Gear^.Pos);
  3178         inc(Gear^.Pos);
  3178         if Gear^.Pos = 5 then
  3179         if Gear^.Pos = 5 then
  3179             PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack)
  3180             PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack)
  3180         end;
  3181         end;
  3181 
  3182 
  3182     if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then 
  3183     if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then
  3183         begin
  3184         begin
  3184         heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  3185         heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  3185         if heart <> nil then 
  3186         if heart <> nil then
  3186             with heart^ do
  3187             with heart^ do
  3187                 begin
  3188                 begin
  3188                 dx:= 0.001 * (random(200));
  3189                 dx:= 0.001 * (random(200));
  3189                 dy:= 0.001 * (random(200));
  3190                 dy:= 0.001 * (random(200));
  3190                 if random(2) = 0 then dx := -dx;
  3191                 if random(2) = 0 then dx := -dx;
  3577             if isUnderwater then
  3578             if isUnderwater then
  3578                 begin
  3579                 begin
  3579                 for i:= random(5)+5 downto 0 do
  3580                 for i:= random(5)+5 downto 0 do
  3580                     begin
  3581                     begin
  3581                     bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble);
  3582                     bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble);
  3582                     if bubble <> nil then 
  3583                     if bubble <> nil then
  3583                         begin
  3584                         begin
  3584                         bubble^.dX:= (random(10)/10 + 0.02) * -1;
  3585                         bubble^.dX:= (random(10)/10 + 0.02) * -1;
  3585                         if (move.isNegative) then
  3586                         if (move.isNegative) then
  3586                             begin
  3587                             begin
  3587                             bubble^.X := bubble^.X + 28;
  3588                             bubble^.X := bubble^.X + 28;
  3739             PlaySound(sndBirdyLay);
  3740             PlaySound(sndBirdyLay);
  3740             dec(Gear^.FlightTime)
  3741             dec(Gear^.FlightTime)
  3741             end;
  3742             end;
  3742         end;
  3743         end;
  3743 
  3744 
  3744     if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then 
  3745     if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then
  3745         Gear^.State := Gear^.State and not gsttmpFlag;
  3746         Gear^.State := Gear^.State and not gsttmpFlag;
  3746     HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
  3747     HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
  3747     HHGear^.State := HHGear^.State or gstMoving;
  3748     HHGear^.State := HHGear^.State or gstMoving;
  3748 
  3749 
  3749     Gear^.X := HHGear^.X;
  3750     Gear^.X := HHGear^.X;
  4625     
  4626     
  4626             AddGear(gx, gy, gtFlame, gstTmpFlag,
  4627             AddGear(gx, gy, gtFlame, gstTmpFlag,
  4627                     SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
  4628                     SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
  4628                     AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
  4629                     AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
  4629             
  4630             
  4630             if (Gear^.Health mod 30) = 0 then 
  4631             if (Gear^.Health mod 30) = 0 then
  4631                 AddGear(gx, gy, gtFlame, 0,
  4632                 AddGear(gx, gy, gtFlame, 0,
  4632                         SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
  4633                         SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
  4633                         AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
  4634                         AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
  4634             end;
  4635             end;
  4635         Gear^.Timer:= Gear^.Tag
  4636         Gear^.Timer:= Gear^.Tag
  4892             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
  4893             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
  4893     }
  4894     }
  4894     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,
  4895     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,
  4895             $FF);*)
  4896             $FF);*)
  4896 
  4897 
  4897     if ((Gear^.Message and gmUp) <> 0) then 
  4898     if ((Gear^.Message and gmUp) <> 0) then
  4898         begin
  4899         begin
  4899         if (GameTicks and $F) <> 0 then exit;
  4900         if (GameTicks and $F) <> 0 then exit;
  4900         end 
  4901         end 
  4901     else if (GameTicks and $1FF) <> 0 then exit;
  4902     else if (GameTicks and $1FF) <> 0 then exit;
  4902 
  4903 
  4903     if Gear^.Power < 45 then 
  4904     if Gear^.Power < 45 then
  4904         begin
  4905         begin
  4905         inc(Gear^.Power);
  4906         inc(Gear^.Power);
  4906         if TestCollisionYwithGear(hh^.Gear, -1) = 0 then hh^.Gear^.Y := hh^.Gear^.Y - _1;
  4907         if TestCollisionYwithGear(hh^.Gear, -1) = 0 then hh^.Gear^.Y := hh^.Gear^.Y - _1;
  4907         end;
  4908         end;
  4908 
  4909 
  4909     graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius);
  4910     graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius);
  4910 
  4911 
  4911     if Length(graves) = 0 then 
  4912     if Length(graves) = 0 then
  4912         begin
  4913         begin
  4913         StopSound(Gear^.SoundChannel);
  4914         StopSound(Gear^.SoundChannel);
  4914         Gear^.Timer := 250;
  4915         Gear^.Timer := 250;
  4915         Gear^.doStep := @doStepIdle;
  4916         Gear^.doStep := @doStepIdle;
  4916         exit;
  4917         exit;
  4917         end;
  4918         end;
  4918 
  4919 
  4919     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then 
  4920     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then
  4920         begin
  4921         begin
  4921         if Length(graves) <= Gear^.Tag then Gear^.Tag:= 0;
  4922         if Length(graves) <= Gear^.Tag then Gear^.Tag:= 0;
  4922         dec(hh^.Gear^.Health);
  4923         dec(hh^.Gear^.Health);
  4923         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
  4924         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
  4924             hh^.Gear^.Damage:= 1;
  4925             hh^.Gear^.Damage:= 1;
  5038         Gear^.State:= Gear^.State and not gstMoving;
  5039         Gear^.State:= Gear^.State and not gstMoving;
  5039         end;
  5040         end;
  5040 
  5041 
  5041     if CurAmmoGear = Gear then
  5042     if CurAmmoGear = Gear then
  5042         begin
  5043         begin
  5043         if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then 
  5044         if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
  5044             begin
  5045             begin
  5045             DeleteGear(Gear);
  5046             DeleteGear(Gear);
  5046             exit
  5047             exit
  5047             end;
  5048             end;
  5048         if Gear = CurAmmoGear then CurAmmoGear := nil;
  5049         if Gear = CurAmmoGear then CurAmmoGear := nil;
  5129         Gear^.SoundChannel := LoopSound(sndTardis);
  5130         Gear^.SoundChannel := LoopSound(sndTardis);
  5130         Gear^.Pos:= 3
  5131         Gear^.Pos:= 3
  5131         end
  5132         end
  5132     end;
  5133     end;
  5133 
  5134 
  5134 if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then 
  5135 if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then
  5135     begin
  5136     begin
  5136     inc(Gear^.Power);
  5137     inc(Gear^.Power);
  5137     if (Gear^.Power = 172) and (HH^.Gear <> nil) and 
  5138     if (Gear^.Power = 172) and (HH^.Gear <> nil) and 
  5138        (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and
  5139        (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and
  5139        ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
  5140        ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
  5174         Gear^.SoundChannel := LoopSound(sndTardis);
  5175         Gear^.SoundChannel := LoopSound(sndTardis);
  5175         Gear^.Pos:= 1;
  5176         Gear^.Pos:= 1;
  5176         Gear^.Power:= 0;
  5177         Gear^.Power:= 0;
  5177         Gear^.Timer:= 0;
  5178         Gear^.Timer:= 0;
  5178         if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true);
  5179         if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true);
  5179         if HH^.GearHidden <> nil then 
  5180         if HH^.GearHidden <> nil then
  5180             begin
  5181             begin
  5181             Gear^.X:= HH^.GearHidden^.X;
  5182             Gear^.X:= HH^.GearHidden^.X;
  5182             Gear^.Y:= HH^.GearHidden^.Y;
  5183             Gear^.Y:= HH^.GearHidden^.Y;
  5183             //HH^.Gear:=HH^.GearHidden;
  5184             //HH^.Gear:=HH^.GearHidden;
  5184             //HH^.GearHidden:= nil;
  5185             //HH^.GearHidden:= nil;
  5199     1. Hog is last of his clan
  5200     1. Hog is last of his clan
  5200     2. Sudden Death is in play
  5201     2. Sudden Death is in play
  5201     3. Hog is a king
  5202     3. Hog is a king
  5202 *)
  5203 *)
  5203     HH:= Gear^.Hedgehog;
  5204     HH:= Gear^.Hedgehog;
  5204     if HH^.Gear <> nil then 
  5205     if HH^.Gear <> nil then
  5205     if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then
  5206     if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then
  5206         begin
  5207         begin
  5207         if HH^.Gear <> nil then 
  5208         if HH^.Gear <> nil then
  5208             begin
  5209             begin
  5209             HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
  5210             HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
  5210             HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
  5211             HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
  5211             end;
  5212             end;
  5212         PlaySound(sndDenied);
  5213         PlaySound(sndDenied);
  5220                ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and
  5221                ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and
  5221                (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health >
  5222                (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health >
  5222                 HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt);
  5223                 HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt);
  5223     if cnt < 2 then
  5224     if cnt < 2 then
  5224         begin
  5225         begin
  5225         if HH^.Gear <> nil then 
  5226         if HH^.Gear <> nil then
  5226             begin
  5227             begin
  5227             HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
  5228             HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
  5228             HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
  5229             HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
  5229             end;
  5230             end;
  5230             PlaySound(sndDenied);
  5231             PlaySound(sndDenied);