X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Flightmaps_ydnar.c;h=3c1eed65c84d05f0027f95e9da655dcefdda2707;hb=75641556ded3511cdfbac2c573d3d9d57aa5b835;hp=e680fc0ce98d2c9b96472f306d63c0cfff8681cb;hpb=8b11f8469132140a6ef8fd8d935443ce17c77209;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/lightmaps_ydnar.c b/tools/quake3/q3map2/lightmaps_ydnar.c index e680fc0c..3c1eed65 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.c +++ b/tools/quake3/q3map2/lightmaps_ydnar.c @@ -2016,7 +2016,11 @@ static void FindOutLightmaps( rawLightmap_t *lm ) y = 0; /* walk the list of lightmap pages */ - for( i = noLightmapSearch ? numOutLightmaps - LIGHTMAP_RESERVE_COUNT : 0; i < numOutLightmaps; i++ ) + if(lightmapSearchBlockSize <= 0 || numOutLightmaps < LIGHTMAP_RESERVE_COUNT) + i = 0; + else + i = ((numOutLightmaps - LIGHTMAP_RESERVE_COUNT) / lightmapSearchBlockSize) * lightmapSearchBlockSize; + for( ; i < numOutLightmaps; i++ ) { /* get the output lightmap */ olm = &outLightmaps[ i ]; @@ -2075,7 +2079,7 @@ static void FindOutLightmaps( rawLightmap_t *lm ) olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) ); if( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) { - memcpy( olm, outLightmaps, (numOutLightmaps - 2) * sizeof( outLightmap_t ) ); + memcpy( olm, outLightmaps, (numOutLightmaps - LIGHTMAP_RESERVE_COUNT) * sizeof( outLightmap_t ) ); free( outLightmaps ); } outLightmaps = olm;