Get rid of -flares and -noflares. As you should really use the game-logic

for client-side effects like this.
This commit is contained in:
Marco Cawthorne 2020-12-07 16:20:32 +01:00
parent 890ab6ebca
commit a29edbe997
7 changed files with 11 additions and 232 deletions

View file

@ -366,59 +366,6 @@ void ProcessWorldModel( const char *portalFilePath, const char *lineFilePath ){
MakeFogHullSurfs( e, tree, shader );
}
/* ydnar: bug 645: do flares for lights */
for ( i = 0; i < numEntities && emitFlares; i++ )
{
entity_t *light, *target;
const char *value, *flareShader;
vec3_t origin, targetOrigin, normal, color;
int lightStyle;
/* get light */
light = &entities[ i ];
value = ValueForKey( light, "classname" );
if ( !strcmp( value, "light" ) ) {
/* get flare shader */
flareShader = ValueForKey( light, "_flareshader" );
value = ValueForKey( light, "_flare" );
if ( flareShader[ 0 ] != '\0' || value[ 0 ] != '\0' ) {
/* get specifics */
GetVectorForKey( light, "origin", origin );
GetVectorForKey( light, "_color", color );
lightStyle = IntForKey( light, "_style" );
if ( lightStyle == 0 ) {
lightStyle = IntForKey( light, "style" );
}
/* handle directional spotlights */
value = ValueForKey( light, "target" );
if ( value[ 0 ] != '\0' ) {
/* get target light */
target = FindTargetEntity( value );
if ( target != NULL ) {
GetVectorForKey( target, "origin", targetOrigin );
VectorSubtract( targetOrigin, origin, normal );
VectorNormalize( normal, normal );
}
}
else{
//% VectorClear( normal );
VectorSet( normal, 0, 0, -1 );
}
if ( colorsRGB ) {
color[0] = Image_LinearFloatFromsRGBFloat( color[0] );
color[1] = Image_LinearFloatFromsRGBFloat( color[1] );
color[2] = Image_LinearFloatFromsRGBFloat( color[2] );
}
/* create the flare surface (note shader defaults automatically) */
DrawSurfaceForFlare( mapEntityNum, origin, normal, color, flareShader, lightStyle );
}
}
}
/* add references to the final drawsurfs in the apropriate clusters */
FilterDrawsurfsIntoTree( e, tree );
@ -587,11 +534,6 @@ void OnlyEnts( const char *BSPFilePath ){
LoadBSPFile( BSPFilePath );
ParseEntities();
p = ValueForKey( &entities[0], "_q3map2_cmdline" );
strncpy( save_cmdline, p, sizeof( save_cmdline ) );
save_cmdline[sizeof( save_cmdline ) - 1] = 0;
p = ValueForKey( &entities[0], "_q3map2_version" );
strncpy( save_version, p, sizeof( save_version ) );
save_version[sizeof( save_version ) - 1] = 0;
p = ValueForKey( &entities[0], "gridsize" );
strncpy( save_gridsize, p, sizeof( save_gridsize ) );
@ -604,12 +546,6 @@ void OnlyEnts( const char *BSPFilePath ){
SetModelNumbers();
SetLightStyles();
if ( *save_cmdline ) {
SetKeyValue( &entities[0], "_q3map2_cmdline", save_cmdline );
}
if ( *save_version ) {
SetKeyValue( &entities[0], "_q3map2_version", save_version );
}
if ( *save_gridsize ) {
SetKeyValue( &entities[0], "gridsize", save_gridsize );
}
@ -655,7 +591,6 @@ int BSPMain( int argc, char **argv ){
/* set standard game flags */
maxSurfaceVerts = game->maxSurfaceVerts;
maxSurfaceIndexes = game->maxSurfaceIndexes;
emitFlares = game->emitFlares;
texturesRGB = game->texturesRGB;
colorsRGB = game->colorsRGB;
@ -857,14 +792,6 @@ int BSPMain( int argc, char **argv ){
Sys_Printf( "Creating meta surfaces from patches\n" );
patchMeta = qtrue;
}
else if ( !strcmp( argv[ i ], "-flares" ) ) {
Sys_Printf( "Flare surfaces enabled\n" );
emitFlares = qtrue;
}
else if ( !strcmp( argv[ i ], "-noflares" ) ) {
Sys_Printf( "Flare surfaces disabled\n" );
emitFlares = qfalse;
}
else if ( !strcmp( argv[ i ], "-skyfix" ) ) {
Sys_Printf( "GL_CLAMP sky fix/hack/workaround enabled\n" );
skyFixHack = qtrue;

View file

@ -58,8 +58,6 @@
0, /* max lightmapped surface verts */
0, /* max surface verts */
0, /* max surface indexes */
qfalse, /* flares */
NULL, /* default flare shader */
qfalse, /* wolf lighting model? */
0, /* lightmap width/height */
0, /* lightmap gamma */

View file

@ -103,8 +103,6 @@
65535, /* max lightmapped surface verts */
65535, /* max surface verts */
1048575, /* max surface indexes */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
512, /* lightmap width/height */
1.0f, /* lightmap gamma */

View file

@ -97,7 +97,6 @@ void HelpBsp()
{"-deep", "Use detail brushes in the BSP tree, but at lowest priority (should give more fps)"},
{"-de <F>", "Distance epsilon for plane snapping etc."},
{"-fakemap", "Write fakemap.map containing all world brushes"},
{"-flares", "Turn on support for flares (TEST?)"},
{"-flat", "Enable flat shading (good for combining with -celshader)"},
{"-fulldetail", "Treat detail brushes as structural ones"},
{"-leaktest", "Continue even if a leak was found"},
@ -109,7 +108,6 @@ void HelpBsp()
{"-ne <F>", "Normal epsilon for plane snapping etc."},
{"-nocurves", "Turn off support for patches"},
{"-nodetail", "Leave out detail brushes"},
{"-noflares", "Turn off support for flares"},
{"-nofog", "Turn off support for fog volumes"},
{"-nohint", "Turn off support for hint brushes"},
{"-nosubdivide", "Turn off support for `q3map_tessSize` (breaks water vertex deforms)"},

View file

@ -1064,16 +1064,6 @@ static void ParseShaderFile( const char *filename ){
if ( !Q_stricmp( token, "animMap" ) || !Q_stricmp( token, "clampAnimMap" ) ) {
GetTokenAppend( shaderText, qfalse );
}
/* get an image */
GetTokenAppend( shaderText, qfalse );
if ( token[ 0 ] != '*' && token[ 0 ] != '$' ) {
strcpy( si->lightImagePath, token );
DefaultExtension( si->lightImagePath, ".tga" );
/* debug code */
//% Sys_FPrintf( SYS_VRB, "Deduced shader image: %s\n", si->lightImagePath );
}
}
}
}
@ -1164,12 +1154,6 @@ static void ParseShaderFile( const char *filename ){
}
}
/* light <value> (old-style flare specification) */
else if ( !Q_stricmp( token, "light" ) ) {
GetTokenAppend( shaderText, qfalse );
si->flareShader = game->flareShader;
}
/* ydnar: damageShader <shader> <health> (sof2 mods) */
else if ( !Q_stricmp( token, "damageShader" ) ) {
GetTokenAppend( shaderText, qfalse );
@ -1255,11 +1239,6 @@ static void ParseShaderFile( const char *filename ){
/* ignore bogus paths */
if ( Q_stricmp( token, "-" ) && Q_stricmp( token, "full" ) ) {
strcpy( si->skyParmsImageBase, token );
/* use top image as sky light image */
if ( si->lightImagePath[ 0 ] == '\0' ) {
sprintf( si->lightImagePath, "%s_up.tga", si->skyParmsImageBase );
}
}
/* skip rest of line */
@ -1617,15 +1596,6 @@ static void ParseShaderFile( const char *filename ){
si->noVertexLight = qtrue;
}
/* q3map_flare[Shader] <shader> */
else if ( !Q_stricmp( token, "q3map_flare" ) || !Q_stricmp( token, "vmap_flare" ) ) {
GetTokenAppend( shaderText, qfalse );
if ( token[ 0 ] != '\0' ) {
si->flareShader = safe_malloc( strlen( token ) + 1 );
strcpy( si->flareShader, token );
}
}
/* q3map_backShader <shader> */
else if ( !Q_stricmp( token, "q3map_backShader" ) || !Q_stricmp( token, "vmap_backShader" ) ) {
GetTokenAppend( shaderText, qfalse );

View file

@ -504,7 +504,7 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){
/* walk the list of surfaces */
for ( ; numSurfs > 0; numSurfs--, ds++ )
{
/* ignore bogus (or flare) surfaces */
/* ignore bogus surfaces */
if ( ds->type == SURFACE_BAD || ds->numVerts <= 0 ) {
continue;
}
@ -1251,57 +1251,6 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh
return ds;
}
/*
DrawSurfaceForFlare() - ydnar
creates a flare draw surface
*/
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, const char *flareShader, int lightStyle ){
mapDrawSurface_t *ds;
/* emit flares? */
if ( emitFlares == qfalse ) {
return NULL;
}
/* allocate drawsurface */
ds = AllocDrawSurface( SURFACE_FLARE );
ds->entityNum = entNum;
/* set it up */
if ( flareShader != NULL && flareShader[ 0 ] != '\0' ) {
ds->shaderInfo = ShaderInfoForShader( flareShader );
}
else{
ds->shaderInfo = ShaderInfoForShader( game->flareShader );
}
if ( origin != NULL ) {
VectorCopy( origin, ds->lightmapOrigin );
}
if ( normal != NULL ) {
VectorCopy( normal, ds->lightmapVecs[ 2 ] );
}
if ( color != NULL ) {
VectorCopy( color, ds->lightmapVecs[ 0 ] );
}
/* store light style */
ds->lightStyle = lightStyle;
if ( ds->lightStyle < 0 || ds->lightStyle >= LS_NONE ) {
ds->lightStyle = LS_NORMAL;
}
/* fixme: fog */
/* return to sender */
return ds;
}
/*
DrawSurfaceForShader() - ydnar
creates a bogus surface to forcing the game to load a shader
@ -1338,35 +1287,6 @@ mapDrawSurface_t *DrawSurfaceForShader( char *shader ){
}
/*
AddSurfaceFlare() - ydnar
creates flares (coronas) centered on surfaces
*/
static void AddSurfaceFlare( mapDrawSurface_t *ds, vec3_t entityOrigin ){
vec3_t origin;
int i;
/* find centroid */
VectorClear( origin );
for ( i = 0; i < ds->numVerts; i++ )
VectorAdd( origin, ds->verts[ i ].xyz, origin );
VectorScale( origin, ( 1.0f / ds->numVerts ), origin );
if ( entityOrigin != NULL ) {
VectorAdd( origin, entityOrigin, origin );
}
/* push origin off surface a bit */
VectorMA( origin, 2.0f, ds->lightmapVecs[ 2 ], origin );
/* create the drawsurface */
DrawSurfaceForFlare( ds->entityNum, origin, ds->lightmapVecs[ 2 ], ds->shaderInfo->color, ds->shaderInfo->flareShader, ds->shaderInfo->lightStyle );
}
/*
SubdivideFace()
subdivides a face surface until it is smaller than the specified size (subdivisions)
@ -2384,18 +2304,6 @@ static int FilterFoliageIntoTree( mapDrawSurface_t *ds, tree_t *tree ){
return refs;
}
/*
FilterFlareIntoTree()
simple point filtering for flare surfaces
*/
static int FilterFlareSurfIntoTree( mapDrawSurface_t *ds, tree_t *tree ){
return FilterPointIntoTree_r( ds->lightmapOrigin, ds, tree->headnode );
}
/*
EmitDrawVerts() - ydnar
emits bsp drawverts from a map drawsurface
@ -2557,17 +2465,17 @@ void EmitDrawIndexes( mapDrawSurface_t *ds, bspDrawSurface_t *out ){
/*
EmitFlareSurface()
emits a bsp flare drawsurface
EmitSurface()
emits a bsp drawsurface
*/
void EmitFlareSurface( mapDrawSurface_t *ds ){
void EmitSurface( mapDrawSurface_t *ds ){
int i;
bspDrawSurface_t *out;
/* ydnar: nuking useless flare drawsurfaces */
if ( emitFlares == qfalse && ds->type != SURFACE_SHADER ) {
/* ydnar: nuking useless drawsurfaces */
if ( ds->type != SURFACE_SHADER ) {
return;
}
@ -3503,7 +3411,7 @@ int AddSurfaceModels( mapDrawSurface_t *ds ){
}
break;
/* no support for flares, foghull, etc */
/* no support for foghull, etc */
default:
break;
}
@ -3658,11 +3566,6 @@ void FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree ){
Foliage( ds );
}
/* create a flare surface if necessary */
if ( si->flareShader != NULL && si->flareShader[ 0 ] ) {
AddSurfaceFlare( ds, e->origin );
}
/* ydnar: don't emit nodraw surfaces (like nodraw fog) */
if ( ( si->compileFlags & C_NODRAW ) && ds->type != SURFACE_PATCH ) {
continue;
@ -3750,20 +3653,10 @@ void FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree ){
}
break;
/* handle flares */
case SURFACE_FLARE:
if ( refs == 0 ) {
refs = FilterFlareSurfIntoTree( ds, tree );
}
if ( refs > 0 ) {
EmitFlareSurface( ds );
}
break;
/* handle shader-only surfaces */
case SURFACE_SHADER:
refs = 1;
EmitFlareSurface( ds );
EmitSurface( ds );
break;
/* no references */

View file

@ -537,8 +537,6 @@ typedef struct game_s
int maxLMSurfaceVerts; /* default maximum meta surface verts */
int maxSurfaceVerts; /* default maximum surface verts */
int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */
qboolean emitFlares; /* when true, emit flare surfaces */
char *flareShader; /* default flare shader (MUST BE SET) */
qboolean wolfLight; /* when true, lights work like wolf q3map */
int lightmapSize; /* bsp lightmap width/height */
float lightmapGamma; /* default lightmap gamma */
@ -681,7 +679,6 @@ typedef struct shaderInfo_s
int compileFlags;
float value; /* light value */
char *flareShader; /* for light flares */
char *damageShader; /* ydnar: sof2 damage shader name */
char *backShader; /* for surfaces that generate different front and back passes */
char *cloneShader; /* ydnar: for cloning of a surface */
@ -1043,9 +1040,9 @@ typedef struct mapDrawSurface_s
int *indexes;
int planeNum;
vec3_t lightmapOrigin; /* also used for flares */
vec3_t lightmapVecs[ 3 ]; /* also used for flares */
int lightStyle; /* used for flares */
vec3_t lightmapOrigin;
vec3_t lightmapVecs[ 3 ];
int lightStyle;
/* ydnar: per-surface (per-entity, actually) lightmap sample size scaling */
float lightmapScale;
@ -1709,7 +1706,6 @@ void ClearSurface( mapDrawSurface_t *ds );
void AddEntitySurfaceModels( entity_t *e );
mapDrawSurface_t *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, winding_t *w );
mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh );
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, const char *flareShader, int lightStyle );
mapDrawSurface_t *DrawSurfaceForShader( char *shader );
void ClipSidesIntoTree( entity_t *e, tree_t *tree );
void MakeDebugPortalSurfs( tree_t *tree );
@ -2025,7 +2021,6 @@ Q_EXTERN int texRange Q_ASSIGN( 0 );
Q_EXTERN qboolean flat Q_ASSIGN( qfalse );
Q_EXTERN qboolean meta Q_ASSIGN( qfalse );
Q_EXTERN qboolean patchMeta Q_ASSIGN( qfalse );
Q_EXTERN qboolean emitFlares Q_ASSIGN( qfalse );
Q_EXTERN qboolean debugSurfaces Q_ASSIGN( qfalse );
Q_EXTERN qboolean debugInset Q_ASSIGN( qfalse );
Q_EXTERN qboolean debugPortals Q_ASSIGN( qfalse );