334 ); |
334 ); |
335 |
335 |
336 |
336 |
337 function AskForVoicepack(name: shortstring): Pointer; |
337 function AskForVoicepack(name: shortstring): Pointer; |
338 var i: Longword; |
338 var i: Longword; |
339 langName, path: shortstring; |
339 tmp, langName, path: shortstring; |
340 begin |
340 begin |
341 i:= 0; |
341 i:= 0; |
342 |
342 |
343 // Adjust voicepack name if there's a localised version version of the voice |
343 { Adjust for language suffix: Voicepacks can have an optional language suffix. |
344 if cLanguage <> 'en' then |
344 It's an underscore followed by an ISO 639-1 or ISO 639-2 language code. |
|
345 The suffix “_qau” is special, it will enable automatic language selection |
|
346 of this voicepack. For example, if team has set Default_qau as voicepack, |
|
347 and the player language is Russian, the actual voicepack will be Default_ru, |
|
348 provided it can be found on the disk. |
|
349 “qau” is a valid ISO 639-2 language code reserved for local use. } |
|
350 tmp:= Copy(name, Length(name) - 3, 4); |
|
351 if (tmp = '_qau') then |
|
352 name:= Copy(name, 1, Length(name) - 4); |
|
353 if (cLanguage <> 'en') and (tmp = '_qau') then |
345 begin |
354 begin |
346 langName:= name+'_'+cLanguage; |
355 langName:= name+'_'+cLanguage; |
347 path:= cPathz[ptVoices] + '/' + langName; |
356 path:= cPathz[ptVoices] + '/' + langName; |
348 if pfsExists(path) then |
357 if pfsExists(path) then |
349 name:= langName |
358 name:= langName |
1027 Mus:= nil; |
1036 Mus:= nil; |
1028 isAudioMuted:= false; |
1037 isAudioMuted:= false; |
1029 isSEBackup:= isSoundEnabled; |
1038 isSEBackup:= isSoundEnabled; |
1030 Volume:= 0; |
1039 Volume:= 0; |
1031 SoundTimerTicks:= 0; |
1040 SoundTimerTicks:= 0; |
1032 defVoicepack:= AskForVoicepack('Default'); |
1041 defVoicepack:= AskForVoicepack('Default_qau'); |
1033 LastVoiceFailed:= false; |
1042 LastVoiceFailed:= false; |
1034 |
1043 |
1035 for i:= Low(TSound) to High(TSound) do |
1044 for i:= Low(TSound) to High(TSound) do |
1036 lastChan[i]:= -1; |
1045 lastChan[i]:= -1; |
1037 |
1046 |