make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
authornemo
Sun, 27 Feb 2011 12:56:36 -0500
changeset 4966 fa612a614317
parent 4964 b3fa88210570
child 4967 5d6443a7ec03
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
hedgewars/GSHandlers.inc
hedgewars/uSound.pas
--- a/hedgewars/GSHandlers.inc	Sun Feb 27 20:15:48 2011 +0300
+++ b/hedgewars/GSHandlers.inc	Sun Feb 27 12:56:36 2011 -0500
@@ -1692,6 +1692,27 @@
     else
         if ((GameTicks and $3F) = 25) then
             doStepFallingGear(Gear);
+    if (Gear^.Health = 0) then
+        begin
+            if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and TestCollisionYwithGear(Gear, 1) then
+                inc(Gear^.Damage, hwRound(Gear^.dY * _70))
+            else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then
+                 inc(Gear^.Damage, hwRound(Gear^.dX * _70))
+            else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and TestCollisionYwithGear(Gear, -1) then
+                 inc(Gear^.Damage, hwRound(Gear^.dY * -_70))
+            else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
+                 inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
+        
+        if (Gear^.Damage > random(10)) and ((GameTicks and $FF) = 0) then
+            AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y), vgtSmoke);
+
+        if (Gear^.Damage > 35) then
+            begin
+            doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
+            DeleteGear(Gear);
+            exit
+            end
+        end;
 
     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
         if ((Gear^.State and gstAttacking) = 0) then
@@ -1719,6 +1740,8 @@
                     vgtSmoke);
                     PlaySound(sndVaporize);
                     Gear^.Health := 0;
+                    Gear^.Damage := 0;
+AddFileLog('initial mine damage:'+IntToStr(Gear^.Damage));
                     end;
                 exit
                 end;
--- a/hedgewars/uSound.pas	Sun Feb 27 20:15:48 2011 +0300
+++ b/hedgewars/uSound.pas	Sun Feb 27 12:56:36 2011 -0500
@@ -44,6 +44,7 @@
 procedure ChangeMusic;
 procedure StopSound(snd: TSound);
 procedure StopSound(chn: LongInt);
+procedure StopSound(chn, fadems: LongInt);
 function  ChangeVolume(voldelta: LongInt): LongInt;
 function  AskForVoicepack(name: shortstring): Pointer;