From 774fb9372196d5fdb5cbaf8c3effdf35fd19bc1b Mon Sep 17 00:00:00 2001 From: Shpoike Date: Sun, 19 Feb 2023 18:19:13 +0000 Subject: [PATCH] Work around some BS issue. --- engine/gl/gl_model.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index ff846e4b9..e0734322c 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -5348,7 +5348,28 @@ static qboolean QDECL Mod_LoadBrushModel (model_t *mod, void *buffer, size_t fsi else if (!memcmp(&header.version, BSPVERSION_LONG2)) mod->engineflags |= MDLF_NEEDOVERBRIGHT, subbsp = sb_long2; else if (!memcmp(&header.version, BSPVERSIONHL)) + { + char tmp[64]; mod->fromgame = fg_halflife; + + //special hack to work around blueshit bugs - we need to swap LUMP_ENTITIES and LUMP_PLANES over + if (COM_ParseOut(mod_base + header.lumps[LUMP_PLANES].fileofs, tmp, sizeof(tmp)) && !strcmp(tmp, "{")) + { + COM_ParseOut(mod_base + header.lumps[LUMP_ENTITIES].fileofs, tmp, sizeof(tmp)); + if (strcmp(tmp, "{")) + { + int i; + for (i = 0; i < header.lumps[LUMP_ENTITIES].filelen && i < sizeof(dplane_t); i++) + if (mod_base[header.lumps[LUMP_ENTITIES].fileofs + i] == 0) + { //yeah, looks screwy in the way we expect. swap em over. + lump_t tmp = header.lumps[LUMP_ENTITIES]; + header.lumps[LUMP_ENTITIES] = header.lumps[LUMP_PLANES]; + header.lumps[LUMP_PLANES] = tmp; + break; + } + } + } + } else { Con_Printf (CON_ERROR "Mod_LoadBrushModel: %s has wrong version number (%i)\n", mod->name, i);