hedgewars/GSHandlers.inc
changeset 4824 efbc8f80acac
parent 4808 7c3e5b52344a
child 4837 2ea0a152c319
equal deleted inserted replaced
4823:8789a8f6c016 4824:efbc8f80acac
   213         //if _0_6 < Gear^.dY then
   213         //if _0_6 < Gear^.dY then
   214         //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
   214         //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
   215         //else
   215         //else
   216         //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
   216         //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
   217 
   217 
   218         ApplyDamage(Gear, dmg, dsFall);
   218         ApplyDamage(Gear, CurrentHedgehog^.Gear, dmg, dsFall);
   219     end
   219     end
   220 end;
   220 end;
   221 
   221 
   222 ////////////////////////////////////////////////////////////////////////////////
   222 ////////////////////////////////////////////////////////////////////////////////
   223 ////////////////////////////////////////////////////////////////////////////////
   223 ////////////////////////////////////////////////////////////////////////////////
   373 
   373 
   374     if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
   374     if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
   375     begin
   375     begin
   376         CheckCollision(Gear);
   376         CheckCollision(Gear);
   377         if (Gear^.State and gstCollision) <> 0 then
   377         if (Gear^.State and gstCollision) <> 0 then
   378             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLDontDraw or EXPLNoGfx);
   378             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear, EXPLDontDraw or EXPLNoGfx);
   379     end;
   379     end;
   380 
   380 
   381     if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
   381     if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
   382     begin
   382     begin
   383         vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
   383         vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
   386     end;
   386     end;
   387 
   387 
   388     if Gear^.Timer = 0 then
   388     if Gear^.Timer = 0 then
   389     begin
   389     begin
   390         case Gear^.Kind of 
   390         case Gear^.Kind of 
   391             gtBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
   391             gtBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
   392             gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound);
   392             gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, Gear, EXPLAutoSound);
   393             gtClusterBomb: 
   393             gtClusterBomb: 
   394                 begin
   394                 begin
   395                     x := hwRound(Gear^.X);
   395                     x := hwRound(Gear^.X);
   396                     y := hwRound(Gear^.Y);
   396                     y := hwRound(Gear^.Y);
   397                     doMakeExplosion(x, y, 20, EXPLAutoSound);
   397                     doMakeExplosion(x, y, 20, Gear, EXPLAutoSound);
   398                     for i:= 0 to 4 do
   398                     for i:= 0 to 4 do
   399                         begin
   399                         begin
   400                         dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5;
   400                         dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5;
   401                         dY := (GetRandom - _3) * _0_08;
   401                         dY := (GetRandom - _3) * _0_08;
   402                         AddGear(x, y, gtCluster, 0, dX, dY, 25);
   402                         AddGear(x, y, gtCluster, 0, dX, dY, 25);
   404                 end;
   404                 end;
   405             gtWatermelon: 
   405             gtWatermelon: 
   406                 begin
   406                 begin
   407                 x := hwRound(Gear^.X);
   407                 x := hwRound(Gear^.X);
   408                 y := hwRound(Gear^.Y);
   408                 y := hwRound(Gear^.Y);
   409                 doMakeExplosion(x, y, 75, EXPLAutoSound);
   409                 doMakeExplosion(x, y, 75, Gear, EXPLAutoSound);
   410                 for i:= 0 to 5 do
   410                 for i:= 0 to 5 do
   411                     begin
   411                     begin
   412                     dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5;
   412                     dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5;
   413                     dY := (GetRandom - _1_5) * _0_3;
   413                     dY := (GetRandom - _1_5) * _0_3;
   414                     AddGear(x, y, gtMelonPiece, 0, dX, dY, 75)^.DirAngle := i * 60;
   414                     AddGear(x, y, gtMelonPiece, 0, dX, dY, 75)^.DirAngle := i * 60;
   416                 end;
   416                 end;
   417             gtHellishBomb: 
   417             gtHellishBomb: 
   418                 begin
   418                 begin
   419                 x := hwRound(Gear^.X);
   419                 x := hwRound(Gear^.X);
   420                 y := hwRound(Gear^.Y);
   420                 y := hwRound(Gear^.Y);
   421                 doMakeExplosion(x, y, 90, EXPLAutoSound);
   421                 doMakeExplosion(x, y, 90, Gear, EXPLAutoSound);
   422 
   422 
   423                 for i:= 0 to 127 do
   423                 for i:= 0 to 127 do
   424                     begin
   424                     begin
   425                     dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1);
   425                     dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1);
   426                     dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1);
   426                     dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1);
   430                     if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag;
   430                     if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag;
   431                     end
   431                     end
   432                 end;
   432                 end;
   433             gtGasBomb:
   433             gtGasBomb:
   434                 begin
   434                 begin
   435                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
   435                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear, EXPLAutoSound);
   436                 for i:= 0 to 2 do
   436                 for i:= 0 to 2 do
   437                     begin
   437                     begin
   438                     x:= GetRandom(60);
   438                     x:= GetRandom(60);
   439                     y:= GetRandom(40);
   439                     y:= GetRandom(40);
   440                     AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
   440                     AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
   507 begin
   507 begin
   508     AllInactive := false;
   508     AllInactive := false;
   509     doStepFallingGear(Gear);
   509     doStepFallingGear(Gear);
   510     if (Gear^.State and gstCollision) <> 0 then
   510     if (Gear^.State and gstCollision) <> 0 then
   511     begin
   511     begin
   512         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound);
   512         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, Gear, EXPLAutoSound);
   513         DeleteGear(Gear);
   513         DeleteGear(Gear);
   514         exit
   514         exit
   515     end;
   515     end;
   516 
   516 
   517     if (Gear^.Kind = gtMelonPiece) or (Gear^.Kind = gtBall) then
   517     if (Gear^.Kind = gtMelonPiece) or (Gear^.Kind = gtBall) then
   526     AllInactive := false;
   526     AllInactive := false;
   527     if (GameFlags and gfMoreWind) = 0 then Gear^.dX := Gear^.dX + cWindSpeed;
   527     if (GameFlags and gfMoreWind) = 0 then Gear^.dX := Gear^.dX + cWindSpeed;
   528     doStepFallingGear(Gear);
   528     doStepFallingGear(Gear);
   529     if (Gear^.State and gstCollision) <> 0 then
   529     if (Gear^.State and gstCollision) <> 0 then
   530         begin
   530         begin
   531         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
   531         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
   532         DeleteGear(Gear);
   532         DeleteGear(Gear);
   533         exit
   533         exit
   534         end;
   534         end;
   535     if (GameTicks and $3F) = 0 then
   535     if (GameTicks and $3F) = 0 then
   536         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   536         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
   764     CheckCollision(Gear);
   764     CheckCollision(Gear);
   765     dec(Gear^.Timer);
   765     dec(Gear^.Timer);
   766     if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then
   766     if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then
   767     begin
   767     begin
   768         StopSound(Gear^.SoundChannel);
   768         StopSound(Gear^.SoundChannel);
   769         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
   769         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
   770         DeleteGear(Gear);
   770         DeleteGear(Gear);
   771     end;
   771     end;
   772 end;
   772 end;
   773 
   773 
   774 procedure doStepBee(Gear: PGear);
   774 procedure doStepBee(Gear: PGear);
   778     Gear^.Y := Gear^.Y + Gear^.dY;
   778     Gear^.Y := Gear^.Y + Gear^.dY;
   779     Gear^.dY := Gear^.dY + cGravity;
   779     Gear^.dY := Gear^.dY + cGravity;
   780     CheckCollision(Gear);
   780     CheckCollision(Gear);
   781     if (Gear^.State and gstCollision) <> 0 then
   781     if (Gear^.State and gstCollision) <> 0 then
   782     begin
   782     begin
   783         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
   783         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
   784         DeleteGear(Gear);
   784         DeleteGear(Gear);
   785         exit
   785         exit
   786     end;
   786     end;
   787     dec(Gear^.Timer);
   787     dec(Gear^.Timer);
   788     if Gear^.Timer = 0 then
   788     if Gear^.Timer = 0 then
  1081     x:= hwRound(Gear^.X);
  1081     x:= hwRound(Gear^.X);
  1082     y:= hwRound(Gear^.Y);
  1082     y:= hwRound(Gear^.Y);
  1083     if (Gear^.Timer mod 33) = 0 then
  1083     if (Gear^.Timer mod 33) = 0 then
  1084         begin
  1084         begin
  1085         HHGear^.State := HHGear^.State or gstNoDamage;
  1085         HHGear^.State := HHGear^.State or gstNoDamage;
  1086         doMakeExplosion(x, y + 7, 6, EXPLDontDraw);
  1086         doMakeExplosion(x, y + 7, 6, Gear, EXPLDontDraw);
  1087         HHGear^.State := HHGear^.State and not gstNoDamage
  1087         HHGear^.State := HHGear^.State and not gstNoDamage
  1088         end;
  1088         end;
  1089 
  1089 
  1090     if (Gear^.Timer mod 47) = 0 then
  1090     if (Gear^.Timer mod 47) = 0 then
  1091         begin
  1091         begin
  1708                 begin
  1708                 begin
  1709                 if ((Gear^.State and gstWait) <> 0) or
  1709                 if ((Gear^.State and gstWait) <> 0) or
  1710                    (cMineDudPercent = 0) or
  1710                    (cMineDudPercent = 0) or
  1711                    (getRandom(100) > cMineDudPercent) then
  1711                    (getRandom(100) > cMineDudPercent) then
  1712                     begin
  1712                     begin
  1713                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  1713                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
  1714                     DeleteGear(Gear)
  1714                     DeleteGear(Gear)
  1715                     end
  1715                     end
  1716                 else
  1716                 else
  1717                     begin
  1717                     begin
  1718                     AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4),
  1718                     AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4),
  1759     begin
  1759     begin
  1760         AllInactive := false;
  1760         AllInactive := false;
  1761         if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
  1761         if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
  1762         if Gear^.Timer = 0 then
  1762         if Gear^.Timer = 0 then
  1763         begin
  1763         begin
  1764             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
  1764             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear, EXPLAutoSound);
  1765             DeleteGear(Gear);
  1765             DeleteGear(Gear);
  1766             exit
  1766             exit
  1767         end;
  1767         end;
  1768         dec(Gear^.Timer);
  1768         dec(Gear^.Timer);
  1769     end
  1769     end
  1779     if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag);
  1779     if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag);
  1780     if Gear^.Timer = 1000 then // might need better timing
  1780     if Gear^.Timer = 1000 then // might need better timing
  1781         makeHogsWorry(Gear^.X, Gear^.Y, 75);
  1781         makeHogsWorry(Gear^.X, Gear^.Y, 75);
  1782     if Gear^.Timer = 0 then
  1782     if Gear^.Timer = 0 then
  1783     begin
  1783     begin
  1784         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound);
  1784         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, Gear, EXPLAutoSound);
  1785         DeleteGear(Gear);
  1785         DeleteGear(Gear);
  1786         exit
  1786         exit
  1787     end;
  1787     end;
  1788     dec(Gear^.Timer);
  1788     dec(Gear^.Timer);
  1789 end;
  1789 end;
  1913         DeleteGear(Gear);
  1913         DeleteGear(Gear);
  1914         // <-- delete gear!
  1914         // <-- delete gear!
  1915 
  1915 
  1916         if k = gtCase then
  1916         if k = gtCase then
  1917         begin
  1917         begin
  1918             doMakeExplosion(x, y, 25, EXPLAutoSound);
  1918             doMakeExplosion(x, y, 25, Gear, EXPLAutoSound);
  1919             for i:= 0 to 63 do
  1919             for i:= 0 to 63 do
  1920                 AddGear(x, y, gtFlame, 0, _0, _0, 0);
  1920                 AddGear(x, y, gtFlame, 0, _0, _0, 0);
  1921         end
  1921         end
  1922         else if k = gtExplosives then
  1922         else if k = gtExplosives then
  1923             begin
  1923             begin
  1924                 doMakeExplosion(x, y, 75, EXPLAutoSound);
  1924                 doMakeExplosion(x, y, 75, Gear, EXPLAutoSound);
  1925                 for i:= 0 to 31 do
  1925                 for i:= 0 to 31 do
  1926                 begin
  1926                 begin
  1927                     dX := AngleCos(i * 64) * _0_5 * (getrandom + _1);
  1927                     dX := AngleCos(i * 64) * _0_5 * (getrandom + _1);
  1928                     dY := AngleSin(i * 64) * _0_5 * (getrandom + _1);
  1928                     dY := AngleSin(i * 64) * _0_5 * (getrandom + _1);
  1929                     AddGear(x, y, gtFlame, 0, dX, dY, 0);
  1929                     AddGear(x, y, gtFlame, 0, dX, dY, 0);
  2104                     begin
  2104                     begin
  2105                     Gear^.Radius := 7;
  2105                     Gear^.Radius := 7;
  2106                     AmmoShove(Gear, 4, 150);
  2106                     AmmoShove(Gear, 4, 150);
  2107                     Gear^.Radius := 1;
  2107                     Gear^.Radius := 1;
  2108                     end
  2108                     end
  2109                 else if ((GameTicks and $3) = 3) then doMakeExplosion(gX, gY, 6, 0);//, EXPLNoDamage); 
  2109                 else if ((GameTicks and $3) = 3) then doMakeExplosion(gX, gY, 6, Gear, 0);//, EXPLNoDamage); 
  2110                 //DrawExplosion(gX, gY, 4);
  2110                 //DrawExplosion(gX, gY, 4);
  2111                 if ((GameTicks and $7) = 0) and (Random(2) = 0) then
  2111                 if ((GameTicks and $7) = 0) and (Random(2) = 0) then
  2112                     for i:= 1 to Random(2)+1 do
  2112                     for i:= 1 to Random(2)+1 do
  2113                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2113                         AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
  2114                 if Gear^.Health > 0 then dec(Gear^.Health);
  2114                 if Gear^.Health > 0 then dec(Gear^.Health);
  2345 begin
  2345 begin
  2346     AllInactive := false;
  2346     AllInactive := false;
  2347     doStepFallingGear(Gear);
  2347     doStepFallingGear(Gear);
  2348     if (Gear^.State and gstCollision) <> 0 then
  2348     if (Gear^.State and gstCollision) <> 0 then
  2349     begin
  2349     begin
  2350         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
  2350         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear, EXPLAutoSound);
  2351         DeleteGear(Gear);
  2351         DeleteGear(Gear);
  2352         performRumble();
  2352         performRumble();
  2353         exit
  2353         exit
  2354     end;
  2354     end;
  2355     if (GameTicks and $3F) = 0 then
  2355     if (GameTicks and $3F) = 0 then
  2544     dyn := Gear^.dY.isNegative;
  2544     dyn := Gear^.dY.isNegative;
  2545 
  2545 
  2546     doStepFallingGear(Gear);
  2546     doStepFallingGear(Gear);
  2547     if (Gear^.State and gstCollision) <> 0 then
  2547     if (Gear^.State and gstCollision) <> 0 then
  2548     begin
  2548     begin
  2549         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
  2549         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear, EXPLAutoSound);
  2550 
  2550 
  2551         Gear^.dX.isNegative := not dxn;
  2551         Gear^.dX.isNegative := not dxn;
  2552         Gear^.dY.isNegative := not dyn;
  2552         Gear^.dY.isNegative := not dyn;
  2553         for i:= 0 to 4 do
  2553         for i:= 0 to 4 do
  2554         begin
  2554         begin
  2614         upd := 0
  2614         upd := 0
  2615     end;
  2615     end;
  2616 
  2616 
  2617     if Gear^.Health < Gear^.Damage then
  2617     if Gear^.Health < Gear^.Damage then
  2618     begin
  2618     begin
  2619         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
  2619         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear, EXPLAutoSound);
  2620         AfterAttack;
  2620         AfterAttack;
  2621         DeleteGear(Gear);
  2621         DeleteGear(Gear);
  2622         DeleteGear(HHGear);
  2622         DeleteGear(HHGear);
  2623     end
  2623     end
  2624     else
  2624     else
  2674     AllInactive := false;
  2674     AllInactive := false;
  2675 
  2675 
  2676     inc(Gear^.Tag);
  2676     inc(Gear^.Tag);
  2677     if Gear^.Tag < 2250 then exit;
  2677     if Gear^.Tag < 2250 then exit;
  2678 
  2678 
  2679     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, EXPLAutoSound);
  2679     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, Gear, EXPLAutoSound);
  2680     AfterAttack;
  2680     AfterAttack;
  2681     DeleteGear(Gear)
  2681     DeleteGear(Gear)
  2682 end;
  2682 end;
  2683 
  2683 
  2684 procedure doStepCakeDown(Gear: PGear);
  2684 procedure doStepCakeDown(Gear: PGear);
  2967        or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then
  2967        or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then
  2968         begin
  2968         begin
  2969         //out of time or exited ground
  2969         //out of time or exited ground
  2970         StopSound(Gear^.SoundChannel);
  2970         StopSound(Gear^.SoundChannel);
  2971         if (Gear^.State and gsttmpFlag) <> 0 then
  2971         if (Gear^.State and gsttmpFlag) <> 0 then
  2972             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound)
  2972             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear, EXPLAutoSound)
  2973         else
  2973         else
  2974             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  2974             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
  2975         DeleteGear(Gear);
  2975         DeleteGear(Gear);
  2976         exit
  2976         exit
  2977         end
  2977         end
  2978     else if not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then
  2978     else if not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then
  2979         begin
  2979         begin
  3019         end
  3019         end
  3020         else
  3020         else
  3021         begin
  3021         begin
  3022             //explode right on contact with HH
  3022             //explode right on contact with HH
  3023             if (Gear^.State and gsttmpFlag) <> 0 then
  3023             if (Gear^.State and gsttmpFlag) <> 0 then
  3024                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound)
  3024                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear, EXPLAutoSound)
  3025             else
  3025             else
  3026                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
  3026                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear, EXPLAutoSound);
  3027             DeleteGear(Gear);
  3027             DeleteGear(Gear);
  3028             exit;
  3028             exit;
  3029         end;
  3029         end;
  3030 
  3030 
  3031         Gear^.SoundChannel := LoopSound(sndDrillRocket);
  3031         Gear^.SoundChannel := LoopSound(sndDrillRocket);
  3168         StopSound(sndRideOfTheValkyries);
  3168         StopSound(sndRideOfTheValkyries);
  3169         ResumeMusic;
  3169         ResumeMusic;
  3170 
  3170 
  3171         if ((Gear^.State and gstCollision) <> 0) then
  3171         if ((Gear^.State and gstCollision) <> 0) then
  3172         begin
  3172         begin
  3173             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
  3173             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, Gear, EXPLAutoSound);
  3174             for i:= 0 to 32 do
  3174             for i:= 0 to 32 do
  3175             begin
  3175             begin
  3176                 dX := AngleCos(i * 64) * _0_5 * (GetRandom + _1);
  3176                 dX := AngleCos(i * 64) * _0_5 * (GetRandom + _1);
  3177                 dY := AngleSin(i * 64) * _0_5 * (GetRandom + _1);
  3177                 dY := AngleSin(i * 64) * _0_5 * (GetRandom + _1);
  3178                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  3178                 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0);
  3543     //    CheckGearDrowning(Gear); // already checked for in doStepFallingGear
  3543     //    CheckGearDrowning(Gear); // already checked for in doStepFallingGear
  3544     CalcRotationDirAngle(Gear);
  3544     CalcRotationDirAngle(Gear);
  3545 
  3545 
  3546     if (Gear^.State and gstCollision) <> 0 then
  3546     if (Gear^.State and gstCollision) <> 0 then
  3547     begin
  3547     begin
  3548         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned, $C0E0FFE0);
  3548         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear, EXPLPoisoned, $C0E0FFE0);
  3549         PlaySound(sndEggBreak);
  3549         PlaySound(sndEggBreak);
  3550         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  3550         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  3551         vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  3551         vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
  3552         if vg <> nil then vg^.Frame := 2;
  3552         if vg <> nil then vg^.Frame := 2;
  3553 
  3553 
  4049     end
  4049     end
  4050     else if (Gear^.State and gstCollision) <> 0 then
  4050     else if (Gear^.State and gstCollision) <> 0 then
  4051         begin
  4051         begin
  4052             r0 := GetRandom(21);
  4052             r0 := GetRandom(21);
  4053             r1 := GetRandom(21);
  4053             r1 := GetRandom(21);
  4054             doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, 40 + r1, 0);
  4054             doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, 40 + r1, Gear, 0);
  4055             doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, 40 + r0, 0);
  4055             doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, 40 + r0, Gear, 0);
  4056             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, EXPLAutoSound);
  4056             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, Gear, EXPLAutoSound);
  4057             for r0:= 0 to 4 do
  4057             for r0:= 0 to 4 do
  4058                 AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
  4058                 AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
  4059             Gear^.dY := odY * -1 + cGravity * 2;
  4059             Gear^.dY := odY * -1 + cGravity * 2;
  4060             Gear^.Pos := Gear^.Pos + 1;
  4060             Gear^.Pos := Gear^.Pos + 1;
  4061         end
  4061         end
  4292     Gear^.X:= Gear^.X + Gear^.dX;
  4292     Gear^.X:= Gear^.X + Gear^.dX;
  4293     Gear^.Y:= Gear^.Y + Gear^.dY;
  4293     Gear^.Y:= Gear^.Y + Gear^.dY;
  4294     Gear^.dX := Gear^.dX + cWindSpeed / 4;
  4294     Gear^.dX := Gear^.dX + cWindSpeed / 4;
  4295     Gear^.dY := Gear^.dY + cGravity / 100;
  4295     Gear^.dY := Gear^.dY + cGravity / 100;
  4296     if (GameTicks mod 250) = 0 then
  4296     if (GameTicks mod 250) = 0 then
  4297         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned);
  4297         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned);
  4298     AllInactive:= false;
  4298     AllInactive:= false;
  4299 end;
  4299 end;
  4300 
  4300 
  4301 ////////////////////////////////////////////////////////////////////////////////
  4301 ////////////////////////////////////////////////////////////////////////////////
  4302 procedure doStepHammer(Gear: PGear);
  4302 procedure doStepHammer(Gear: PGear);
  4320     tmp:= t^.ar[i];
  4320     tmp:= t^.ar[i];
  4321     if (tmp^.State and gstNoDamage) = 0 then
  4321     if (tmp^.State and gstNoDamage) = 0 then
  4322         if (tmp^.Kind = gtHedgehog) then
  4322         if (tmp^.Kind = gtHedgehog) then
  4323             begin
  4323             begin
  4324             //tmp^.State:= tmp^.State or gstFlatened;
  4324             //tmp^.State:= tmp^.State or gstFlatened;
  4325             ApplyDamage(tmp, tmp^.Health div 3, dsUnknown);
  4325             ApplyDamage(tmp, CurrentHedgehog^.Gear, tmp^.Health div 3, dsUnknown);
  4326             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4326             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
  4327             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4327             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
  4328             tmp2^.Hedgehog:= tmp^.Hedgehog;
  4328             tmp2^.Hedgehog:= tmp^.Hedgehog;
  4329             SetAllToActive
  4329             SetAllToActive
  4330             end
  4330             end
  4543 begin
  4543 begin
  4544     AllInactive := false;
  4544     AllInactive := false;
  4545     doStepFallingGear(Gear);
  4545     doStepFallingGear(Gear);
  4546     if (Gear^.Timer > 0) and ((Gear^.State and gstCollision) <> 0) then
  4546     if (Gear^.Timer > 0) and ((Gear^.State and gstCollision) <> 0) then
  4547     begin
  4547     begin
  4548         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLAutoSound);
  4548         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear, EXPLAutoSound);
  4549         gX := hwRound(Gear^.X);
  4549         gX := hwRound(Gear^.X);
  4550         gY := hwRound(Gear^.Y); 
  4550         gY := hwRound(Gear^.Y); 
  4551         for i:= 0 to 10 do
  4551         for i:= 0 to 10 do
  4552         begin
  4552         begin
  4553             dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1);
  4553             dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1);
  4560         DeleteGear(Gear);
  4560         DeleteGear(Gear);
  4561         exit
  4561         exit
  4562     end;
  4562     end;
  4563     if (Gear^.Timer = 0) then
  4563     if (Gear^.Timer = 0) then
  4564     begin
  4564     begin
  4565         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLAutoSound);
  4565         doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear, EXPLAutoSound);
  4566         for i:= -19 to 19 do
  4566         for i:= -19 to 19 do
  4567            FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0);
  4567            FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0);
  4568         DeleteGear(Gear);
  4568         DeleteGear(Gear);
  4569         exit
  4569         exit
  4570     end;
  4570     end;