hedgewars/uSound.pas
changeset 10995 7faaef306837
parent 10510 9329dab04490
child 11046 47a8c19ecb60
--- 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);