Skip to content

Commit f1de24b

Browse files
committed
engine: fix bsp21 loading
1 parent d56e855 commit f1de24b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

engine/modelloader.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ static worldbrushdata_t *s_pMap = NULL;
396396
static int s_nMapLoadRecursion = 0;
397397
static CUtlBuffer s_MapBuffer;
398398

399+
int s_MapVersion = 0;
400+
399401
// Lump files are patches for a shipped map
400402
// List of lump files found when map was loaded. Each entry is the lump file index for that lump id.
401403
struct lumpfiles_t
@@ -469,6 +471,8 @@ void CMapLoadHelper::Init( model_t *pMapModel, const char *loadname )
469471
return;
470472
}
471473

474+
s_MapVersion = s_MapHeader.version;
475+
472476
V_strcpy_safe( s_szLoadName, loadname );
473477

474478
// Store map version, but only do it once so that the communication between the engine and Hammer isn't broken. The map version

engine/staticpropmgr.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ConVar r_staticpropinfo( "r_staticpropinfo", "0" );
6060
ConVar r_drawmodeldecals( "r_drawmodeldecals", "1" );
6161
extern ConVar mat_fullbright;
6262
static bool g_MakingDevShots = false;
63-
extern dheader_t s_MapHeader;
63+
extern int s_MapVersion;
6464
//-----------------------------------------------------------------------------
6565
// Index into the fade list
6666
//-----------------------------------------------------------------------------
@@ -1342,12 +1342,13 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf )
13421342
case 9: UnserializeLump<StaticPropLumpV9_t>(&lump, buf); break;
13431343
case 10:
13441344
{
1345-
if( s_MapHeader.version == 21 )
1345+
if( s_MapVersion == 21 )
13461346
UnserializeLump<StaticPropLumpV10_21_t>(&lump, buf);
13471347
else
13481348
UnserializeLump<StaticPropLumpV10_t>(&lump, buf);
13491349
break;
13501350
}
1351+
case 11: UnserializeLump<StaticPropLumpV11_t>(&lump, buf);
13511352
default:
13521353
Assert("Unexpected version while deserializing lumps.");
13531354
}

public/gamebspfile.h

+6
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ struct StaticPropLump_t
443443
m_FlagsEx = _rhs.m_FlagsEx;
444444
return *this;
445445
}
446+
447+
inline StaticPropLump_t& operator=(const StaticPropLumpV11_t& _rhs)
448+
{
449+
(*this) = reinterpret_cast<const StaticPropLumpV10_21_t&>(_rhs);
450+
return *this;
451+
}
446452
};
447453

448454
struct StaticPropLeafLump_t

0 commit comments

Comments
 (0)