From f0c0c4f4a4cdbe44e38327cb32b1018538436372 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Tue, 12 Apr 2022 20:52:09 -0700 Subject: [PATCH] vmap: Add _entsurfaceflags. Which allows an entity (even func_detail) to add upon surfaceflags of a brush. Experimental and hacky. --- tools/vmap/map.c | 6 ++++++ tools/vmap/vmap.h | 2 ++ tools/vmap/writebsp.c | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/vmap/map.c b/tools/vmap/map.c index b5cbdcd..3a624d1 100644 --- a/tools/vmap/map.c +++ b/tools/vmap/map.c @@ -1655,6 +1655,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) const char *classname, *value; float lightmapScale, shadeAngle; int lightmapSampleSize; + int entSurfFlag; char shader[ MAX_QPATH ]; shaderInfo_t *celShader = NULL; brush_t *brush; @@ -1832,6 +1833,9 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) } } + entSurfFlag = 0; + entSurfFlag = IntForKey( mapEnt, "_entsurfaceflags"); + /* ydnar: get cel shader :) for this entity */ value = ValueForKey( mapEnt, "_celshader" ); if ( value[ 0 ] == '\0' ) { @@ -1903,6 +1907,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) brush->lightmapScale = lightmapScale; brush->celShader = celShader; brush->shadeAngleDegrees = shadeAngle; + brush->entSurfaceFlags = entSurfFlag; } for ( patch = mapEnt->patches; patch != NULL; patch = patch->next ) @@ -1913,6 +1918,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups ) patch->lightmapSampleSize = lightmapSampleSize; patch->lightmapScale = lightmapScale; patch->celShader = celShader; + patch->entSurfaceFlags = entSurfFlag; } /* ydnar: gs mods: set entity bounds */ diff --git a/tools/vmap/vmap.h b/tools/vmap/vmap.h index 4ba65dd..286c24c 100644 --- a/tools/vmap/vmap.h +++ b/tools/vmap/vmap.h @@ -899,6 +899,7 @@ typedef struct brush_s qboolean nosolid; qboolean detail; qboolean opaque; + int entSurfaceFlags; int portalareas[ 2 ]; @@ -959,6 +960,7 @@ typedef struct parseMesh_s float longestCurve; int maxIterations; qboolean nosolid; + int entSurfaceFlags; } parseMesh_t; diff --git a/tools/vmap/writebsp.c b/tools/vmap/writebsp.c index 6b7640b..a0af360 100644 --- a/tools/vmap/writebsp.c +++ b/tools/vmap/writebsp.c @@ -458,7 +458,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){ ( *numBrushes )++; } - surfaceFlags = b->contentShader->surfaceFlags; + surfaceFlags = b->contentShader->surfaceFlags | b->entSurfaceFlags; contentFlags = b->contentShader->contentFlags; if (b->nosolid) { @@ -488,7 +488,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){ /* emit shader */ if ( b->sides[ j ].shaderInfo ) { - surfaceFlags = b->sides[ j ].shaderInfo->surfaceFlags; + surfaceFlags = b->sides[ j ].shaderInfo->surfaceFlags | b->entSurfaceFlags; if (b->nosolid) surfaceFlags |= 0x4000;