hedgewars/GSHandlers.inc
changeset 8601 7668f92734b8
parent 8599 6bd1950de78b
child 8602 f510cca2b988
equal deleted inserted replaced
8599:6bd1950de78b 8601:7668f92734b8
  5089         end 
  5089         end 
  5090 *)
  5090 *)
  5091   end;
  5091   end;
  5092 end;
  5092 end;
  5093 
  5093 
  5094 procedure DrawIce(x, y: Longint); 
       
  5095     const iceRadius :Longint = 32;
       
  5096 var
       
  5097     i, j: Longint;
       
  5098     weight: Longint;
       
  5099     landRect : TSDL_RECT;
       
  5100 begin
       
  5101     FillRoundInLandWithIce(x, y, iceRadius);
       
  5102     SetAllHHToActive; 
       
  5103     landRect.x := min(max(x - iceRadius, 0), LAND_WIDTH - 1);
       
  5104     landRect.y := min(max(y - iceRadius, 0), LAND_HEIGHT - 1);
       
  5105     landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1);
       
  5106     landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1);
       
  5107     UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);
       
  5108 end;
       
  5109 
       
  5110 
  5094 
  5111 procedure doStepIceGun(Gear: PGear);
  5095 procedure doStepIceGun(Gear: PGear);
  5112 const iceWaitCollision:Longint = 0;
  5096 const iceWaitCollision:Longint = 0;
  5113 const iceCollideWithGround:Longint = 1;
  5097 const iceCollideWithGround:Longint = 1;
  5114 const iceWaitNextTarget:Longint = 2;
  5098 const iceWaitNextTarget:Longint = 2;
  5115 const iceCollideWithHog:Longint = 4;
  5099 const iceCollideWithHog:Longint = 4;
  5116 const groundFreezingTime:Longint = 1000;
  5100 const groundFreezingTime:Longint = 1000;
       
  5101 const iceRadius = 32;
  5117 var
  5102 var
  5118     HHGear: PGear;
  5103     HHGear: PGear;
  5119     ndX, ndY: hwFloat;
  5104     ndX, ndY: hwFloat;
  5120     i, t, gX, gY: LongInt;
  5105     i, t, gX, gY: LongInt;
  5121     hogs: PGearArrayS;
  5106     hogs: PGearArrayS;
  5173                     Y:= HHGear^.Y
  5158                     Y:= HHGear^.Y
  5174                 end;
  5159                 end;
  5175 
  5160 
  5176                 if (IceState = iceCollideWithGround) and ((GameTicks - IceTime) > groundFreezingTime) then
  5161                 if (IceState = iceCollideWithGround) and ((GameTicks - IceTime) > groundFreezingTime) then
  5177                 begin 
  5162                 begin 
  5178                     DrawIce(Target.X, Target.Y);                                        
  5163                     FillRoundInLandWithIce(Target.X, Target.Y, iceRadius);
       
  5164                     SetAllHHToActive;                                     
  5179                     IceState := iceWaitNextTarget;
  5165                     IceState := iceWaitNextTarget;
  5180                 end;
  5166                 end;
  5181 
  5167 
  5182 // freeze nearby hogs
  5168 // freeze nearby hogs
  5183                 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2);
  5169                 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2);