Add voice pack sound fallbacks also for sndOoff{2,3} and sndOw{2,4}
authorWuzzy <Wuzzy2@mail.ru>
Tue, 27 Mar 2018 23:01:22 +0200
changeset 13293 ee8c6eb0ab47
parent 13292 29055da6a6cd
child 13294 6927e51acaef
Add voice pack sound fallbacks also for sndOoff{2,3} and sndOw{2,4}
hedgewars/uSound.pas
--- a/hedgewars/uSound.pas	Tue Mar 27 22:45:31 2018 +0200
+++ b/hedgewars/uSound.pas	Tue Mar 27 23:01:22 2018 +0200
@@ -459,10 +459,15 @@
         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;
-            // Fallback to sndFirePunch1 if sndFirePunch{2,6} is missing
-            if (not pfsExists(s)) and (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
+            // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing
+            if (not pfsExists(s)) then
                 begin
-                snd := sndFirePunch1;
+                if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
+                    snd := sndFirePunch1
+                else if (snd in [sndOw2, sndOw3, sndOw4]) then
+                    snd := sndOw1
+                else if (snd in [sndOoff2, sndOoff3]) then
+                    snd := sndOoff1;
                 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
                 end;
             WriteToConsole(msgLoading + s + ' ');