vmap: no longer assume any entity with a classname starting with light* is

meant to be a static light.
This commit is contained in:
Marco Cawthorne 2021-07-09 14:59:55 +02:00
parent 90d3f523bb
commit 75565d2c0a
4 changed files with 28 additions and 32 deletions

View file

@ -235,7 +235,7 @@ void CreateEntityLights( void ){
e = &entities[ i ];
name = ValueForKey( e, "classname" );
if (Q_strncasecmp(name, "light_environment", 17) == 0) {
if ( !Q_stricmp( "light_environment", name ) ) {
sun_t *sun;
float a, b;
sun = safe_malloc( sizeof( *sun ) );
@ -328,16 +328,11 @@ void CreateEntityLights( void ){
/* store sun */
CreateSunLight(sun);
continue;
}
/* ydnar: check for lightJunior */
if ( Q_strncasecmp( name, "lightJunior", 11 ) == 0 ) {
} else if ( !Q_stricmp( "lightJunior", name ) ) {
junior = qtrue;
}
else if ( Q_strncasecmp( name, "light", 5 ) == 0 ) {
} else if ( !Q_stricmp( "light", name ) ) {
junior = qfalse;
}
else{
} else{
continue;
}

View file

@ -1765,7 +1765,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
classname = ValueForKey( mapEnt, "classname" );
/* ydnar: only lights? */
if ( onlyLights && Q_strncasecmp( classname, "light", 5 ) ) {
if ( onlyLights && (Q_stricmp( "light", classname ) && Q_stricmp( "lightJunior", classname ) && Q_stricmp( "light_environment", classname )) ) {
numEntities--;
return qtrue;
}
@ -1777,10 +1777,9 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
/* spike: q1 .maps have no way to set any detailbrush flags, so some workarounds exist... */
else if ( !Q_stricmp( "func_detail", classname ) || !Q_stricmp( "func_detail_wall", classname ) || !Q_stricmp( "func_detail_fence", classname ) ) {
funcGroupType = funcgroup_detail;
}
else if ( !Q_stricmp( "func_detail_illusionary", classname ) ) {
} else if ( !Q_stricmp( "func_detail_illusionary", classname ) ) {
funcGroupType = funcgroup_detail_illusionary;
}else{
} else {
funcGroupType = funcgroup_not;
}

View file

@ -2577,13 +2577,20 @@ void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds ){
else
out->surfaceType = MST_PATCH;
surfaceFlags = ds->shaderInfo->surfaceFlags;
contentFlags = ds->shaderInfo->contentFlags;
if (ds->mapMesh->nosolid) {
contentFlags &= ~1;
surfaceFlags |= 0x4000;
}
if ( debugSurfaces ) {
out->shaderNum = EmitShader( "debugsurfaces", NULL, NULL );
}
else if ( out->surfaceType == MST_PATCH && (patchMeta || forcePatchMeta) ) {
/* patch meta requires that we have nodraw patches for collision */
surfaceFlags = ds->shaderInfo->surfaceFlags;
contentFlags = ds->shaderInfo->contentFlags;
ApplySurfaceParm( "nodraw", &contentFlags, &surfaceFlags, NULL );
ApplySurfaceParm( "pointlight", &contentFlags, &surfaceFlags, NULL );
@ -2592,27 +2599,20 @@ void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds ){
VectorClear( ds->lightmapAxis );
ds->sampleSize = 0;
/* emit the new fake shader */
if (ds->mapMesh->nosolid)
surfaceFlags |= 0x4000;
out->shaderNum = EmitShader( ds->shaderInfo->shader, &contentFlags, &surfaceFlags );
} else{
out->shaderNum = EmitShader( ds->shaderInfo->shader, &contentFlags, &surfaceFlags );
}
else{
surfaceFlags = ds->shaderInfo->surfaceFlags;
if (ds->mapMesh->nosolid)
surfaceFlags |= 0x4000;
out->shaderNum = EmitShader( ds->shaderInfo->shader, &ds->shaderInfo->contentFlags, &surfaceFlags );
}
out->patchWidth = ds->patchWidth;
out->patchHeight = ds->patchHeight;
if (out->surfaceType == MST_PATCHFIXED)
{ //report subdivisions in the high bits
out->patchWidth |= ds->subdiv_x<<16;
out->patchHeight |= ds->subdiv_y<<16;
{ // report subdivisions in the high bits
out->patchWidth |= ds->subdiv_x << 16;
out->patchHeight |= ds->subdiv_y << 16;
}
out->fogNum = ds->fogNum;
bspDrawSurfaceCubemaps[ds->outputNum] = ds->cubemapNum;
@ -2623,6 +2623,7 @@ void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds ){
out->lightmapStyles[ i ] = LS_NONE;
out->vertexStyles[ i ] = LS_NONE;
}
out->lightmapStyles[ 0 ] = LS_NORMAL;
out->vertexStyles[ 0 ] = LS_NORMAL;

View file

@ -302,9 +302,10 @@ void SetLightStyles( void ){
e = &entities[ i ];
t = ValueForKey( e, "classname" );
if ( Q_strncasecmp( t, "light", 5 ) ) {
if (Q_stricmp( "light", t ) && Q_stricmp( "lightJunior", t ) && Q_stricmp( "light_environment", t ))
continue;
}
t = ValueForKey( e, "targetname" );
if ( t[ 0 ] == '\0' ) {
/* ydnar: strip the light from the BSP file */
@ -492,7 +493,7 @@ void EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes ){
if (b->nosolid)
surfaceFlags |= 0x4000;
cp->shaderNum = EmitShader( b->sides[ j ].shaderInfo->shader, &b->sides[ j ].shaderInfo->contentFlags, &surfaceFlags);
cp->shaderNum = EmitShader( b->sides[ j ].shaderInfo->shader, &contentFlags, &surfaceFlags);
} else {
cp->shaderNum = EmitShader( NULL, NULL, NULL );
}