diff --git a/tools/quake3/q3map2/bspfile_ibsp.cpp b/tools/quake3/q3map2/bspfile_ibsp.cpp index 607224bc..373328c7 100644 --- a/tools/quake3/q3map2/bspfile_ibsp.cpp +++ b/tools/quake3/q3map2/bspfile_ibsp.cpp @@ -142,7 +142,7 @@ struct ibspDrawSurface_t .numIndexes = numIndexes, .lightmapStyles { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }, .vertexStyles { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }, - .lightmapNum { lightmapNum, -3, -3, -3 }, + .lightmapNum { lightmapNum, LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX }, .lightmapX { lightmapX, 0, 0, 0 }, .lightmapY { lightmapY, 0, 0, 0 }, .lightmapWidth = lightmapWidth, diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index 2fb28bf6..39235f7f 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -746,7 +746,7 @@ int MergeBSPMain( Args& args ){ fog.brushNum += bspBrushes.size(); /* deduce max lm index, using bspLightBytes is insufficient for native external lightmaps */ - int maxLmIndex = -3; + int maxLmIndex = LIGHTMAP_BY_VERTEX; for( const auto& surf : bspDrawSurfaces ) for( auto index : surf.lightmapNum ) value_maximize( maxLmIndex, index ); diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index 27ab045a..59b77124 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -1865,7 +1865,7 @@ static void WriteBSPFileAfterLight( const char *bspFileName ){ out.lightmapStyles.fill( LS_NONE ); out.vertexStyles.fill( LS_NONE ); - out.lightmapNum.fill( -3 ); + out.lightmapNum.fill( LIGHTMAP_BY_VERTEX ); } bakDrawSurfaces.insert( bakDrawSurfaces.cend(), bspDrawSurfaces.cbegin(), bspDrawSurfaces.cend() ); @@ -1896,7 +1896,7 @@ static void WriteBSPFileAfterLight( const char *bspFileName ){ for( auto& ds : bspDrawSurfaces ){ if( ds.surfaceType == MST_PLANAR ){ ds.surfaceType = MST_TRIANGLE_SOUP; - ds.lightmapNum[ 0 ] = -3; + ds.lightmapNum[ 0 ] = LIGHTMAP_BY_VERTEX; } } } diff --git a/tools/quake3/q3map2/lightmaps_ydnar.cpp b/tools/quake3/q3map2/lightmaps_ydnar.cpp index a59dd447..e2b7f2ee 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.cpp +++ b/tools/quake3/q3map2/lightmaps_ydnar.cpp @@ -1754,7 +1754,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){ } } else{ - olm->lightmapNum = -3; + olm->lightmapNum = LIGHTMAP_BY_VERTEX; } /* set external lightmap number */ @@ -1791,8 +1791,8 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ int xIncrement, yIncrement; - /* set default lightmap number (-3 = LIGHTMAP_BY_VERTEX) */ - lm->outLightmapNums.fill( -3 ); + /* set default lightmap number */ + lm->outLightmapNums.fill( LIGHTMAP_BY_VERTEX ); /* can this lightmap be approximated with vertex color? */ if ( ApproximateLightmap( lm ) ) { @@ -3027,7 +3027,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* handle vertex lit or approximated surfaces */ else if ( lm == nullptr || lm->outLightmapNums[ 0 ] < 0 ) { ds.lightmapStyles = ds.vertexStyles; - ds.lightmapNum.fill( -3 ); + ds.lightmapNum.fill( LIGHTMAP_BY_VERTEX ); } /* handle lightmapped surfaces */ @@ -3041,7 +3041,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* handle unused style */ if ( lm->styles[ lightmapNum ] == LS_NONE || lm->outLightmapNums[ lightmapNum ] < 0 ) { - ds.lightmapNum[ lightmapNum ] = -3; + ds.lightmapNum[ lightmapNum ] = LIGHTMAP_BY_VERTEX; continue; } diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 27783456..fd8fec1b 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -187,6 +187,7 @@ enum class EBrushType #define EXTERNAL_LIGHTMAP "lm_%04d.tga" #define MAX_LIGHTMAPS 4 /* RBSP */ +#define LIGHTMAP_BY_VERTEX -3 #define MAX_SWITCHED_LIGHTS 32 #define LS_NORMAL 0x00 #define LS_UNUSED 0xFE diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index d80697e8..23a349d9 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -2001,7 +2001,7 @@ static void EmitFlareSurface( mapDrawSurface_t& ds ){ /* RBSP */ out.lightmapStyles = { byte( ds.lightStyle ), LS_NONE, LS_NONE, LS_NONE }; out.vertexStyles = { byte( ds.lightStyle ), LS_NONE, LS_NONE, LS_NONE }; - out.lightmapNum.fill( -3 ); + out.lightmapNum.fill( LIGHTMAP_BY_VERTEX ); out.lightmapOrigin = ds.lightmapOrigin; /* origin */ out.lightmapVecs[ 0 ] = ds.lightmapVecs[ 0 ]; /* color */ @@ -2075,7 +2075,7 @@ static void EmitPatchSurface( const entity_t& e, mapDrawSurface_t& ds ){ /* RBSP */ out.lightmapStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }; out.vertexStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }; - out.lightmapNum.fill( -3 ); + out.lightmapNum.fill( LIGHTMAP_BY_VERTEX ); /* ydnar: gs mods: previously, the lod bounds were stored in lightmapVecs[ 0 ] and [ 1 ], moved to bounds[ 0 ] and [ 1 ] */ out.lightmapOrigin = ds.lightmapOrigin; @@ -2376,7 +2376,7 @@ static void EmitTriangleSurface( mapDrawSurface_t& ds ){ /* RBSP */ out.lightmapStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }; out.vertexStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE }; - out.lightmapNum.fill( -3 ); + out.lightmapNum.fill( LIGHTMAP_BY_VERTEX ); /* lightmap vectors (lod bounds for patches) */ out.lightmapOrigin = ds.lightmapOrigin;