59 defVoicepack: PVoicepack; |
59 defVoicepack: PVoicepack; |
60 Mus: PMixMusic = nil; |
60 Mus: PMixMusic = nil; |
61 |
61 |
62 function AskForVoicepack(name: shortstring): Pointer; |
62 function AskForVoicepack(name: shortstring): Pointer; |
63 var i: Longword; |
63 var i: Longword; |
|
64 locName, path: shortstring; |
64 begin |
65 begin |
65 i:= 0; |
66 i:= 0; |
|
67 // First, attempt to locate a localised version of the voice |
|
68 if cLocale <> 'en' then |
|
69 begin |
|
70 locName:= name+'_'+cLocale; |
|
71 path:= Pathz[ptVoices] + '/' + locName; |
|
72 if DirectoryExists(path) then name:= locName |
|
73 else if Length(cLocale) > 2 then |
|
74 begin |
|
75 locName:= name+'_'+Copy(cLocale,1,2); |
|
76 path:= Pathz[ptVoices] + '/' + locName; |
|
77 if DirectoryExists(path) then name:= locName |
|
78 end |
|
79 end; |
|
80 |
|
81 // If that fails, use the unmodified one |
66 while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do |
82 while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do |
67 begin |
83 begin |
68 inc(i); |
84 inc(i); |
69 TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true) |
85 TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true) |
70 end; |
86 end; |
71 |
87 |
72 voicepacks[i].name:= name; |
88 voicepacks[i].name:= name; |
73 AskForVoicepack:= @voicepacks[i] |
89 AskForVoicepack:= @voicepacks[i] |
74 end; |
90 end; |
75 |
91 |