227 for t:= 0 to cMaxTeams do |
226 for t:= 0 to cMaxTeams do |
228 if voicepacks[t].name <> '' then |
227 if voicepacks[t].name <> '' then |
229 for i:= Low(TSound) to High(TSound) do |
228 for i:= Low(TSound) to High(TSound) do |
230 voicepacks[t].chunks[i]:= nil; |
229 voicepacks[t].chunks[i]:= nil; |
231 |
230 |
232 // preload all the big sound files (>32k) that would otherwise lockup the game |
|
233 for i:= Low(TSound) to High(TSound) do |
231 for i:= Low(TSound) to High(TSound) do |
234 begin |
232 begin |
235 defVoicepack^.chunks[i]:= nil; |
233 defVoicepack^.chunks[i]:= nil; |
|
234 (* this is not necessary when SDL_mixer is compiled with USE_OGG_TREMOR |
|
235 // preload all the big sound files (>32k) that would otherwise lockup the game |
236 if (i in [sndBeeWater, sndBee, sndCake, sndHellishImpact1, sndHellish, sndHomerun, |
236 if (i in [sndBeeWater, sndBee, sndCake, sndHellishImpact1, sndHellish, sndHomerun, |
237 sndMolotov, sndMortar, sndRideOfTheValkyries, sndYoohoo]) |
237 sndMolotov, sndMortar, sndRideOfTheValkyries, sndYoohoo]) |
238 and (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then |
238 and (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then |
239 begin |
239 begin |
240 s:= UserPathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
240 s:= UserPathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
241 if not FileExists(s) then s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
241 if not FileExists(s) then s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
242 WriteToConsole(msgLoading + s + ' '); |
242 WriteToConsole(msgLoading + s + ' '); |
243 defVoicepack^.chunks[i]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
243 defVoicepack^.chunks[i]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
244 TryDo(defVoicepack^.chunks[i] <> nil, msgFailed, true); |
244 SDLTry(defVoicepack^.chunks[i] <> nil, true); |
245 WriteLnToConsole(msgOK); |
245 WriteLnToConsole(msgOK); |
246 end; |
246 end;*) |
247 end; |
247 end; |
248 |
248 |
249 end; |
249 end; |
250 |
250 |
251 procedure PlaySound(snd: TSound); |
251 procedure PlaySound(snd: TSound); |
293 begin |
293 begin |
294 s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
294 s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
295 if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
295 if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
296 WriteToConsole(msgLoading + s + ' '); |
296 WriteToConsole(msgLoading + s + ' '); |
297 defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
297 defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
298 TryDo(defVoicepack^.chunks[snd] <> nil, msgFailed, true); |
298 SDLTry(defVoicepack^.chunks[snd] <> nil, true); |
299 WriteLnToConsole(msgOK); |
299 WriteLnToConsole(msgOK); |
300 end; |
300 end; |
301 lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1) |
301 lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1) |
302 end; |
302 end; |
303 end; |
303 end; |
385 begin |
385 begin |
386 s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
386 s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
387 if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
387 if not FileExists(s) then s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
388 WriteToConsole(msgLoading + s + ' '); |
388 WriteToConsole(msgLoading + s + ' '); |
389 defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
389 defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
390 TryDo(defVoicepack^.chunks[snd] <> nil, msgFailed, true); |
390 SDLTry(defVoicepack^.chunks[snd] <> nil, true); |
391 WriteLnToConsole(msgOK); |
391 WriteLnToConsole(msgOK); |
392 end; |
392 end; |
393 if fadems > 0 then |
393 if fadems > 0 then |
394 LoopSound:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1) |
394 LoopSound:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1) |
395 else |
395 else |
433 s:= UserPathPrefix + '/Data/Music/' + MusicFN; |
433 s:= UserPathPrefix + '/Data/Music/' + MusicFN; |
434 if not FileExists(s) then s:= PathPrefix + '/Music/' + MusicFN; |
434 if not FileExists(s) then s:= PathPrefix + '/Music/' + MusicFN; |
435 WriteToConsole(msgLoading + s + ' '); |
435 WriteToConsole(msgLoading + s + ' '); |
436 |
436 |
437 Mus:= Mix_LoadMUS(Str2PChar(s)); |
437 Mus:= Mix_LoadMUS(Str2PChar(s)); |
438 TryDo(Mus <> nil, msgFailed, false); |
438 SDLTry(Mus <> nil, false); |
439 WriteLnToConsole(msgOK); |
439 WriteLnToConsole(msgOK); |
440 |
440 |
441 SDLTry(Mix_FadeInMusic(Mus, -1, 3000) <> -1, false) |
441 SDLTry(Mix_FadeInMusic(Mus, -1, 3000) <> -1, false) |
442 end; |
442 end; |
443 |
443 |