5107 Pos:= 0; |
5107 Pos:= 0; |
5108 Target.X:= NoPointX; |
5108 Target.X:= NoPointX; |
5109 LastDamage:= nil; |
5109 LastDamage:= nil; |
5110 X:= Hedgehog^.Gear^.X; |
5110 X:= Hedgehog^.Gear^.X; |
5111 Y:= Hedgehog^.Gear^.Y; |
5111 Y:= Hedgehog^.Gear^.Y; |
5112 //unfreeze all semifrozen hogs - make this generic hog cleanup |
|
5113 (* |
|
5114 iter := GearsList; |
|
5115 while iter <> nil do |
|
5116 begin |
|
5117 if (iter^.Kind = gtHedgehog) and |
|
5118 (iter^.Hedgehog^.Effects[heFrozen] and $FF = 0) then |
|
5119 iter^.Hedgehog^.Effects[heFrozen]:= 0; |
|
5120 iter:= iter^.NextGear |
|
5121 end |
|
5122 *) |
|
5123 end; |
5112 end; |
5124 end; |
5113 end; |
5125 |
5114 |
5126 procedure doStepIceGun(Gear: PGear); |
5115 procedure doStepIceGun(Gear: PGear); |
5127 const iceWaitCollision:Longint = 0; |
5116 const iceWaitCollision:Longint = 0; |
5132 //const waterFreezingTime:Longint = 500; |
5121 //const waterFreezingTime:Longint = 500; |
5133 const groundFreezingTime:Longint = 1000; |
5122 const groundFreezingTime:Longint = 1000; |
5134 const iceRadius = 32; |
5123 const iceRadius = 32; |
5135 const iceHeight = 40; |
5124 const iceHeight = 40; |
5136 var |
5125 var |
5137 HHGear: PGear; |
5126 HHGear, iter: PGear; |
5138 landRect: TSDL_Rect; |
5127 landRect: TSDL_Rect; |
5139 ndX, ndY: hwFloat; |
5128 ndX, ndY: hwFloat; |
5140 i, j, t, gX, gY: LongInt; |
5129 i, j, t, gX, gY: LongInt; |
5141 hogs: PGearArrayS; |
5130 hogs: PGearArrayS; |
5142 vg: PVisualGear; |
5131 vg: PVisualGear; |
5202 landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); |
5191 landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); |
5203 landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); |
5192 landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); |
5204 landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
5193 landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
5205 landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); |
5194 landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); |
5206 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
5195 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
|
5196 |
|
5197 // Freeze nearby mines/explosives/cases too |
|
5198 iter := GearsList; |
|
5199 while iter <> nil do |
|
5200 begin |
|
5201 if ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and |
|
5202 (abs(Gear^.X.Round-target.x)+abs(Gear^.Y.Round-target.y)+2<Gear^.Radius*2) and (Distance(Gear^.X-int2hwFloat(target.x),Gear^.Y-int2hwFloat(target.y))<int2hwFloat(Gear^.Radius*2)) then |
|
5203 begin |
|
5204 iter^.State:= iter^.State or gstFrozen; |
|
5205 if iter^.Kind = gtMine then // dud mine block |
|
5206 begin |
|
5207 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
|
5208 if vg <> nil then |
|
5209 vg^.Scale:= 0.5; |
|
5210 PlaySound(sndVaporize); |
|
5211 Gear^.Health := 0; |
|
5212 Gear^.Damage := 0; |
|
5213 Gear^.State := Gear^.State and (not gstAttacking) |
|
5214 end |
|
5215 end; |
|
5216 iter:= iter^.NextGear |
|
5217 end; |
5207 |
5218 |
5208 // FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
5219 // FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
5209 SetAllHHToActive; |
5220 SetAllHHToActive; |
5210 Timer := iceWaitCollision; |
5221 Timer := iceWaitCollision; |
5211 end; |
5222 end; |