463 |
463 |
464 Mix_CloseAudio(); |
464 Mix_CloseAudio(); |
465 end; |
465 end; |
466 end; |
466 end; |
467 |
467 |
|
468 // Get a fallback voice, assuming that snd is not available. Returns sndNone if none is found. |
|
469 function GetFallbackV(snd: TSound): TSound; |
|
470 begin |
|
471 // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing |
|
472 if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then |
|
473 GetFallbackV := sndFirePunch1 |
|
474 else if (snd in [sndOw2, sndOw3, sndOw4]) then |
|
475 GetFallbackV := sndOw1 |
|
476 else if (snd in [sndOoff2, sndOoff3]) then |
|
477 GetFallbackV := sndOoff1 |
|
478 // Other fallback sounds |
|
479 else if (snd = sndGrenade) then |
|
480 if random(2) = 0 then |
|
481 GetFallbackV := sndNooo |
|
482 else |
|
483 GetFallbackV := sndUhOh |
|
484 else if (snd in [sndDrat, sndBugger]) then |
|
485 GetFallbackV := sndStupid |
|
486 else if (snd in [sndGonnaGetYou, sndCutItOut, sndLeaveMeAlone]) then |
|
487 GetFallbackV := sndRegret |
|
488 else if (snd in [sndOhDear, sndSoLong]) then |
|
489 GetFallbackV := sndByeBye |
|
490 else if (snd = sndWhatThe) then |
|
491 GetFallbackV := sndNooo |
|
492 else if (snd = sndRunAway) then |
|
493 GetFallbackV := sndOops |
|
494 else if (snd = sndThisOneIsMine) then |
|
495 GetFallbackV := sndReinforce |
|
496 else if (snd in [sndAmazing, sndBrilliant, sndExcellent]) then |
|
497 GetFallbackV := sndEnemyDown |
|
498 else |
|
499 GetFallbackV := sndNone; |
|
500 end; |
|
501 |
468 procedure PlaySound(snd: TSound); |
502 procedure PlaySound(snd: TSound); |
469 begin |
503 begin |
470 PlaySoundV(snd, nil, false, false, false); |
504 PlaySoundV(snd, nil, false, false, false); |
471 end; |
505 end; |
472 |
506 |
516 if (voicepack <> nil) then |
550 if (voicepack <> nil) then |
517 begin |
551 begin |
518 if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then |
552 if (voicepack^.chunks[snd] = nil) and (Soundz[snd].Path = ptVoices) and (Soundz[snd].FileName <> '') then |
519 begin |
553 begin |
520 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
554 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
521 // Fallback sounds |
555 // Fallback taunts |
522 if (not pfsExists(s)) then |
556 if (not pfsExists(s)) then |
523 begin |
557 begin |
524 // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing |
558 snd := GetFallbackV(snd); |
525 if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then |
559 if snd = sndNone then |
526 snd := sndFirePunch1 |
560 exit; |
527 else if (snd in [sndOw2, sndOw3, sndOw4]) then |
|
528 snd := sndOw1 |
|
529 else if (snd in [sndOoff2, sndOoff3]) then |
|
530 snd := sndOoff1 |
|
531 // Other fallback sounds |
|
532 else if (snd = sndGrenade) then |
|
533 if random(2) = 0 then |
|
534 snd := sndNooo |
|
535 else |
|
536 snd := sndUhOh |
|
537 else if (snd in [sndDrat, sndBugger]) then |
|
538 snd := sndStupid |
|
539 else if (snd in [sndGonnaGetYou, sndCutItOut, sndLeaveMeAlone]) then |
|
540 snd := sndRegret |
|
541 else if (snd in [sndOhDear, sndSoLong]) then |
|
542 snd := sndByeBye |
|
543 else if (snd = sndWhatThe) then |
|
544 snd := sndNooo |
|
545 else if (snd = sndRunAway) then |
|
546 snd := sndOops |
|
547 else if (snd = sndThisOneIsMine) then |
|
548 snd := sndReinforce |
|
549 else if (snd in [sndAmazing, sndBrilliant, sndExcellent]) then |
|
550 snd := sndEnemyDown; |
|
551 |
|
552 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
561 s:= cPathz[Soundz[snd].Path] + '/' + voicepack^.name + '/' + Soundz[snd].FileName; |
553 end; |
562 end; |
554 WriteToConsole(msgLoading + s + ' '); |
563 WriteToConsole(msgLoading + s + ' '); |
555 rwops := rwopsOpenRead(s); |
564 rwops := rwopsOpenRead(s); |
556 |
565 |