don't stack bye/teleport sounds of hogs (when a team is gone)
authorsheepluva
Wed, 05 Mar 2014 12:38:01 +0100
changeset 10178 949b51ca18c6
parent 10176 ea022e9483c2
child 10179 26c4256a9e4b
don't stack bye/teleport sounds of hogs (when a team is gone)
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Wed Mar 05 00:53:08 2014 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Wed Mar 05 12:38:01 2014 +0100
@@ -606,6 +606,7 @@
 procedure doStepHedgehogGone(Gear: PGear);
 const frametime = 65;
       timertime = frametime * 11;
+var i: LongInt;
 begin
 if Gear^.Hedgehog^.Unplaced then
     exit;
@@ -628,8 +629,20 @@
     Gear^.Z:= cCurrHHZ;
     RemoveGearFromList(Gear);
     InsertGearToList(Gear);
-    PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
-    PlaySound(sndWarp);
+    // only play sound for one alive hedgehog
+    with Gear^.Hedgehog^.Team^ do
+        for i:= 0 to cMaxHHIndex do
+            begin
+            if (Hedgehogs[i].Gear <> nil) then
+                begin
+                if (Hedgehogs[i].Gear = Gear) then
+                    begin
+                    PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
+                    PlaySound(sndWarp);
+                    end;
+                break;
+                end;
+            end;
     Gear^.Pos:= 0;
     Gear^.Timer:= timertime
     end