# HG changeset patch # User sheepluva # Date 1435101817 -7200 # Node ID 7faaef306837c539fa58a1573ab6e5cc7768bb19 # Parent cd7f918eed3070c2864616378edf3ef7381b9d77 fallback to Default voicepack if specified voicepack is not available diff -r cd7f918eed30 -r 7faaef306837 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Jun 16 10:08:07 2015 -0400 +++ b/hedgewars/uSound.pas Wed Jun 24 01:23:37 2015 +0200 @@ -70,7 +70,7 @@ // Returns sound channel of the looped sound. function LoopSound(snd: TSound): LongInt; function LoopSound(snd: TSound; fadems: LongInt): LongInt; -function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; // WTF? +function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; // Stops the normal/looped sound of the given type/in the given channel @@ -261,8 +261,9 @@ var i: Longword; locName, path: shortstring; begin -i:= 0; - // First, attempt to locate a localised version of the voice + i:= 0; + + // Adjust voicepack name if there's a localised version version of the voice if cLocale <> 'en' then begin locName:= name+'_'+cLocale; @@ -279,7 +280,16 @@ end end; - // If that fails, use the unmodified one + path:= cPathz[ptVoices] + '/' + name; + + // Fallback to Default if voicepack can't be found at all + if (name <> 'Default') and (not pfsExists(path)) then + begin + path:= cPathz[ptVoices] + '/Default'; + if pfsExists(path) then + exit(AskForVoicepack('Default')); + end; + while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do begin inc(i);