hedgewars/uSound.pas
changeset 11874 045f33b498ea
parent 11873 7db5aef27e8d
child 11911 6145efcff302
equal deleted inserted replaced
11873:7db5aef27e8d 11874:045f33b498ea
   412             s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   412             s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   413             if (not pfsExists(s)) and (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
   413             if (not pfsExists(s)) and (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
   414                 s:= cPathz[Soundz[sndFirePunch1].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   414                 s:= cPathz[Soundz[sndFirePunch1].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   415             WriteToConsole(msgLoading + s + ' ');
   415             WriteToConsole(msgLoading + s + ' ');
   416             rwops := rwopsOpenRead(s);
   416             rwops := rwopsOpenRead(s);
   417             
   417 
   418             if rwops = nil then
   418             if rwops = nil then
   419                 begin
   419                 begin
   420                 s:= cPathz[Soundz[snd].AltPath] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   420                 s:= cPathz[Soundz[snd].AltPath] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   421                 WriteToConsole(msgLoading + s + ' ... ');
   421                 WriteToConsole(msgLoading + s + ' ... ');
   422                 rwops := rwopsOpenRead(s);
   422                 rwops := rwopsOpenRead(s);
   435         if (defVoicepack^.chunks[snd] = nil) and (Soundz[snd].Path <> ptVoices) and (Soundz[snd].FileName <> '') then
   435         if (defVoicepack^.chunks[snd] = nil) and (Soundz[snd].Path <> ptVoices) and (Soundz[snd].FileName <> '') then
   436             begin
   436             begin
   437             s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   437             s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
   438             WriteToConsole(msgLoading + s + ' ');
   438             WriteToConsole(msgLoading + s + ' ');
   439             rwops := rwopsOpenRead(s);
   439             rwops := rwopsOpenRead(s);
   440             
   440 
   441             if rwops = nil then
   441             if rwops = nil then
   442                 begin
   442                 begin
   443                 s:= cPathz[Soundz[snd].AltPath] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   443                 s:= cPathz[Soundz[snd].AltPath] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   444                 WriteToConsole(msgLoading + s + ' ... ');
   444                 WriteToConsole(msgLoading + s + ' ... ');
   445                 rwops := rwopsOpenRead(s);
   445                 rwops := rwopsOpenRead(s);
   446                 end;
   446                 end;
   447             
   447 
   448             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1);
   448             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1);
   449             if SDLCheck(defVoicepack^.chunks[snd] <> nil, 'Mix_LoadWAV_RW', true) then exit;
   449             if SDLCheck(defVoicepack^.chunks[snd] <> nil, 'Mix_LoadWAV_RW', true) then exit;
   450             WriteLnToConsole(msgOK);
   450             WriteLnToConsole(msgOK);
   451             end;
   451             end;
   452         lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
   452         lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
   530         if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then
   530         if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then
   531            begin
   531            begin
   532             s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   532             s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName;
   533             WriteToConsole(msgLoading + s + ' ');
   533             WriteToConsole(msgLoading + s + ' ');
   534             rwops:=rwopsOpenRead(s);
   534             rwops:=rwopsOpenRead(s);
   535             
   535 
   536             if rwops = nil then
   536             if rwops = nil then
   537                 begin
   537                 begin
   538                 s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName;
   538                 s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName;
   539                 WriteToConsole(msgLoading + s + ' ... ');
   539                 WriteToConsole(msgLoading + s + ' ... ');
   540                 rwops:=rwopsOpenRead(s);
   540                 rwops:=rwopsOpenRead(s);
   541                 end;
   541                 end;
   542                 
   542 
   543             defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1);
   543             voicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1);
   544             if voicepack^.chunks[snd] = nil then
   544             if voicepack^.chunks[snd] = nil then
   545                 WriteLnToConsole(msgFailed)
   545                 WriteLnToConsole(msgFailed)
   546             else
   546             else
   547                 WriteLnToConsole(msgOK)
   547                 WriteLnToConsole(msgOK)
   548             end;
   548             end;