vmap: Add _entsurfaceflags. Which allows an entity (even func_detail) to add upon

surfaceflags of a brush. Experimental and hacky.
This commit is contained in:
Marco Cawthorne 2022-04-12 20:52:09 -07:00
parent 70932b8eab
commit f0c0c4f4a4
Signed by: eukara
GPG Key ID: C196CD8BA993248A
3 changed files with 10 additions and 2 deletions

View File

@ -1655,6 +1655,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
const char *classname, *value; const char *classname, *value;
float lightmapScale, shadeAngle; float lightmapScale, shadeAngle;
int lightmapSampleSize; int lightmapSampleSize;
int entSurfFlag;
char shader[ MAX_QPATH ]; char shader[ MAX_QPATH ];
shaderInfo_t *celShader = NULL; shaderInfo_t *celShader = NULL;
brush_t *brush; 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 */ /* ydnar: get cel shader :) for this entity */
value = ValueForKey( mapEnt, "_celshader" ); value = ValueForKey( mapEnt, "_celshader" );
if ( value[ 0 ] == '\0' ) { if ( value[ 0 ] == '\0' ) {
@ -1903,6 +1907,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
brush->lightmapScale = lightmapScale; brush->lightmapScale = lightmapScale;
brush->celShader = celShader; brush->celShader = celShader;
brush->shadeAngleDegrees = shadeAngle; brush->shadeAngleDegrees = shadeAngle;
brush->entSurfaceFlags = entSurfFlag;
} }
for ( patch = mapEnt->patches; patch != NULL; patch = patch->next ) for ( patch = mapEnt->patches; patch != NULL; patch = patch->next )
@ -1913,6 +1918,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
patch->lightmapSampleSize = lightmapSampleSize; patch->lightmapSampleSize = lightmapSampleSize;
patch->lightmapScale = lightmapScale; patch->lightmapScale = lightmapScale;
patch->celShader = celShader; patch->celShader = celShader;
patch->entSurfaceFlags = entSurfFlag;
} }
/* ydnar: gs mods: set entity bounds */ /* ydnar: gs mods: set entity bounds */

View File

@ -899,6 +899,7 @@ typedef struct brush_s
qboolean nosolid; qboolean nosolid;
qboolean detail; qboolean detail;
qboolean opaque; qboolean opaque;
int entSurfaceFlags;
int portalareas[ 2 ]; int portalareas[ 2 ];
@ -959,6 +960,7 @@ typedef struct parseMesh_s
float longestCurve; float longestCurve;
int maxIterations; int maxIterations;
qboolean nosolid; qboolean nosolid;
int entSurfaceFlags;
} }
parseMesh_t; parseMesh_t;

View File

@ -458,7 +458,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){
( *numBrushes )++; ( *numBrushes )++;
} }
surfaceFlags = b->contentShader->surfaceFlags; surfaceFlags = b->contentShader->surfaceFlags | b->entSurfaceFlags;
contentFlags = b->contentShader->contentFlags; contentFlags = b->contentShader->contentFlags;
if (b->nosolid) { if (b->nosolid) {
@ -488,7 +488,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){
/* emit shader */ /* emit shader */
if ( b->sides[ j ].shaderInfo ) { if ( b->sides[ j ].shaderInfo ) {
surfaceFlags = b->sides[ j ].shaderInfo->surfaceFlags; surfaceFlags = b->sides[ j ].shaderInfo->surfaceFlags | b->entSurfaceFlags;
if (b->nosolid) if (b->nosolid)
surfaceFlags |= 0x4000; surfaceFlags |= 0x4000;