Skip to content

Commit

Permalink
Work around some BS issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpoike committed Apr 17, 2023
1 parent 7caee8b commit 774fb93
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions engine/gl/gl_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 774fb93

Please sign in to comment.