# HG changeset patch # User unC0Rr # Date 1567000776 -7200 # Node ID f3ad47f4f245259dfc3f86522dfda62005df2597 # Parent 5e2b9740086f334388a8b2a03bb3e3170552881e Prevent loading already loaded sounds diff -r 5e2b9740086f -r f3ad47f4f245 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Wed Aug 28 13:20:10 2019 +0300 +++ b/hedgewars/uSound.pas Wed Aug 28 15:59:36 2019 +0200 @@ -574,7 +574,7 @@ function PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask, soundAsMusic: boolean): boolean; var s: shortstring; -tempSnd: TSound; +tempSnd, loadSnd: TSound; rwops: PSDL_RWops; begin PlaySoundV:= false; @@ -591,24 +591,26 @@ begin if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then begin - s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; + loadSnd:= snd; + s:= cPathz[Soundz[loadSnd].Path] + '/' + voicepack^.name + '/' + Soundz[loadSnd].FileName; + // Fallback taunts if (not pfsExists(s)) then begin tempSnd := GetFallbackV(snd); if tempSnd <> sndNone then begin - snd := tempSnd; - LastVoice.snd := tempSnd; + loadSnd := tempSnd; + //LastVoice.snd := tempSnd; end; - s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; + s:= cPathz[Soundz[loadSnd].Path] + '/' + voicepack^.name + '/' + Soundz[loadSnd].FileName; end; - WriteToConsole(msgLoading + s + ' '); + WriteToConsole(msgLoading + s + ' ... '); rwops := rwopsOpenRead(s); if rwops = nil then begin - s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName; + s:= cPathz[Soundz[loadSnd].AltPath] + '/' + Soundz[loadSnd].FileName; WriteToConsole(msgLoading + s + ' ... '); rwops := rwopsOpenRead(s); end; @@ -627,7 +629,7 @@ if (defVoicepack^.chunks[snd] = nil) and (Soundz[snd].Path <> ptVoices) and (Soundz[snd].FileName <> '') then begin s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; - WriteToConsole(msgLoading + s + ' '); + WriteToConsole(msgLoading + s + ' ... '); rwops := rwopsOpenRead(s); if rwops = nil then