From dd1daa5bff620ed54dad774070f9f7587e4d2df7 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 3 Dec 2019 02:27:08 +0300 Subject: [PATCH] engine: correctly validate blueshift maps --- engine/common/mod_bmodel.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index a8f655d1..228b06a8 100644 --- a/engine/common/mod_bmodel.c +++ b/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 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 );