hedgewars/uSound.pas
branch0.9.17
changeset 6360 eca20f8990e2
parent 6072 e3dc802965d6
child 6362 ceacd1b61833
equal deleted inserted replaced
6359:37bb74f0dae9 6360:eca20f8990e2
   285 
   285 
   286 procedure AddVoice(snd: TSound; voicepack: PVoicepack);
   286 procedure AddVoice(snd: TSound; voicepack: PVoicepack);
   287 var i : LongInt;
   287 var i : LongInt;
   288 begin
   288 begin
   289     if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd = snd) and  (LastVoice.voicepack = voicepack)) then exit;
   289     if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd = snd) and  (LastVoice.voicepack = voicepack)) then exit;
       
   290     if (snd = sndVictory) or (snd = sndFlawless) then
       
   291         begin
       
   292         for i:= 1 to Succ(chanTPU) do StopSound(i);
       
   293         for i:= 0 to 7 do VoiceList[i].snd:= sndNone;
       
   294         LastVoice.snd:= sndNone;
       
   295         end;
       
   296 
   290     i:= 0;
   297     i:= 0;
   291     while (i<8) and (VoiceList[i].snd <> sndNone) do inc(i);
   298     while (i<8) and (VoiceList[i].snd <> sndNone) do inc(i);
   292 
   299 
   293     // skip playing same sound for same hog twice
   300     // skip playing same sound for same hog twice
   294     if (i>0) and (VoiceList[i-1].snd = snd) and (VoiceList[i-1].voicepack = voicepack) then exit;
   301     if (i>0) and (VoiceList[i-1].snd = snd) and (VoiceList[i-1].voicepack = voicepack) then exit;