engine: correctly validate blueshift maps

This commit is contained in:
Alibek Omarov 2019-12-03 02:27:08 +03:00
parent 154dd5c9ae
commit dd1daa5bff
1 changed files with 10 additions and 1 deletions

View File

@ -1977,7 +1977,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
int next_dataofs, remaining;
// compute next dataofset to determine allocated miptex sapce
// compute next dataofset to determine allocated miptex space
for( j = i + 1; j < loadmodel->numtextures; j++ )
{
next_dataofs = in->dataofs[j];
@ -2893,6 +2893,15 @@ qboolean Mod_TestBmodelLumps( const char *name, const byte *mod_base, qboolean s
break;
}
if( header->version == HLBSP_VERSION &&
header->lumps[LUMP_ENTITIES].fileofs <= 1024 &&
(header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
{
// blue-shift swapped lumps
srclumps[0].lumpnumber = LUMP_PLANES;
srclumps[1].lumpnumber = LUMP_ENTITIES;
}
// loading base lumps
for( i = 0; i < ARRAYSIZE( srclumps ); i++ )
Mod_LoadLump( mod_base, &srclumps[i], &worldstats[i], flags );