From 0963e05716daba1b7d9ae9ef32341358c31c4719 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 20 Dec 2021 18:12:31 +0300 Subject: [PATCH] engine: restore lumps after swapping them for blue shift maps Mod_TestBmodelLumps may modify srclumps data, which is essential for brush model loader. BlueShift maps have swapped lumps for some reason Restoring them to default is fix for now --- engine/common/mod_bmodel.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 8d8dcae8..97c2e059 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -2908,13 +2908,28 @@ 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 ) + if( header->version == HLBSP_VERSION ) { - // blue-shift swapped lumps - srclumps[0].lumpnumber = LUMP_PLANES; - srclumps[1].lumpnumber = LUMP_ENTITIES; + // only relevant for half-life maps + if( 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; + } + else + { + // everything else + srclumps[0].lumpnumber = LUMP_ENTITIES; + srclumps[1].lumpnumber = LUMP_PLANES; + } + } + else + { + // everything else + srclumps[0].lumpnumber = LUMP_ENTITIES; + srclumps[1].lumpnumber = LUMP_PLANES; } // loading base lumps