572 PlaySoundV:= PlaySoundV(snd, voicepack, keepPlaying, ignoreMask, false); |
572 PlaySoundV:= PlaySoundV(snd, voicepack, keepPlaying, ignoreMask, false); |
573 end; |
573 end; |
574 |
574 |
575 function PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask, soundAsMusic: boolean): boolean; |
575 function PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask, soundAsMusic: boolean): boolean; |
576 var s: shortstring; |
576 var s: shortstring; |
577 tempSnd: TSound; |
577 tempSnd, loadSnd: TSound; |
578 rwops: PSDL_RWops; |
578 rwops: PSDL_RWops; |
579 begin |
579 begin |
580 PlaySoundV:= false; |
580 PlaySoundV:= false; |
581 if ((not isSoundEnabled) and (not (soundAsMusic and isMusicEnabled))) or fastUntilLag then |
581 if ((not isSoundEnabled) and (not (soundAsMusic and isMusicEnabled))) or fastUntilLag then |
582 exit; |
582 exit; |
589 |
589 |
590 if (voicepack <> nil) then |
590 if (voicepack <> nil) then |
591 begin |
591 begin |
592 if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then |
592 if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then |
593 begin |
593 begin |
594 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
594 loadSnd:= snd; |
|
595 s:= cPathz[Soundz[loadSnd].Path] + '/' + voicepack^.name + '/' + Soundz[loadSnd].FileName; |
|
596 |
595 // Fallback taunts |
597 // Fallback taunts |
596 if (not pfsExists(s)) then |
598 if (not pfsExists(s)) then |
597 begin |
599 begin |
598 tempSnd := GetFallbackV(snd); |
600 tempSnd := GetFallbackV(snd); |
599 if tempSnd <> sndNone then |
601 if tempSnd <> sndNone then |
600 begin |
602 begin |
601 snd := tempSnd; |
603 loadSnd := tempSnd; |
602 LastVoice.snd := tempSnd; |
604 //LastVoice.snd := tempSnd; |
603 end; |
605 end; |
604 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
606 s:= cPathz[Soundz[loadSnd].Path] + '/' + voicepack^.name + '/' + Soundz[loadSnd].FileName; |
605 end; |
607 end; |
606 WriteToConsole(msgLoading + s + ' '); |
608 WriteToConsole(msgLoading + s + ' ... '); |
607 rwops := rwopsOpenRead(s); |
609 rwops := rwopsOpenRead(s); |
608 |
610 |
609 if rwops = nil then |
611 if rwops = nil then |
610 begin |
612 begin |
611 s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName; |
613 s:= cPathz[Soundz[loadSnd].AltPath] + '/' + Soundz[loadSnd].FileName; |
612 WriteToConsole(msgLoading + s + ' ... '); |
614 WriteToConsole(msgLoading + s + ' ... '); |
613 rwops := rwopsOpenRead(s); |
615 rwops := rwopsOpenRead(s); |
614 end; |
616 end; |
615 voicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1); |
617 voicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwops, 1); |
616 |
618 |
625 else |
627 else |
626 begin |
628 begin |
627 if (defVoicepack^.chunks[snd] = nil) and (Soundz[snd].Path <> ptVoices) and (Soundz[snd].FileName <> '') then |
629 if (defVoicepack^.chunks[snd] = nil) and (Soundz[snd].Path <> ptVoices) and (Soundz[snd].FileName <> '') then |
628 begin |
630 begin |
629 s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
631 s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName; |
630 WriteToConsole(msgLoading + s + ' '); |
632 WriteToConsole(msgLoading + s + ' ... '); |
631 rwops := rwopsOpenRead(s); |
633 rwops := rwopsOpenRead(s); |
632 |
634 |
633 if rwops = nil then |
635 if rwops = nil then |
634 begin |
636 begin |
635 s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName; |
637 s:= cPathz[Soundz[snd].AltPath] + '/' + Soundz[snd].FileName; |