Skip to content

add func_detail_nonsolid #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/utils/common/map_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ChunkFileResult_t LoadEntityKeyCallback(const char *szKey, const char *szValue,
{
pLoadEntity->nBaseContents = CONTENTS_DETAIL;
}
else if (!stricmp( szValue, "func_detail_nonsolid"))
{
pLoadEntity->nBaseContents = CONTENTS_DETAIL | CONTENTS_OPAQUE;
}
else if (!stricmp(szValue, "func_ladder"))
{
pLoadEntity->nBaseContents = CONTENTS_LADDER;
Expand Down
14 changes: 13 additions & 1 deletion src/utils/vbsp/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ ChunkFileResult_t CMapFile::LoadEntityCallback(CChunkFile *pFile, int nParam)
//
const char *pClassName = ValueForKey( mapent, "classname" );

if ( !strcmp( "func_detail", pClassName ) )
if ( !strcmp( "func_detail", pClassName ) || !strcmp( "func_detail_nonsolid", pClassName ) )
{
MoveBrushesToWorld (mapent);
mapent->numbrushes = 0;
Expand Down Expand Up @@ -2644,6 +2644,18 @@ bool LoadMapFile( const char *pszFileName )
AddPointToBounds (g_LoadingMap->mapbrushes[i].maxs, g_LoadingMap->map_mins, g_LoadingMap->map_maxs);
}

// CONTENTS_OPAQUE makes a brush not solid, but CONTENTS_WINDOW breaks its non-solidity
// CONTENTS_OPAQUE only gets applied via %compilenonsolid VMT property and func_detail_nonsolid entity
// %compilenonsolid prevents CONTENTS_WINDOW from being applied, func_detail_nonsolid does not, so we remove it here
for ( int i = 0; i < g_LoadingMap->entities[0].numbrushes; i++ )
{
mapbrush_t* brush = &g_LoadingMap->mapbrushes[i];
if ( ( brush->contents & CONTENTS_OPAQUE ) && ( brush->contents & CONTENTS_WINDOW ) )
{
brush->contents &= ~CONTENTS_WINDOW;
}
}

qprintf ("%5i brushes\n", g_LoadingMap->nummapbrushes);
qprintf ("%5i clipbrushes\n", g_LoadingMap->c_clipbrushes);
qprintf ("%5i total sides\n", g_LoadingMap->nummapbrushsides);
Expand Down