5159 gY:= hwRound(Y); |
5159 gY:= hwRound(Y); |
5160 if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
5160 if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
5161 |
5161 |
5162 if Target.X <> NoPointX then |
5162 if Target.X <> NoPointX then |
5163 begin |
5163 begin |
5164 CheckCollisionWithLand(Gear); |
5164 CheckCollision(Gear); |
5165 if (State and gstCollision) <> 0 then |
5165 if (State and gstCollision) <> 0 then |
5166 begin |
5166 begin |
5167 if Timer = iceWaitCollision then |
5167 if Timer = iceWaitCollision then |
5168 begin |
5168 begin |
5169 Timer := iceCollideWithGround; |
5169 Timer := iceCollideWithGround; |
5196 |
5196 |
5197 // Freeze nearby mines/explosives/cases too |
5197 // Freeze nearby mines/explosives/cases too |
5198 iter := GearsList; |
5198 iter := GearsList; |
5199 while iter <> nil do |
5199 while iter <> nil do |
5200 begin |
5200 begin |
5201 if ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and |
5201 if (iter^.State and gstFrozen = 0) 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 |
5202 ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and |
|
5203 (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 |
5203 begin |
5204 begin |
|
5205 for t:= 0 to 5 do |
|
5206 begin |
|
5207 vg:= AddVisualGear(hwRound(iter^.X)+random(4)-8, hwRound(iter^.Y)+random(8), vgtDust, 1); |
|
5208 if vg <> nil then |
|
5209 begin |
|
5210 i:= random(100) + 155; |
|
5211 vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or Longword(random(200) + 55); |
|
5212 vg^.Angle:= random(360); |
|
5213 vg^.dx:= 0.001 * random(80); |
|
5214 vg^.dy:= 0.001 * random(80) |
|
5215 end |
|
5216 end; |
5204 iter^.State:= iter^.State or gstFrozen; |
5217 iter^.State:= iter^.State or gstFrozen; |
5205 if iter^.Kind = gtMine then // dud mine block |
5218 if iter^.Kind = gtMine then // dud mine block |
5206 begin |
5219 begin |
5207 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
5220 vg:= AddVisualGear(hwRound(iter^.X) - 4 + Random(8), hwRound(iter^.Y) - 4 - Random(4), vgtSmoke); |
5208 if vg <> nil then |
5221 if vg <> nil then |
5209 vg^.Scale:= 0.5; |
5222 vg^.Scale:= 0.5; |
5210 PlaySound(sndVaporize); |
5223 PlaySound(sndVaporize); |
5211 Gear^.Health := 0; |
5224 iter^.Health := 0; |
5212 Gear^.Damage := 0; |
5225 iter^.Damage := 0; |
5213 Gear^.State := Gear^.State and (not gstAttacking) |
5226 iter^.State := iter^.State and (not gstAttacking) |
|
5227 end |
|
5228 else if iter^.Kind = gtCase then |
|
5229 begin |
|
5230 DeleteCI(iter); |
|
5231 AddGearCI(iter) |
5214 end |
5232 end |
5215 end; |
5233 end; |
5216 iter:= iter^.NextGear |
5234 iter:= iter^.NextGear |
5217 end; |
5235 end; |
5218 |
5236 |