MCPcopy Create free account
hub / github.com/JACoders/OpenJK / S_LoadSound_FileLoadAndNameAdjuster

Function S_LoadSound_FileLoadAndNameAdjuster

code/client/snd_mem.cpp:585–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583//
584extern cvar_t *com_buildScript;
585static qboolean S_LoadSound_FileLoadAndNameAdjuster(char *psFilename, byte **pData, int *piSize, int iNameStrlen)
586{
587 char *psVoice = strstr(psFilename,"chars");
588 if (psVoice)
589 {
590 // cache foreign voices...
591 //
592 if (com_buildScript->integer)
593 {
594 fileHandle_t hFile;
595 //German
596 strncpy(psVoice,"chr_d",5); // same number of letters as "chars"
597 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the wav
598 if (!hFile)
599 {
600 strcpy(&psFilename[iNameStrlen-3],"mp3"); //not there try mp3
601 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the mp3
602 }
603 if (hFile)
604 {
605 FS_FCloseFile(hFile);
606 }
607 strcpy(&psFilename[iNameStrlen-3],"wav"); //put it back to wav
608
609 //French
610 strncpy(psVoice,"chr_f",5); // same number of letters as "chars"
611 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the wav
612 if (!hFile)
613 {
614 strcpy(&psFilename[iNameStrlen-3],"mp3"); //not there try mp3
615 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the mp3
616 }
617 if (hFile)
618 {
619 FS_FCloseFile(hFile);
620 }
621 strcpy(&psFilename[iNameStrlen-3],"wav"); //put it back to wav
622
623 //Spanish
624 strncpy(psVoice,"chr_e",5); // same number of letters as "chars"
625 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the wav
626 if (!hFile)
627 {
628 strcpy(&psFilename[iNameStrlen-3],"mp3"); //not there try mp3
629 FS_FOpenFileRead(psFilename, &hFile, qfalse); //cache the mp3
630 }
631 if (hFile)
632 {
633 FS_FCloseFile(hFile);
634 }
635 strcpy(&psFilename[iNameStrlen-3],"wav"); //put it back to wav
636
637 strncpy(psVoice,"chars",5); //put it back to chars
638 }
639
640 // account for foreign voices...
641 //
642 extern cvar_t* s_language;

Callers 1

S_LoadSound_ActualFunction · 0.70

Calls 5

Q_stricmpFunction · 0.85
FS_FOpenFileReadFunction · 0.50
FS_FCloseFileFunction · 0.50
FS_ReadFileFunction · 0.50
Com_PrintfFunction · 0.50

Tested by

no test coverage detected