hedgewars/uSound.pas
branchhedgeroid
changeset 5932 5164d17b6374
parent 5725 e27100a0e2d0
parent 5922 7e7774e7be8c
child 6224 42b256eca362
--- a/hedgewars/uSound.pas	Fri Sep 16 17:36:05 2011 +0200
+++ b/hedgewars/uSound.pas	Fri Sep 16 18:17:16 2011 +0200
@@ -290,10 +290,12 @@
 procedure AddVoice(snd: TSound; voicepack: PVoicepack);
 var i : LongInt;
 begin
-    if (not isSoundEnabled) or fastUntilLag then exit;
+    if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd = snd) and  (LastVoice.voicepack = voicepack)) then exit;
     i:= 0;
     while (i<8) and (VoiceList[i].snd <> sndNone) do inc(i);
 
+    // skip playing same sound for same hog twice
+    if (i>0) and (VoiceList[i-1].snd = snd) and (VoiceList[i-1].voicepack = voicepack) then exit;
     VoiceList[i].snd:= snd;
     VoiceList[i].voicepack:= voicepack;
 end;