4520 if (rY <= cWaterLine) or (y <= cWaterLine) then |
4520 if (rY <= cWaterLine) or (y <= cWaterLine) then |
4521 begin |
4521 begin |
4522 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
4522 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
4523 and (Land[y, x] <> 0) then |
4523 and (Land[y, x] <> 0) then |
4524 begin |
4524 begin |
4525 if justCollided then |
4525 if ((GameFlags and gfSolidLand) <> 0) and (Land[y, x] > 255) then |
4526 begin |
4526 Gear^.Damage := initHealth |
4527 Gear^.Damage := 0; |
4527 else if justCollided then |
4528 Gear^.Health := 0; |
4528 begin |
4529 end |
4529 Gear^.Damage := initHealth; |
4530 else |
4530 end |
4531 begin |
4531 else |
4532 inc(Gear^.Damage,3); |
4532 begin |
4533 justCollided := true; |
4533 inc(Gear^.Damage,3); |
4534 end; |
4534 justCollided := true; |
|
4535 end; |
4535 end |
4536 end |
4536 else |
4537 else |
4537 justCollided := false; |
4538 justCollided := false; |
4538 |
4539 |
4539 // kick nearby hogs, dig tunnel and add some fire |
4540 // kick nearby hogs, dig tunnel and add some fire |
4540 // if at least 5 collisions occured |
4541 // if at least 5 collisions occured |
4541 if Gear^.Damage > 0 then |
4542 if Gear^.Damage > 0 then |
4542 begin |
4543 begin |
4543 DrawExplosion(rX,rY,Gear^.Radius); |
4544 if ((GameFlags and gfSolidLand) = 0) then |
|
4545 begin |
|
4546 DrawExplosion(rX,rY,Gear^.Radius); |
|
4547 end; |
4544 |
4548 |
4545 // kick nearby hogs |
4549 // kick nearby hogs |
4546 AmmoShove(Gear, 35, 50); |
4550 AmmoShove(Gear, 35, 50); |
4547 |
4551 |
4548 dec(Gear^.Health, Gear^.Damage); |
4552 dec(Gear^.Health, Gear^.Damage); |
4549 Gear^.Damage := 0; |
4553 |
4550 |
4554 // explode when impacting on solid land/borders |
|
4555 if Gear^.Damage >= initHealth then |
|
4556 begin |
|
4557 // add some random offset to angles |
|
4558 tmp := getRandom(256); |
|
4559 // spawn some flames |
|
4560 for t:= 0 to 3 do |
|
4561 begin |
|
4562 if not isZero(Gear^.dX) then rX := rx - hwSign(Gear^.dX); |
|
4563 if not isZero(Gear^.dY) then rY := ry - hwSign(Gear^.dY); |
|
4564 lX := AngleCos(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
4565 lY := AngleSin(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
4566 AddGear(rX, rY, gtFlame, 0, lX, lY, 0); |
|
4567 AddGear(rX, rY, gtFlame, 0, lX, -lY, 0); |
|
4568 end; |
|
4569 end |
4551 // add some fire to the tunnel |
4570 // add some fire to the tunnel |
4552 if getRandom(6) = 0 then |
4571 else if getRandom(6) = 0 then |
4553 begin |
4572 begin |
4554 tmp:= GetRandom(2 * Gear^.Radius); |
4573 tmp:= GetRandom(2 * Gear^.Radius); |
4555 AddGear(x - Gear^.Radius + tmp, y - GetRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0) |
4574 AddGear(x - Gear^.Radius + tmp, y - GetRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0) |
4556 end |
4575 end; |
4557 end; |
4576 end; |
|
4577 |
|
4578 Gear^.Damage := 0; |
4558 |
4579 |
4559 if random(100) = 0 then |
4580 if random(100) = 0 then |
4560 AddVisualGear(x, y, vgtSmokeTrace); |
4581 AddVisualGear(x, y, vgtSmokeTrace); |
4561 end |
4582 end |
4562 else dec(Gear^.Health, 5); // if underwater get additional damage |
4583 else dec(Gear^.Health, 5); |
4563 end; |
4584 end; |
4564 |
4585 |
4565 dec(Gear^.Health); |
4586 dec(Gear^.Health); |
4566 |
4587 |
4567 // decrease bullet size towards the end |
4588 // decrease bullet size towards the end |