tweak light styles checks
This commit is contained in:
parent
d40538eea0
commit
1fb1896f11
|
|
@ -428,7 +428,7 @@ static void CreateEntityLights(){
|
||||||
/* set origin */
|
/* set origin */
|
||||||
light.origin = e.vectorForKey( "origin" );
|
light.origin = e.vectorForKey( "origin" );
|
||||||
e.read_keyvalue( light.style, "_style", "style" );
|
e.read_keyvalue( light.style, "_style", "style" );
|
||||||
if ( light.style < LS_NORMAL || light.style >= LS_NONE ) {
|
if ( !style_is_valid( light.style ) ) {
|
||||||
Error( "Invalid lightstyle (%d) on entity %zu", light.style, i );
|
Error( "Invalid lightstyle (%d) on entity %zu", light.style, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -487,10 +487,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
|
||||||
light.photons = value * area * areaScale;
|
light.photons = value * area * areaScale;
|
||||||
light.add = value * formFactorValueScale * areaScale;
|
light.add = value * formFactorValueScale * areaScale;
|
||||||
light.color = si->color;
|
light.color = si->color;
|
||||||
light.style = noStyles ? LS_NORMAL : si->lightStyle;
|
light.style = noStyles || !style_is_valid( si->lightStyle )? LS_NORMAL : si->lightStyle;
|
||||||
if ( light.style < LS_NORMAL || light.style >= LS_NONE ) {
|
|
||||||
light.style = LS_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set origin */
|
/* set origin */
|
||||||
light.origin = minmax.origin();
|
light.origin = minmax.origin();
|
||||||
|
|
@ -542,10 +539,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
|
||||||
splash.si = si;
|
splash.si = si;
|
||||||
splash.color = si->color;
|
splash.color = si->color;
|
||||||
splash.falloffTolerance = falloffTolerance;
|
splash.falloffTolerance = falloffTolerance;
|
||||||
splash.style = noStyles ? LS_NORMAL : si->lightStyle;
|
splash.style = noStyles || !style_is_valid( si->lightStyle )? LS_NORMAL : si->lightStyle;
|
||||||
if ( splash.style < LS_NORMAL || splash.style >= LS_NONE ) {
|
|
||||||
splash.style = LS_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a regular winding */
|
/* create a regular winding */
|
||||||
splash.w = AllocWinding( rw->numVerts );
|
splash.w = AllocWinding( rw->numVerts );
|
||||||
|
|
@ -568,10 +562,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
|
||||||
light.photons = value * area * bounceScale;
|
light.photons = value * area * bounceScale;
|
||||||
light.add = value * formFactorValueScale * bounceScale;
|
light.add = value * formFactorValueScale * bounceScale;
|
||||||
light.color = color;
|
light.color = color;
|
||||||
light.style = noStyles ? LS_NORMAL : style;
|
light.style = noStyles || !style_is_valid( style )? LS_NORMAL : style;
|
||||||
if ( light.style < LS_NORMAL || light.style >= LS_NONE ) {
|
|
||||||
light.style = LS_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set origin */
|
/* set origin */
|
||||||
light.origin = WindingCenter( light.w );
|
light.origin = WindingCenter( light.w );
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,8 @@ enum class EBrushType
|
||||||
#define LS_UNUSED 0xFE
|
#define LS_UNUSED 0xFE
|
||||||
#define LS_NONE 0xFF
|
#define LS_NONE 0xFF
|
||||||
|
|
||||||
|
inline bool style_is_valid( int style ){ return LS_NORMAL <= style && style < LS_NONE; }
|
||||||
|
|
||||||
#define MAX_LIGHTMAP_SHADERS 256
|
#define MAX_LIGHTMAP_SHADERS 256
|
||||||
|
|
||||||
/* ok to increase these at the expense of more memory */
|
/* ok to increase these at the expense of more memory */
|
||||||
|
|
|
||||||
|
|
@ -1256,7 +1256,7 @@ static void ParseShaderFile( const char *filename ){
|
||||||
/* q3map_lightStyle (sof2/jk2 lightstyle) */
|
/* q3map_lightStyle (sof2/jk2 lightstyle) */
|
||||||
else if ( striEqual( token, "q3map_lightStyle" ) ) {
|
else if ( striEqual( token, "q3map_lightStyle" ) ) {
|
||||||
text.GetToken( false );
|
text.GetToken( false );
|
||||||
si->lightStyle = std::clamp( atoi( token ), 0, LS_NONE );
|
si->lightStyle = std::clamp( atoi( token ), LS_NORMAL, LS_NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wolf: q3map_lightRGB <red> <green> <blue> */
|
/* wolf: q3map_lightRGB <red> <green> <blue> */
|
||||||
|
|
|
||||||
|
|
@ -1071,10 +1071,7 @@ mapDrawSurface_t *DrawSurfaceForFlare( int entNum, const Vector3& origin, const
|
||||||
ds->lightmapVecs[ 0 ] = color;
|
ds->lightmapVecs[ 0 ] = color;
|
||||||
|
|
||||||
/* store light style */
|
/* store light style */
|
||||||
ds->lightStyle = lightStyle;
|
ds->lightStyle = style_is_valid( lightStyle )? lightStyle : LS_NORMAL;
|
||||||
if ( ds->lightStyle < 0 || ds->lightStyle >= LS_NONE ) {
|
|
||||||
ds->lightStyle = LS_NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fixme: fog */
|
/* fixme: fog */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ void SetLightStyles(){
|
||||||
|
|
||||||
/* get existing style */
|
/* get existing style */
|
||||||
const int style = e.intForKey( "style" );
|
const int style = e.intForKey( "style" );
|
||||||
if ( style < LS_NORMAL || style > LS_NONE ) {
|
if ( !style_is_valid( style ) ) {
|
||||||
Error( "Invalid lightstyle (%d) on entity %zu", style, i );
|
Error( "Invalid lightstyle (%d) on entity %zu", style, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,7 +287,7 @@ void SetLightStyles(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set explicit style */
|
/* set explicit style */
|
||||||
sprintf( value, "%d", 32 + j );
|
sprintf( value, "%d", MAX_SWITCHED_LIGHTS + j );
|
||||||
e.setKeyValue( "style", value );
|
e.setKeyValue( "style", value );
|
||||||
|
|
||||||
/* set old style */
|
/* set old style */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user