From 9df6ec6305068268118b9713776c6c57fe6edb30 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Tue, 12 Apr 2022 21:23:44 -0700 Subject: [PATCH] vmap: Add _entcontentflags, which like _entsurfaceflags controls content flags on a per brush-entity basis --- tools/vmap/map.c | 7 ++++++- tools/vmap/vmap.h | 2 ++ tools/vmap/writebsp.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/vmap/map.c b/tools/vmap/map.c index 3a624d1..8bd7305 100644 --- a/tools/vmap/map.c +++ b/tools/vmap/map.c @@ -1655,7 +1655,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) const char *classname, *value; float lightmapScale, shadeAngle; int lightmapSampleSize; - int entSurfFlag; + int entSurfFlag, entContFlag; char shader[ MAX_QPATH ]; shaderInfo_t *celShader = NULL; brush_t *brush; @@ -1836,6 +1836,9 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) entSurfFlag = 0; entSurfFlag = IntForKey( mapEnt, "_entsurfaceflags"); + entContFlag = 0; + entContFlag = IntForKey( mapEnt, "_entcontentflags"); + /* ydnar: get cel shader :) for this entity */ value = ValueForKey( mapEnt, "_celshader" ); if ( value[ 0 ] == '\0' ) { @@ -1908,6 +1911,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) brush->celShader = celShader; brush->shadeAngleDegrees = shadeAngle; brush->entSurfaceFlags = entSurfFlag; + brush->entContentFlags = entContFlag; } for ( patch = mapEnt->patches; patch != NULL; patch = patch->next ) @@ -1919,6 +1923,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) patch->lightmapScale = lightmapScale; patch->celShader = celShader; patch->entSurfaceFlags = entSurfFlag; + patch->entContentFlags = entContFlag; } /* ydnar: gs mods: set entity bounds */ diff --git a/tools/vmap/vmap.h b/tools/vmap/vmap.h index 286c24c..b85c971 100644 --- a/tools/vmap/vmap.h +++ b/tools/vmap/vmap.h @@ -900,6 +900,7 @@ typedef struct brush_s qboolean detail; qboolean opaque; int entSurfaceFlags; + int entContentFlags; int portalareas[ 2 ]; @@ -961,6 +962,7 @@ typedef struct parseMesh_s int maxIterations; qboolean nosolid; int entSurfaceFlags; + int entContentFlags; } parseMesh_t; diff --git a/tools/vmap/writebsp.c b/tools/vmap/writebsp.c index a0af360..e379c52 100644 --- a/tools/vmap/writebsp.c +++ b/tools/vmap/writebsp.c @@ -459,7 +459,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){ } surfaceFlags = b->contentShader->surfaceFlags | b->entSurfaceFlags; - contentFlags = b->contentShader->contentFlags; + contentFlags = b->contentShader->contentFlags | b->entContentFlags; if (b->nosolid) { contentFlags &= ~1;