hedgewars/GSHandlers.inc
branchwebgl
changeset 9168 20ff80421736
parent 9166 3774ac58e65e
child 9236 ddd675825672
equal deleted inserted replaced
9166:3774ac58e65e 9168:20ff80421736
  5208                     Y:= HHGear^.Y
  5208                     Y:= HHGear^.Y
  5209                     end;
  5209                     end;
  5210 
  5210 
  5211                 if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then
  5211                 if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then
  5212                     begin
  5212                     begin
  5213                     FillRoundInLand(target.x, target.y, iceRadius, icePixel);
  5213                     FillRoundInLand2(target.x, target.y, iceRadius, icePixel);
  5214                     landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1);
  5214                     landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1);
  5215                     landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1);
  5215                     landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1);
  5216                     landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1);
  5216                     landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1);
  5217                     landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1);
  5217                     landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1);
  5218                     UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);
  5218                     UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);
  5221                     iter := GearsList;
  5221                     iter := GearsList;
  5222                     while iter <> nil do
  5222                     while iter <> nil do
  5223                         begin
  5223                         begin
  5224                         if (iter^.State and gstFrozen = 0) and
  5224                         if (iter^.State and gstFrozen = 0) and
  5225                            ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and 
  5225                            ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and 
  5226                            (abs(iter^.X.Round-target.x)+abs(iter^.Y.Round-target.y)+2<2*iceRadius) and (Distance(iter^.X-int2hwFloat(target.x),iter^.Y-int2hwFloat(target.y))<int2hwFloat(iceRadius*2)) then
  5226                            (Distance(iter^.X-int2hwFloat(target.x),iter^.Y-int2hwFloat(target.y))<int2hwFloat(iceRadius*2)) then
  5227                             begin
  5227                             begin
  5228                             for t:= 0 to 5 do
  5228                             for t:= 0 to 5 do
  5229                                 begin
  5229                                 begin
  5230                                 vg:= AddVisualGear(hwRound(iter^.X)+random(4)-8, hwRound(iter^.Y)+random(8), vgtDust, 1);
  5230                                 vg:= AddVisualGear(hwRound(iter^.X)+random(4)-8, hwRound(iter^.Y)+random(8), vgtDust, 1);
  5231                                 if vg <> nil then
  5231                                 if vg <> nil then
  5410     exit
  5410     exit
  5411     end;
  5411     end;
  5412 
  5412 
  5413 // Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target
  5413 // Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target
  5414 if (HHGear = nil) or (Gear^.Timer = 0) or
  5414 if (HHGear = nil) or (Gear^.Timer = 0) or
  5415    (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) >  Gear^.Angle) and
  5415    (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle))
  5416         (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle)))
       
  5417     then
  5416     then
  5418     begin
  5417     begin
  5419     hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Angle);
  5418     hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Angle);
  5420     if hogs.size > 1 then
  5419     if hogs.size > 1 then
  5421         Gear^.Hedgehog:= hogs.ar^[GetRandom(hogs.size)]^.Hedgehog
  5420         Gear^.Hedgehog:= hogs.ar^[GetRandom(hogs.size)]^.Hedgehog