hedgewars/uSound.pas
changeset 7151 ec15d9e1a7e3
parent 7061 4e0fc59ab1ce
child 7403 e8d0b21efa82
equal deleted inserted replaced
7148:c7ee9592c9a1 7151:ec15d9e1a7e3
   261             begin
   261             begin
   262             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   262             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   263             if not FileExists(s) then
   263             if not FileExists(s) then
   264                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   264                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   265             WriteToConsole(msgLoading + s + ' ');
   265             WriteToConsole(msgLoading + s + ' ');
   266             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
   266             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   267             if voicepack^.chunks[snd] = nil then
   267             if voicepack^.chunks[snd] = nil then
   268                 WriteLnToConsole(msgFailed)
   268                 WriteLnToConsole(msgFailed)
   269             else
   269             else
   270                 WriteLnToConsole(msgOK)
   270                 WriteLnToConsole(msgOK)
   271             end;
   271             end;
   277             begin
   277             begin
   278             s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   278             s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   279             if not FileExists(s) then
   279             if not FileExists(s) then
   280                 s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   280                 s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   281             WriteToConsole(msgLoading + s + ' ');
   281             WriteToConsole(msgLoading + s + ' ');
   282             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
   282             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   283             SDLTry(defVoicepack^.chunks[snd] <> nil, true);
   283             SDLTry(defVoicepack^.chunks[snd] <> nil, true);
   284             WriteLnToConsole(msgOK);
   284             WriteLnToConsole(msgOK);
   285             end;
   285             end;
   286         lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
   286         lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
   287         end;
   287         end;
   361            begin
   361            begin
   362             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   362             s:= UserPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   363             if not FileExists(s) then
   363             if not FileExists(s) then
   364                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   364                 s:= Pathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   365             WriteToConsole(msgLoading + s + ' ');
   365             WriteToConsole(msgLoading + s + ' ');
   366             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
   366             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   367             if voicepack^.chunks[snd] = nil then
   367             if voicepack^.chunks[snd] = nil then
   368                 WriteLnToConsole(msgFailed)
   368                 WriteLnToConsole(msgFailed)
   369             else
   369             else
   370                 WriteLnToConsole(msgOK)
   370                 WriteLnToConsole(msgOK)
   371             end;
   371             end;
   377             begin
   377             begin
   378             s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   378             s:= UserPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   379             if not FileExists(s) then
   379             if not FileExists(s) then
   380                 s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   380                 s:= Pathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   381             WriteToConsole(msgLoading + s + ' ');
   381             WriteToConsole(msgLoading + s + ' ');
   382             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1);
   382             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), _P'rb'), 1);
   383             SDLTry(defVoicepack^.chunks[snd] <> nil, true);
   383             SDLTry(defVoicepack^.chunks[snd] <> nil, true);
   384             WriteLnToConsole(msgOK);
   384             WriteLnToConsole(msgOK);
   385             end;
   385             end;
   386         if fadems > 0 then
   386         if fadems > 0 then
   387             LoopSoundV:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1)
   387             LoopSoundV:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1)