equal
deleted
inserted
replaced
68 |
68 |
69 // Plays sound snd [of voicepack] in a loop, but starts with fadems milliseconds of fade-in. |
69 // Plays sound snd [of voicepack] in a loop, but starts with fadems milliseconds of fade-in. |
70 // Returns sound channel of the looped sound. |
70 // Returns sound channel of the looped sound. |
71 function LoopSound(snd: TSound): LongInt; |
71 function LoopSound(snd: TSound): LongInt; |
72 function LoopSound(snd: TSound; fadems: LongInt): LongInt; |
72 function LoopSound(snd: TSound; fadems: LongInt): LongInt; |
73 function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; // WTF? |
73 function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; |
74 function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; |
74 function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; |
75 |
75 |
76 // Stops the normal/looped sound of the given type/in the given channel |
76 // Stops the normal/looped sound of the given type/in the given channel |
77 // [with a fade-out effect for fadems milliseconds]. |
77 // [with a fade-out effect for fadems milliseconds]. |
78 procedure StopSound(snd: TSound); |
78 procedure StopSound(snd: TSound); |
259 |
259 |
260 function AskForVoicepack(name: shortstring): Pointer; |
260 function AskForVoicepack(name: shortstring): Pointer; |
261 var i: Longword; |
261 var i: Longword; |
262 locName, path: shortstring; |
262 locName, path: shortstring; |
263 begin |
263 begin |
264 i:= 0; |
264 i:= 0; |
265 // First, attempt to locate a localised version of the voice |
265 |
|
266 // Adjust voicepack name if there's a localised version version of the voice |
266 if cLocale <> 'en' then |
267 if cLocale <> 'en' then |
267 begin |
268 begin |
268 locName:= name+'_'+cLocale; |
269 locName:= name+'_'+cLocale; |
269 path:= cPathz[ptVoices] + '/' + locName; |
270 path:= cPathz[ptVoices] + '/' + locName; |
270 if pfsExists(path) then |
271 if pfsExists(path) then |
277 if pfsExists(path) then |
278 if pfsExists(path) then |
278 name:= locName |
279 name:= locName |
279 end |
280 end |
280 end; |
281 end; |
281 |
282 |
282 // If that fails, use the unmodified one |
283 path:= cPathz[ptVoices] + '/' + name; |
|
284 |
|
285 // Fallback to Default if voicepack can't be found at all |
|
286 if (name <> 'Default') and (not pfsExists(path)) then |
|
287 begin |
|
288 path:= cPathz[ptVoices] + '/Default'; |
|
289 if pfsExists(path) then |
|
290 exit(AskForVoicepack('Default')); |
|
291 end; |
|
292 |
283 while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do |
293 while (voicepacks[i].name <> name) and (voicepacks[i].name <> '') do |
284 begin |
294 begin |
285 inc(i); |
295 inc(i); |
286 TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true) |
296 TryDo(i <= cMaxTeams, 'Engine bug: AskForVoicepack i > cMaxTeams', true) |
287 end; |
297 end; |