Browse Source

engine: correctly validate blueshift maps

pull/2/head
Alibek Omarov 5 years ago
parent
commit
dd1daa5bff
  1. 11
      engine/common/mod_bmodel.c

11
engine/common/mod_bmodel.c

@ -1977,7 +1977,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6); int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
int next_dataofs, remaining; 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++ ) for( j = i + 1; j < loadmodel->numtextures; j++ )
{ {
next_dataofs = in->dataofs[j]; next_dataofs = in->dataofs[j];
@ -2893,6 +2893,15 @@ qboolean Mod_TestBmodelLumps( const char *name, const byte *mod_base, qboolean s
break; 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 // loading base lumps
for( i = 0; i < ARRAYSIZE( srclumps ); i++ ) for( i = 0; i < ARRAYSIZE( srclumps ); i++ )
Mod_LoadLump( mod_base, &srclumps[i], &worldstats[i], flags ); Mod_LoadLump( mod_base, &srclumps[i], &worldstats[i], flags );

Loading…
Cancel
Save