hedgewars/uGearsHandlersMess.pas
changeset 12299 6b25d117a904
parent 12292 93434ab299a0
child 12300 6486a012987e
equal deleted inserted replaced
12298:91ebbadc461d 12299:6b25d117a904
  1986         CalcRotationDirAngle(Gear);
  1986         CalcRotationDirAngle(Gear);
  1987         end;
  1987         end;
  1988 
  1988 
  1989     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1989     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1990         begin
  1990         begin
  1991         if ((Gear^.State and gstAttacking) = 0) then
  1991         if ((Gear^.State and gstAttacking) = 0) and ((Gear^.State and gstFrozen) = 0) then
  1992             begin
  1992             begin
  1993             if ((GameTicks and $1F) = 0) then
  1993             if ((GameTicks and $1F) = 0) then
  1994 // FIXME - values taken from mine.  use a gear val and set both to same
  1994 // FIXME - values taken from mine.  use a gear val and set both to same
  1995                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
  1995                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
  1996                     Gear^.State := Gear^.State or gstAttacking
  1996                     Gear^.State := Gear^.State or gstAttacking
  1997             end
  1997             end
  1998         else // gstAttacking <> 0
  1998         else if (Gear^.State and gstFrozen) = 0 then // gstAttacking <> 0
  1999             begin
  1999             begin
  2000             AllInactive := false;
  2000             AllInactive := false;
  2001             if Gear^.Timer = 0 then
  2001             if Gear^.Timer = 0 then
  2002                 begin
  2002                 begin
  2003                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  2003                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  6036                     // Freeze nearby mines/explosives/cases too
  6036                     // Freeze nearby mines/explosives/cases too
  6037                     iter := GearsList;
  6037                     iter := GearsList;
  6038                     while iter <> nil do
  6038                     while iter <> nil do
  6039                         begin
  6039                         begin
  6040                         if (iter^.State and gstFrozen = 0) and
  6040                         if (iter^.State and gstFrozen = 0) and
  6041                            ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
  6041                            ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine) or (iter^.Kind = gtSMine)) and
  6042                            (abs(LongInt(iter^.X.Round) - target.x) + abs(LongInt(iter^.Y.Round) - target.y) + 2 < 2 * iceRadius)
  6042                            (abs(LongInt(iter^.X.Round) - target.x) + abs(LongInt(iter^.Y.Round) - target.y) + 2 < 2 * iceRadius)
  6043                            and (Distance(iter^.X - int2hwFloat(target.x), iter^.Y - int2hwFloat(target.y)) < int2hwFloat(iceRadius * 2)) then
  6043                            and (Distance(iter^.X - int2hwFloat(target.x), iter^.Y - int2hwFloat(target.y)) < int2hwFloat(iceRadius * 2)) then
  6044                             begin
  6044                             begin
  6045                             for t:= 0 to 5 do
  6045                             for t:= 0 to 5 do
  6046                                 begin
  6046                                 begin
  6062                                 if vg <> nil then
  6062                                 if vg <> nil then
  6063                                     vg^.Scale:= 0.5;
  6063                                     vg^.Scale:= 0.5;
  6064                                 PlaySound(sndVaporize);
  6064                                 PlaySound(sndVaporize);
  6065                                 iter^.Health := 0;
  6065                                 iter^.Health := 0;
  6066                                 iter^.Damage := 0;
  6066                                 iter^.Damage := 0;
       
  6067                                 iter^.State := iter^.State and (not gstAttacking)
       
  6068                                 end
       
  6069                             else if iter^.Kind = gtSMine then // disabe sticky mine
       
  6070                                 begin
       
  6071                                 iter^.State:= iter^.State or gstFrozen;
       
  6072                                 vg:= AddVisualGear(hwRound(iter^.X) - 2  + Random(4), hwRound(iter^.Y) - 2 - Random(2), vgtSmoke);
       
  6073                                 if vg <> nil then
       
  6074                                     vg^.Scale:= 0.4;
       
  6075                                 PlaySound(sndVaporize);
  6067                                 iter^.State := iter^.State and (not gstAttacking)
  6076                                 iter^.State := iter^.State and (not gstAttacking)
  6068                                 end
  6077                                 end
  6069                             else if iter^.Kind = gtCase then
  6078                             else if iter^.Kind = gtCase then
  6070                                 begin
  6079                                 begin
  6071                                 DeleteCI(iter);
  6080                                 DeleteCI(iter);