hedgewars/uSound.pas
branchhedgeroid
changeset 5932 5164d17b6374
parent 5725 e27100a0e2d0
parent 5922 7e7774e7be8c
child 6224 42b256eca362
equal deleted inserted replaced
5828:667fb58d7f18 5932:5164d17b6374
   288 end;
   288 end;
   289 
   289 
   290 procedure AddVoice(snd: TSound; voicepack: PVoicepack);
   290 procedure AddVoice(snd: TSound; voicepack: PVoicepack);
   291 var i : LongInt;
   291 var i : LongInt;
   292 begin
   292 begin
   293     if (not isSoundEnabled) or fastUntilLag then exit;
   293     if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd = snd) and  (LastVoice.voicepack = voicepack)) then exit;
   294     i:= 0;
   294     i:= 0;
   295     while (i<8) and (VoiceList[i].snd <> sndNone) do inc(i);
   295     while (i<8) and (VoiceList[i].snd <> sndNone) do inc(i);
   296 
   296 
       
   297     // skip playing same sound for same hog twice
       
   298     if (i>0) and (VoiceList[i-1].snd = snd) and (VoiceList[i-1].voicepack = voicepack) then exit;
   297     VoiceList[i].snd:= snd;
   299     VoiceList[i].snd:= snd;
   298     VoiceList[i].voicepack:= voicepack;
   300     VoiceList[i].voicepack:= voicepack;
   299 end;
   301 end;
   300 
   302 
   301 procedure PlayNextVoice;
   303 procedure PlayNextVoice;