hedgewars/uGearsHandlersMess.pas
changeset 11473 2f6f8baa2a97
parent 11396 bc9650ec9b20
child 11474 26068971a4de
equal deleted inserted replaced
11472:f2c36df8c7b1 11473:2f6f8baa2a97
   126 procedure doStepHammerHitWork(Gear: PGear);
   126 procedure doStepHammerHitWork(Gear: PGear);
   127 procedure doStepHammerHit(Gear: PGear);
   127 procedure doStepHammerHit(Gear: PGear);
   128 procedure doStepResurrectorWork(Gear: PGear);
   128 procedure doStepResurrectorWork(Gear: PGear);
   129 procedure doStepResurrector(Gear: PGear);
   129 procedure doStepResurrector(Gear: PGear);
   130 procedure doStepNapalmBomb(Gear: PGear);
   130 procedure doStepNapalmBomb(Gear: PGear);
   131 procedure doStepStructure(Gear: PGear);
   131 //procedure doStepStructure(Gear: PGear);
   132 procedure doStepTardisWarp(Gear: PGear);
   132 procedure doStepTardisWarp(Gear: PGear);
   133 procedure doStepTardis(Gear: PGear);
   133 procedure doStepTardis(Gear: PGear);
   134 procedure updateFuel(Gear: PGear);
   134 procedure updateFuel(Gear: PGear);
   135 procedure updateTarget(Gear:PGear; newX, newY:HWFloat);
   135 procedure updateTarget(Gear:PGear; newX, newY:HWFloat);
   136 procedure doStepIceGun(Gear: PGear);
   136 procedure doStepIceGun(Gear: PGear);
   137 procedure doStepAddAmmo(Gear: PGear);
   137 procedure doStepAddAmmo(Gear: PGear);
   138 procedure doStepGenericFaller(Gear: PGear);
   138 procedure doStepGenericFaller(Gear: PGear);
   139 procedure doStepCreeper(Gear: PGear);
   139 //procedure doStepCreeper(Gear: PGear);
   140 procedure doStepKnife(Gear: PGear);
   140 procedure doStepKnife(Gear: PGear);
   141 
   141 
   142 var
   142 var
   143     upd: Longword;
   143     upd: Longword;
   144     snowLeft,snowRight: LongInt;
   144     snowLeft,snowRight: LongInt;
   511     doStepFallingGear(Gear);
   511     doStepFallingGear(Gear);
   512 
   512 
   513     dec(Gear^.Timer);
   513     dec(Gear^.Timer);
   514     if Gear^.Timer = 1000 then // might need adjustments
   514     if Gear^.Timer = 1000 then // might need adjustments
   515         case Gear^.Kind of
   515         case Gear^.Kind of
   516             gtGrenade: makeHogsWorry(Gear^.X, Gear^.Y, 50);
   516             gtGrenade,
   517             gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20);
   517             gtClusterBomb,
   518             gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75);
   518             gtWatermelon,
   519             gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90);
   519             gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom);
   520             gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50);
   520             gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50);
   521         end;
   521         end;
   522 
   522 
   523     if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
   523     if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
   524         begin
   524         begin
   525         CheckCollision(Gear);
   525         CheckCollision(Gear);
   526         if (Gear^.State and gstCollision) <> 0 then
   526         if (Gear^.State and gstCollision) <> 0 then
   527             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx);
   527             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx);
   528         end;
   528         end;
   529 
   529 
   530     if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
   530     if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
   531         begin
   531         begin
   532         vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
   532         vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
   535         end;
   535         end;
   536 
   536 
   537     if Gear^.Timer = 0 then
   537     if Gear^.Timer = 0 then
   538         begin
   538         begin
   539         case Gear^.Kind of
   539         case Gear^.Kind of
   540             gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
   540             gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   541             gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, Gear^.Hedgehog, EXPLAutoSound);
   541             gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   542             gtClusterBomb:
   542             gtClusterBomb:
   543                 begin
   543                 begin
   544                 x := hwRound(Gear^.X);
   544                 x := hwRound(Gear^.X);
   545                 y := hwRound(Gear^.Y);
   545                 y := hwRound(Gear^.Y);
   546                 gdX:= Gear^.dX;
   546                 gdX:= Gear^.dX;
   547                 doMakeExplosion(x, y, 20, Gear^.Hedgehog, EXPLAutoSound);
   547                 doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   548                 for i:= 0 to 4 do
   548                 for i:= 0 to 4 do
   549                     begin
   549                     begin
   550                     dX := rndSign(GetRandomf * _0_1) + gdX / 5;
   550                     dX := rndSign(GetRandomf * _0_1) + gdX / 5;
   551                     dY := (GetRandomf - _3) * _0_08;
   551                     dY := (GetRandomf - _3) * _0_08;
   552                     FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25)
   552                     FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25)
   555             gtWatermelon:
   555             gtWatermelon:
   556                 begin
   556                 begin
   557                 x := hwRound(Gear^.X);
   557                 x := hwRound(Gear^.X);
   558                 y := hwRound(Gear^.Y);
   558                 y := hwRound(Gear^.Y);
   559                 gdX:= Gear^.dX;
   559                 gdX:= Gear^.dX;
   560                 doMakeExplosion(x, y, 75, Gear^.Hedgehog, EXPLAutoSound);
   560                 doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   561                 for i:= 0 to 5 do
   561                 for i:= 0 to 5 do
   562                     begin
   562                     begin
   563                     dX := rndSign(GetRandomf * _0_1) + gdX / 5;
   563                     dX := rndSign(GetRandomf * _0_1) + gdX / 5;
   564                     dY := (GetRandomf - _1_5) * _0_3;
   564                     dY := (GetRandomf - _1_5) * _0_3;
   565                     FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75);
   565                     FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75);
   568                 end;
   568                 end;
   569             gtHellishBomb:
   569             gtHellishBomb:
   570                 begin
   570                 begin
   571                 x := hwRound(Gear^.X);
   571                 x := hwRound(Gear^.X);
   572                 y := hwRound(Gear^.Y);
   572                 y := hwRound(Gear^.Y);
   573                 doMakeExplosion(x, y, 90, Gear^.Hedgehog, EXPLAutoSound);
   573                 doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   574 
   574 
   575                 for i:= 0 to 127 do
   575                 for i:= 0 to 127 do
   576                     begin
   576                     begin
   577                     dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1);
   577                     dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1);
   578                     dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1);
   578                     dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1);
   588                         end;
   588                         end;
   589                     end
   589                     end
   590                 end;
   590                 end;
   591             gtGasBomb:
   591             gtGasBomb:
   592                 begin
   592                 begin
   593                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLAutoSound);
   593                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   594                 for i:= 0 to 2 do
   594                 for i:= 0 to 2 do
   595                     begin
   595                     begin
   596                     x:= GetRandom(60);
   596                     x:= GetRandom(60);
   597                     y:= GetRandom(40);
   597                     y:= GetRandom(40);
   598                     FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
   598                     FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
   697 begin
   697 begin
   698     AllInactive := false;
   698     AllInactive := false;
   699     doStepFallingGear(Gear);
   699     doStepFallingGear(Gear);
   700     if (Gear^.State and gstCollision) <> 0 then
   700     if (Gear^.State and gstCollision) <> 0 then
   701         begin
   701         begin
   702         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, Gear^.Hedgehog, EXPLAutoSound);
   702         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   703         DeleteGear(Gear);
   703         DeleteGear(Gear);
   704         exit
   704         exit
   705     end;
   705     end;
   706 
   706 
   707     if (Gear^.Kind = gtMelonPiece)
   707     if (Gear^.Kind = gtMelonPiece) then
   708     or (Gear^.Kind = gtBall) then
       
   709         CalcRotationDirAngle(Gear)
   708         CalcRotationDirAngle(Gear)
   710     else if (GameTicks and $1F) = 0 then
   709     else if (GameTicks and $1F) = 0 then
   711         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   710         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   712 end;
   711 end;
   713 
   712 
   718     if (GameFlags and gfMoreWind) = 0 then
   717     if (GameFlags and gfMoreWind) = 0 then
   719         Gear^.dX := Gear^.dX + cWindSpeed;
   718         Gear^.dX := Gear^.dX + cWindSpeed;
   720     doStepFallingGear(Gear);
   719     doStepFallingGear(Gear);
   721     if (Gear^.State and gstCollision) <> 0 then
   720     if (Gear^.State and gstCollision) <> 0 then
   722         begin
   721         begin
   723         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
   722         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
   724         DeleteGear(Gear);
   723         DeleteGear(Gear);
   725         exit
   724         exit
   726         end;
   725         end;
   727     if (GameTicks and $3F) = 0 then
   726     if (GameTicks and $3F) = 0 then
   728         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   727         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   741     gdY := Gear^.dY;
   740     gdY := Gear^.dY;
   742     doStepFallingGear(Gear);
   741     doStepFallingGear(Gear);
   743     CalcRotationDirAngle(Gear);
   742     CalcRotationDirAngle(Gear);
   744     if (Gear^.State and gstCollision) <> 0 then
   743     if (Gear^.State and gstCollision) <> 0 then
   745         begin
   744         begin
   746         kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * _20);
   745         kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * Gear^.Boom / 10000);
   747         Gear^.dX:= gdX;
   746         Gear^.dX:= gdX;
   748         Gear^.dY:= gdY;
   747         Gear^.dY:= gdY;
   749         AmmoShove(Gear, 0, kick);
   748         AmmoShove(Gear, 0, kick);
   750         for i:= 15 + kick div 10 downto 0 do
   749         for i:= 15 + kick div 10 downto 0 do
   751             begin
   750             begin
  1050 
  1049 
  1051     CheckCollision(Gear);
  1050     CheckCollision(Gear);
  1052     if ((Gear^.State and gstCollision) <> 0) then
  1051     if ((Gear^.State and gstCollision) <> 0) then
  1053         begin
  1052         begin
  1054         StopSoundChan(Gear^.SoundChannel);
  1053         StopSoundChan(Gear^.SoundChannel);
  1055         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  1054         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  1056         for i:= 0 to 31 do
  1055         for i:= 0 to 31 do
  1057             begin
  1056             begin
  1058             flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  1057             flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  1059             if flower <> nil then
  1058             if flower <> nil then
  1060                 with flower^ do
  1059                 with flower^ do
  1096     Gear^.dY := Gear^.dY + cGravity;
  1095     Gear^.dY := Gear^.dY + cGravity;
  1097     CheckGearDrowning(Gear);
  1096     CheckGearDrowning(Gear);
  1098     CheckCollision(Gear);
  1097     CheckCollision(Gear);
  1099     if (Gear^.State and gstCollision) <> 0 then
  1098     if (Gear^.State and gstCollision) <> 0 then
  1100         begin
  1099         begin
  1101         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  1100         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  1102         DeleteGear(Gear);
  1101         DeleteGear(Gear);
  1103         exit
  1102         exit
  1104     end;
  1103     end;
  1105     dec(Gear^.Timer);
  1104     dec(Gear^.Timer);
  1106     if Gear^.Timer = 0 then
  1105     if Gear^.Timer = 0 then
  1278             Gear^.Tag := 0;
  1277             Gear^.Tag := 0;
  1279 
  1278 
  1280         if Gear^.Damage > 5 then
  1279         if Gear^.Damage > 5 then
  1281             begin
  1280             begin
  1282             if Gear^.AmmoType = amDEagle then
  1281             if Gear^.AmmoType = amDEagle then
  1283                 AmmoShove(Gear, 7, 20)
  1282                 AmmoShove(Gear, Gear^.Boom, 20)
  1284             else
  1283             else
  1285                 AmmoShove(Gear, Gear^.Timer, 20);
  1284                 AmmoShove(Gear, Gear^.Timer * Gear^.Boom div 100000, 20);
  1286             end;
  1285             end;
  1287         CheckGearDrowning(Gear);
  1286         CheckGearDrowning(Gear);
  1288         dec(i)
  1287         dec(i)
  1289     until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
  1288     until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
  1290 
  1289 
  1469     x:= hwRound(Gear^.X);
  1468     x:= hwRound(Gear^.X);
  1470     y:= hwRound(Gear^.Y);
  1469     y:= hwRound(Gear^.Y);
  1471     if (Gear^.Timer mod 33) = 0 then
  1470     if (Gear^.Timer mod 33) = 0 then
  1472         begin
  1471         begin
  1473         HHGear^.State := HHGear^.State or gstNoDamage;
  1472         HHGear^.State := HHGear^.State or gstNoDamage;
  1474         doMakeExplosion(x, y + 7, 6, Gear^.Hedgehog, EXPLDontDraw);
  1473         doMakeExplosion(x, y + 7, Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw);
  1475         HHGear^.State := HHGear^.State and (not gstNoDamage)
  1474         HHGear^.State := HHGear^.State and (not gstNoDamage)
  1476         end;
  1475         end;
  1477 
  1476 
  1478     if (Gear^.Timer mod 47) = 0 then
  1477     if (Gear^.Timer mod 47) = 0 then
  1479         begin
  1478         begin
  1644                 begin
  1643                 begin
  1645                 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
  1644                 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
  1646                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
  1645                 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
  1647                 end;
  1646                 end;
  1648             HHGear^.State := HHGear^.State or gstNoDamage;
  1647             HHGear^.State := HHGear^.State or gstNoDamage;
  1649             AmmoShove(Gear, 2, 15);
  1648             AmmoShove(Gear, Gear^.Boom, 15);
  1650             HHGear^.State := HHGear^.State and (not gstNoDamage)
  1649             HHGear^.State := HHGear^.State and (not gstNoDamage)
  1651             end;
  1650             end;
  1652         end;
  1651         end;
  1653 
  1652 
  1654     if b then
  1653     if b then
  1729                 vg^.Scale:= 0.5
  1728                 vg^.Scale:= 0.5
  1730             end;
  1729             end;
  1731 
  1730 
  1732         if (Gear^.Damage > 35) then
  1731         if (Gear^.Damage > 35) then
  1733             begin
  1732             begin
  1734             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  1733             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  1735             DeleteGear(Gear);
  1734             DeleteGear(Gear);
  1736             exit
  1735             exit
  1737             end
  1736             end
  1738         end;
  1737         end;
  1739 
  1738 
  1753                 begin
  1752                 begin
  1754                 if ((Gear^.State and gstWait) <> 0)
  1753                 if ((Gear^.State and gstWait) <> 0)
  1755                 or (cMineDudPercent = 0)
  1754                 or (cMineDudPercent = 0)
  1756                 or (getRandom(100) > cMineDudPercent) then
  1755                 or (getRandom(100) > cMineDudPercent) then
  1757                     begin
  1756                     begin
  1758                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
  1757                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  1759                     DeleteGear(Gear)
  1758                     DeleteGear(Gear)
  1760                     end
  1759                     end
  1761                 else
  1760                 else
  1762                     begin
  1761                     begin
  1763                     vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
  1762                     vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
  1776         if (TurnTimeLeft = 0)
  1775         if (TurnTimeLeft = 0)
  1777         or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))
  1776         or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))
  1778         or (Gear^.Hedgehog^.Gear = nil) then
  1777         or (Gear^.Hedgehog^.Gear = nil) then
  1779             Gear^.State := Gear^.State or gsttmpFlag;
  1778             Gear^.State := Gear^.State or gsttmpFlag;
  1780 end;
  1779 end;
  1781 
       
  1782 (*
       
  1783 Just keeping track for my own benefit.
       
  1784 Every second, locate new target.  Clear if target radius has been set to 0 or no target in range.
       
  1785 Every... 16 milliseconds? Update vector to target.
       
  1786 *)
       
  1787 
  1780 
  1788 procedure doStepAirMine(Gear: PGear);
  1781 procedure doStepAirMine(Gear: PGear);
  1789 var i,t,targDist,tmpDist: LongWord;
  1782 var i,t,targDist,tmpDist: LongWord;
  1790     targ, tmpG: PGear;
  1783     targ, tmpG: PGear;
  1791     trackSpeed, airFriction, tX, tY: hwFloat;
  1784     trackSpeed, airFriction, tX, tY: hwFloat;
  1981     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1974     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
  1982         begin
  1975         begin
  1983         if ((Gear^.State and gstAttacking) = 0) then
  1976         if ((Gear^.State and gstAttacking) = 0) then
  1984             begin
  1977             begin
  1985             if ((GameTicks and $1F) = 0) then
  1978             if ((GameTicks and $1F) = 0) then
  1986                 if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
  1979 // FIXME - values taken from mine.  use a gear val and set both to same
       
  1980                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
  1987                     Gear^.State := Gear^.State or gstAttacking
  1981                     Gear^.State := Gear^.State or gstAttacking
  1988             end
  1982             end
  1989         else // gstAttacking <> 0
  1983         else // gstAttacking <> 0
  1990             begin
  1984             begin
  1991             AllInactive := false;
  1985             AllInactive := false;
  1992             if Gear^.Timer = 0 then
  1986             if Gear^.Timer = 0 then
  1993                 begin
  1987                 begin
  1994                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
  1988                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  1995                 DeleteGear(Gear);
  1989                 DeleteGear(Gear);
  1996                 exit
  1990                 exit
  1997                 end
  1991                 end
  1998             else
  1992             else
  1999                 if (Gear^.Timer and $FF) = 0 then
  1993                 if (Gear^.Timer and $FF) = 0 then
  2016         inc(Gear^.Tag);
  2010         inc(Gear^.Tag);
  2017     if Gear^.Timer = 1000 then // might need better timing
  2011     if Gear^.Timer = 1000 then // might need better timing
  2018         makeHogsWorry(Gear^.X, Gear^.Y, 75);
  2012         makeHogsWorry(Gear^.X, Gear^.Y, 75);
  2019     if Gear^.Timer = 0 then
  2013     if Gear^.Timer = 0 then
  2020         begin
  2014         begin
  2021         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, Gear^.Hedgehog, EXPLAutoSound);
  2015         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  2022         DeleteGear(Gear);
  2016         DeleteGear(Gear);
  2023         exit
  2017         exit
  2024         end;
  2018         end;
  2025     dec(Gear^.Timer);
  2019     dec(Gear^.Timer);
  2026 end;
  2020 end;
  2135         DeleteGear(Gear);
  2129         DeleteGear(Gear);
  2136         // <-- delete gear!
  2130         // <-- delete gear!
  2137 
  2131 
  2138         if k = gtCase then
  2132         if k = gtCase then
  2139             begin
  2133             begin
  2140             doMakeExplosion(x, y, 25, hog, EXPLAutoSound);
  2134             doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound);
  2141             for i:= 0 to 63 do
  2135             for i:= 0 to 63 do
  2142                 AddGear(x, y, gtFlame, 0, _0, _0, 0);
  2136                 AddGear(x, y, gtFlame, 0, _0, _0, 0);
  2143             end
  2137             end
  2144         else if k = gtExplosives then
  2138         else if k = gtExplosives then
  2145                 begin
  2139                 begin
  2146                 doMakeExplosion(x, y, 75, hog, EXPLAutoSound);
  2140                 doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound);
  2147                 for i:= 0 to 31 do
  2141                 for i:= 0 to 31 do
  2148                     begin
  2142                     begin
  2149                     dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1);
  2143                     dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1);
  2150                     dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1);
  2144                     dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1);
  2151                     AddGear(x, y, gtFlame, 0, dX, dY, 0);
  2145                     AddGear(x, y, gtFlame, 0, dX, dY, 0);
  2310 begin
  2304 begin
  2311     HHGear := Gear^.Hedgehog^.Gear;
  2305     HHGear := Gear^.Hedgehog^.Gear;
  2312     HHGear^.State := HHGear^.State or gstNoDamage;
  2306     HHGear^.State := HHGear^.State or gstNoDamage;
  2313     DeleteCI(HHGear);
  2307     DeleteCI(HHGear);
  2314 
  2308 
  2315     AmmoShove(Gear, 30, 115);
  2309     AmmoShove(Gear, Gear^.Boom, 115);
  2316 
  2310 
  2317     HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
  2311     HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
  2318     Gear^.Timer := 250;
  2312     Gear^.Timer := 250;
  2319     Gear^.doStep := @doStepIdle
  2313     Gear^.doStep := @doStepIdle
  2320 end;
  2314 end;
  2330     DeleteCI(HHGear);
  2324     DeleteCI(HHGear);
  2331 
  2325 
  2332     for i:= 0 to 3 do
  2326     for i:= 0 to 3 do
  2333         begin
  2327         begin
  2334         AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust);
  2328         AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust);
  2335         AmmoShove(Gear, 30, 25);
  2329         AmmoShove(Gear, Gear^.Boom, 25);
  2336         Gear^.X := Gear^.X + Gear^.dX * 5
  2330         Gear^.X := Gear^.X + Gear^.dX * 5
  2337         end;
  2331         end;
  2338 
  2332 
  2339     HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
  2333     HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
  2340 
  2334 
  2368             tdY:= Gear^.dY;
  2362             tdY:= Gear^.dY;
  2369             Gear^.dX.QWordValue:= 120000000;
  2363             Gear^.dX.QWordValue:= 120000000;
  2370             Gear^.dY.QWordValue:= 429496730;
  2364             Gear^.dY.QWordValue:= 429496730;
  2371             Gear^.dX.isNegative:= getrandom(2)<>1;
  2365             Gear^.dX.isNegative:= getrandom(2)<>1;
  2372             Gear^.dY.isNegative:= true;
  2366             Gear^.dY.isNegative:= true;
  2373             AmmoShove(Gear, 2, 125);
  2367             AmmoShove(Gear, Gear^.Boom, 125);
  2374             Gear^.dX:= tdX;
  2368             Gear^.dX:= tdX;
  2375             Gear^.dY:= tdY;
  2369             Gear^.dY:= tdY;
  2376             Gear^.Radius := 1
  2370             Gear^.Radius := 1
  2377 	    end;
  2371 	    end;
  2378 
  2372 
  2447             tdY:= Gear^.dY;
  2441             tdY:= Gear^.dY;
  2448             Gear^.dX.QWordValue:= 120000000;
  2442             Gear^.dX.QWordValue:= 120000000;
  2449             Gear^.dY.QWordValue:= 429496730;
  2443             Gear^.dY.QWordValue:= 429496730;
  2450             Gear^.dX.isNegative:= getrandom(2)<>1;
  2444             Gear^.dX.isNegative:= getrandom(2)<>1;
  2451             Gear^.dY.isNegative:= true;
  2445             Gear^.dY.isNegative:= true;
  2452             AmmoShove(Gear, 2, 125);
  2446             AmmoShove(Gear, Gear^.Boom, 125);
  2453             Gear^.dX:= tdX;
  2447             Gear^.dX:= tdX;
  2454             Gear^.dY:= tdY;
  2448             Gear^.dY:= tdY;
  2455             Gear^.Radius := 1
  2449             Gear^.Radius := 1
  2456             end;
  2450             end;
  2457         if Gear^.Timer > 0 then
  2451         if Gear^.Timer > 0 then
  2473                     tdY:= Gear^.dY;
  2467                     tdY:= Gear^.dY;
  2474                     Gear^.dX.QWordValue:= 214748365;
  2468                     Gear^.dX.QWordValue:= 214748365;
  2475                     Gear^.dY.QWordValue:= 429496730;
  2469                     Gear^.dY.QWordValue:= 429496730;
  2476                     Gear^.dX.isNegative:= getrandom(2)<>1;
  2470                     Gear^.dX.isNegative:= getrandom(2)<>1;
  2477                     Gear^.dY.isNegative:= true;
  2471                     Gear^.dY.isNegative:= true;
  2478                     AmmoShove(Gear, 6, 100);
  2472                     AmmoShove(Gear, Gear^.Boom * 3, 100);
  2479                     Gear^.dX:= tdX;
  2473                     Gear^.dX:= tdX;
  2480                     Gear^.dY:= tdY;
  2474                     Gear^.dY:= tdY;
  2481                     Gear^.Radius := 1;
  2475                     Gear^.Radius := 1;
  2482                     end
  2476                     end
  2483                 else if ((GameTicks and $3) = 3) then
  2477                 else if ((GameTicks and $3) = 3) then
  2484                     doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage);
  2478                     doMakeExplosion(gX, gY, Gear^.Boom * 4, Gear^.Hedgehog, 0);//, EXPLNoDamage);
  2485                 //DrawExplosion(gX, gY, 4);
  2479                 //DrawExplosion(gX, gY, 4);
  2486 
  2480 
  2487                 if ((GameTicks and $7) = 0) and (Random(2) = 0) then
  2481                 if ((GameTicks and $7) = 0) and (Random(2) = 0) then
  2488                     for i:= Random(2) downto 0 do
  2482                     for i:= Random(2) downto 0 do
  2489                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2483                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2546         begin
  2540         begin
  2547         Gear^.Tag := hwRound(HHGear^.Y);
  2541         Gear^.Tag := hwRound(HHGear^.Y);
  2548         DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4+2, 2);
  2542         DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4+2, 2);
  2549         HHGear^.State := HHGear^.State or gstNoDamage;
  2543         HHGear^.State := HHGear^.State or gstNoDamage;
  2550         Gear^.Y := HHGear^.Y;
  2544         Gear^.Y := HHGear^.Y;
  2551         AmmoShove(Gear, 30, 40);
  2545         AmmoShove(Gear, Gear^.Boom, 40);
  2552         HHGear^.State := HHGear^.State and (not gstNoDamage)
  2546         HHGear^.State := HHGear^.State and (not gstNoDamage)
  2553         end;
  2547         end;
  2554 
  2548 
  2555     HHGear^.dY := HHGear^.dY + cGravity;
  2549     HHGear^.dY := HHGear^.dY + cGravity;
  2556     if Gear^.Timer > 0 then dec(Gear^.Timer);
  2550     if Gear^.Timer > 0 then dec(Gear^.Timer);
  2732 begin
  2726 begin
  2733     AllInactive := false;
  2727     AllInactive := false;
  2734     doStepFallingGear(Gear);
  2728     doStepFallingGear(Gear);
  2735     if (Gear^.State and gstCollision) <> 0 then
  2729     if (Gear^.State and gstCollision) <> 0 then
  2736         begin
  2730         begin
  2737         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
  2731         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  2738         DeleteGear(Gear);
  2732         DeleteGear(Gear);
  2739         {$IFNDEF PAS2C}
  2733         {$IFNDEF PAS2C}
  2740         with mobileRecord do
  2734         with mobileRecord do
  2741             if (performRumble <> nil) and (not fastUntilLag) then
  2735             if (performRumble <> nil) and (not fastUntilLag) then
  2742                 performRumble(kSystemSoundID_Vibrate);
  2736                 performRumble(kSystemSoundID_Vibrate);
  3007     gdY := Gear^.dY;
  3001     gdY := Gear^.dY;
  3008 
  3002 
  3009     doStepFallingGear(Gear);
  3003     doStepFallingGear(Gear);
  3010     if (Gear^.State and gstCollision) <> 0 then
  3004     if (Gear^.State and gstCollision) <> 0 then
  3011         begin
  3005         begin
  3012         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLAutoSound);
  3006         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3013         gdX.isNegative := not gdX.isNegative;
  3007         gdX.isNegative := not gdX.isNegative;
  3014         gdY.isNegative := not gdY.isNegative;
  3008         gdY.isNegative := not gdY.isNegative;
  3015         gdX:= gdX*_0_2;
  3009         gdX:= gdX*_0_2;
  3016         gdY:= gdY*_0_2;
  3010         gdY:= gdY*_0_2;
  3017 
  3011 
  3099                 Gear^.Pos := 3
  3093                 Gear^.Pos := 3
  3100             else
  3094             else
  3101                 Gear^.Pos := 2;
  3095                 Gear^.Pos := 2;
  3102             end;
  3096             end;
  3103 
  3097 
  3104         AmmoShove(Gear, 30, 40);
  3098         AmmoShove(Gear, Gear^.Boom, 40);
  3105 
  3099 
  3106         DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  3100         DrawTunnel(HHGear^.X - HHGear^.dX * 10,
  3107                     HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
  3101                     HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
  3108         HHGear^.dX,
  3102         HHGear^.dX,
  3109         HHGear^.dY,
  3103         HHGear^.dY,
  3113         upd := 0
  3107         upd := 0
  3114         end;
  3108         end;
  3115 
  3109 
  3116     if Gear^.Health < Gear^.Damage then
  3110     if Gear^.Health < Gear^.Damage then
  3117         begin
  3111         begin
  3118         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
  3112         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3119         if hasWishes then
  3113         if hasWishes then
  3120             for i:= 0 to 31 do
  3114             for i:= 0 to 31 do
  3121                 begin
  3115                 begin
  3122                 sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  3116                 sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
  3123                 if sparkles <> nil then
  3117                 if sparkles <> nil then
  3184 
  3178 
  3185     inc(Gear^.Tag);
  3179     inc(Gear^.Tag);
  3186     if Gear^.Tag < 2250 then
  3180     if Gear^.Tag < 2250 then
  3187         exit;
  3181         exit;
  3188 
  3182 
  3189     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, Gear^.Hedgehog, EXPLAutoSound);
  3183     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3190     AfterAttack;
  3184     AfterAttack;
  3191     DeleteGear(Gear)
  3185     DeleteGear(Gear)
  3192 end;
  3186 end;
  3193 
  3187 
  3194 procedure doStepCakeDown(Gear: PGear);
  3188 procedure doStepCakeDown(Gear: PGear);
  3508 // CheckLandValue returns true if the type isn't matched
  3502 // CheckLandValue returns true if the type isn't matched
  3509     or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then
  3503     or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then
  3510         begin
  3504         begin
  3511         //out of time or exited ground
  3505         //out of time or exited ground
  3512         StopSoundChan(Gear^.SoundChannel);
  3506         StopSoundChan(Gear^.SoundChannel);
  3513         if (Gear^.State and gsttmpFlag) <> 0 then
  3507         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3514             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound)
       
  3515         else
       
  3516             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
       
  3517         DeleteGear(Gear);
  3508         DeleteGear(Gear);
  3518         exit
  3509         exit
  3519         end
  3510         end
  3520 
  3511 
  3521     else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0) then
  3512     else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0) then
  3571             end
  3562             end
  3572 
  3563 
  3573         else if (t <> nil) then
  3564         else if (t <> nil) then
  3574             begin
  3565             begin
  3575             //explode right on contact with HH
  3566             //explode right on contact with HH
  3576             if (Gear^.State and gsttmpFlag) <> 0 then
  3567             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3577                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound)
       
  3578             else
       
  3579                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
       
  3580             DeleteGear(Gear);
  3568             DeleteGear(Gear);
  3581             exit;
  3569             exit;
  3582             end;
  3570             end;
  3583 
  3571 
  3584         Gear^.X:= Gear^.X+Gear^.dX*4;
  3572         Gear^.X:= Gear^.X+Gear^.dX*4;
  3594         begin
  3582         begin
  3595         if Gear^.Timer > 0 then
  3583         if Gear^.Timer > 0 then
  3596             dec(Gear^.Timer)
  3584             dec(Gear^.Timer)
  3597         else
  3585         else
  3598             begin
  3586             begin
  3599             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
  3587             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3600             DeleteGear(Gear);
  3588             DeleteGear(Gear);
  3601             end
  3589             end
  3602         end;
  3590         end;
  3603 end;
  3591 end;
  3604 
  3592 
  3762         StopSound(sndRideOfTheValkyries);
  3750         StopSound(sndRideOfTheValkyries);
  3763         ResumeMusic;
  3751         ResumeMusic;
  3764 
  3752 
  3765         if ((Gear^.State and gstCollision) <> 0) then
  3753         if ((Gear^.State and gstCollision) <> 0) then
  3766             begin
  3754             begin
  3767             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, Gear^.Hedgehog, EXPLAutoSound);
  3755             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3768             for i:= 0 to 15 do
  3756             for i:= 0 to 15 do
  3769                 begin
  3757                 begin
  3770                 dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1);
  3758                 dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1);
  3771                 dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1);
  3759                 dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1);
  3772                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  3760                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  4183     //    CheckGearDrowning(Gear); // already checked for in doStepFallingGear
  4171     //    CheckGearDrowning(Gear); // already checked for in doStepFallingGear
  4184     CalcRotationDirAngle(Gear);
  4172     CalcRotationDirAngle(Gear);
  4185 
  4173 
  4186     if (Gear^.State and gstCollision) <> 0 then
  4174     if (Gear^.State and gstCollision) <> 0 then
  4187         begin
  4175         begin
  4188         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0);
  4176         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0);
  4189         PlaySound(sndEggBreak);
  4177         PlaySound(sndEggBreak);
  4190         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  4178         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  4191         vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  4179         vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  4192         if vg <> nil then
  4180         if vg <> nil then
  4193             vg^.Frame := 2;
  4181             vg^.Frame := 2;
  4793             end;
  4781             end;
  4794         ResumeMusic
  4782         ResumeMusic
  4795         end
  4783         end
  4796     else if (Gear^.State and gstCollision) <> 0 then
  4784     else if (Gear^.State and gstCollision) <> 0 then
  4797         begin
  4785         begin
  4798         r0 := GetRandom(21);
  4786         r0 := GetRandom(Gear^.Boom div 4 + 1);
  4799         r1 := GetRandom(21);
  4787         r1 := GetRandom(Gear^.Boom div 4 + 1);
  4800         doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, 40 + r1, Gear^.Hedgehog, 0);
  4788         doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r1, Gear^.Hedgehog, 0);
  4801         doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, 40 + r0, Gear^.Hedgehog, 0);
  4789         doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r0, Gear^.Hedgehog, 0);
  4802         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, Gear^.Hedgehog, EXPLAutoSound);
  4790         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom + r0, Gear^.Hedgehog, EXPLAutoSound);
  4803         for r0:= 0 to 4 do
  4791         for r0:= 0 to 4 do
  4804             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
  4792             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
  4805         Gear^.dY := cGravity * 2 - odY;
  4793         Gear^.dY := cGravity * 2 - odY;
  4806         Gear^.Pos := Gear^.Pos + 1;
  4794         Gear^.Pos := Gear^.Pos + 1;
  4807         end
  4795         end
  4931                         begin
  4919                         begin
  4932                         DrawExplosion(rX,rY,Gear^.Radius);
  4920                         DrawExplosion(rX,rY,Gear^.Radius);
  4933                         end;
  4921                         end;
  4934 
  4922 
  4935                     // kick nearby hogs
  4923                     // kick nearby hogs
  4936                     AmmoShove(Gear, 35, 50);
  4924                     AmmoShove(Gear, Gear^.Boom, 50);
  4937 
  4925 
  4938                     dec(Gear^.Health, Gear^.Damage);
  4926                     dec(Gear^.Health, Gear^.Damage);
  4939 
  4927 
  4940                     // explode when impacting on solid land/borders
  4928                     // explode when impacting on solid land/borders
  4941                     if Gear^.Damage >= initHealth then
  4929                     if Gear^.Damage >= initHealth then
  5212     Gear^.X:= Gear^.X + Gear^.dX;
  5200     Gear^.X:= Gear^.X + Gear^.dX;
  5213     Gear^.Y:= Gear^.Y + Gear^.dY;
  5201     Gear^.Y:= Gear^.Y + Gear^.dY;
  5214     Gear^.dX := Gear^.dX + cWindSpeed / 4;
  5202     Gear^.dX := Gear^.dX + cWindSpeed / 4;
  5215     Gear^.dY := Gear^.dY + cGravity / 100;
  5203     Gear^.dY := Gear^.dY + cGravity / 100;
  5216     if (GameTicks and $FF) = 0 then
  5204     if (GameTicks and $FF) = 0 then
  5217         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned);
  5205         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned);
  5218     if Gear^.State and gstTmpFlag = 0 then
  5206     if Gear^.State and gstTmpFlag = 0 then
  5219         AllInactive:= false;
  5207         AllInactive:= false;
  5220 end;
  5208 end;
  5221 
  5209 
  5222 ////////////////////////////////////////////////////////////////////////////////
  5210 ////////////////////////////////////////////////////////////////////////////////
  5251                 begin
  5239                 begin
  5252                 // base damage on remaining health
  5240                 // base damage on remaining health
  5253                 dmg:= (tmp^.Health - tmp^.Damage);
  5241                 dmg:= (tmp^.Health - tmp^.Damage);
  5254                 if dmg > 0 then
  5242                 if dmg > 0 then
  5255                     begin
  5243                     begin
  5256                     // do 1/2 current hp worth of damage if extra damage is enabled (1/3 damage if not)
       
  5257                     if cDamageModifier > _1 then
       
  5258                         d:= 2
       
  5259                     else
       
  5260                         d:= 3;
       
  5261 
       
  5262                     // always rounding down
  5244                     // always rounding down
  5263                     dmg:= dmg div d;
  5245                     dmg:= dmg div Gear^.Boom;
  5264 
  5246 
  5265                     if dmg > 0 then
  5247                     if dmg > 0 then
  5266                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
  5248                         ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
  5267                     end;
  5249                     end;
       
  5250 		tmp^.dY:= _0_03 * Gear^.Boom
  5268                 end;
  5251                 end;
  5269 
  5252 
  5270             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
  5253             if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then
  5271                 begin
  5254                 begin
  5272                 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  5255                 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  5532     if (GameTicks and $3F) = 0 then
  5515     if (GameTicks and $3F) = 0 then
  5533         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
  5516         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
  5534     dec(Gear^.Timer)
  5517     dec(Gear^.Timer)
  5535 end;
  5518 end;
  5536 
  5519 
       
  5520 (*
  5537 ////////////////////////////////////////////////////////////////////////////////
  5521 ////////////////////////////////////////////////////////////////////////////////
  5538 procedure doStepStructure(Gear: PGear);
  5522 procedure doStepStructure(Gear: PGear);
  5539 var
  5523 var
  5540     x, y: LongInt;
  5524     x, y: LongInt;
  5541     HH: PHedgehog;
  5525     HH: PHedgehog;
  5623         DeleteGear(Gear);
  5607         DeleteGear(Gear);
  5624 
  5608 
  5625         doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound);
  5609         doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound);
  5626         end;
  5610         end;
  5627 end;
  5611 end;
       
  5612 *)
  5628 
  5613 
  5629 ////////////////////////////////////////////////////////////////////////////////
  5614 ////////////////////////////////////////////////////////////////////////////////
  5630 (*
  5615 (*
  5631  TARDIS needs
  5616  TARDIS needs
  5632  Warp in.  Pos = 1
  5617  Warp in.  Pos = 1
  6112         Gear^.dX:= _90-(GetRandomf*_360);
  6097         Gear^.dX:= _90-(GetRandomf*_360);
  6113         Gear^.dY:= _90-(GetRandomf*_360)
  6098         Gear^.dY:= _90-(GetRandomf*_360)
  6114         end;
  6099         end;
  6115     end
  6100     end
  6116 end;
  6101 end;
  6117 
  6102 (*
  6118 procedure doStepCreeper(Gear: PGear);
  6103 procedure doStepCreeper(Gear: PGear);
  6119 var hogs: PGearArrayS;
  6104 var hogs: PGearArrayS;
  6120     HHGear: PGear;
  6105     HHGear: PGear;
  6121     tdX: hwFloat;
  6106     tdX: hwFloat;
  6122     dir: LongInt;
  6107     dir: LongInt;
  6193             Gear^.State:= Gear^.State or gstMoving
  6178             Gear^.State:= Gear^.State or gstMoving
  6194             end
  6179             end
  6195         end;
  6180         end;
  6196     end;
  6181     end;
  6197 end;
  6182 end;
  6198 
  6183 *)
  6199 ////////////////////////////////////////////////////////////////////////////////
  6184 ////////////////////////////////////////////////////////////////////////////////
  6200 procedure doStepKnife(Gear: PGear);
  6185 procedure doStepKnife(Gear: PGear);
  6201 //var ox, oy: LongInt;
  6186 //var ox, oy: LongInt;
  6202 //    la: hwFloat;
  6187 //    la: hwFloat;
  6203 var   a: real;
  6188 var   a: real;
  6212     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  6197     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  6213         begin
  6198         begin
  6214         DeleteCI(Gear);
  6199         DeleteCI(Gear);
  6215         Gear^.Radius:= 7;
  6200         Gear^.Radius:= 7;
  6216         // used for damage and impact calc. needs balancing I think
  6201         // used for damage and impact calc. needs balancing I think
  6217         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  6202         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*Gear^.Boom/10000));
  6218         doStepFallingGear(Gear);
  6203         doStepFallingGear(Gear);
  6219         AllInactive := false;
  6204         AllInactive := false;
  6220         a:= Gear^.DirAngle;
  6205         a:= Gear^.DirAngle;
  6221         CalcRotationDirAngle(Gear);
  6206         CalcRotationDirAngle(Gear);
  6222         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  6207         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation