vk: load map patches without extra .bsp extension

e.g. `c1a0d.patch`, not `c1a0d.bsp.patch`

Ref: #578
This commit is contained in:
Ivan Avdeev 2023-09-25 12:53:58 -04:00
parent e26ce740f1
commit e8a09c85e5
35 changed files with 16 additions and 1 deletions

View File

@ -699,7 +699,22 @@ static void parsePatches( const model_t *const map ) {
g_patch.surfaces_count = 0;
}
Q_snprintf(filename, sizeof(filename), "luchiki/%s.patch", map->name);
{
const char *ext = NULL;
// Find extension (if any)
{
const char *p = map->name;
for(; *p; ++p)
if (*p == '.')
ext = p;
if (!ext)
ext = p;
}
Q_snprintf(filename, sizeof(filename), "luchiki/%.*s.patch", (int)(ext - map->name), map->name);
}
DEBUG("Loading patches from file \"%s\"", filename);
data = gEngine.fsapi->LoadFile( filename, 0, false );
if (!data) {