Skip to content

Commit

Permalink
Fix jka assets breaking sounds of jk2 models.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daggolin committed Sep 16, 2023
1 parent d7f8f63 commit 036d2da
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/qcommon/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,9 +1994,13 @@ static pack_t *FS_LoadZipFile( char *zipfile, const char *basename, qboolean ass
}
strLength = strlen(filename_inzip);
if ( assetsJKA ) {
// Ugly workaround: rename academy shader files to avoid collisions
// Ugly workarounds:
// - rename academy shader files to avoid collisions
// - rename academy sounds.cfg files to prevent them from overriding sounds of jk2 models that don't have a sounds.cfg
if ( strLength > 7 && !Q_stricmp(filename_inzip + strLength - 7, ".shader") ) {
len += 4; // "_jka"
} else if ( strLength > 15 && !Q_stricmpn(filename_inzip, "models/players/", 15) && !Q_stricmp(filename_inzip + strLength - 11, "/sounds.cfg") ) {
len += 4; // "_jka"
}
}
len += strLength + 1;
Expand Down Expand Up @@ -2044,10 +2048,14 @@ static pack_t *FS_LoadZipFile( char *zipfile, const char *basename, qboolean ass
fs_headerLongs[fs_numHeaderLongs++] = LittleLong(file_info.crc);
}
if ( assetsJKA ) {
// Ugly workaround: rename academy shader files to avoid collisions
// Ugly workarounds:
// - rename academy shader files to avoid collisions
// - rename academy sounds.cfg files to prevent them from overriding sounds of jk2 models that don't have a sounds.cfg
strLength = strlen( filename_inzip );
if ( strLength > 7 && !Q_stricmp(filename_inzip + strLength - 7, ".shader") ) {
Q_strcat( filename_inzip, sizeof(filename_inzip), "_jka" );
} else if ( strLength > 15 && !Q_stricmpn(filename_inzip, "models/players/", 15) && !Q_stricmp(filename_inzip + strLength - 11, "/sounds.cfg") ) {
Q_strcat( filename_inzip, sizeof(filename_inzip), "_jka" );
}
}
Q_strlwr( filename_inzip );
Expand Down

0 comments on commit 036d2da

Please sign in to comment.