X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fmain.c;h=b8c469dbdbd16e0188dbe8c8125efe4ee7601f9f;hb=870333585c699ba2915285311c284ef1b4a2f38e;hp=f9017d5f938f1444e536979a3b0e9a4f6897885e;hpb=aef478a99a9e9262ce1c79978df94ee4534aa42b;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index f9017d5f..b8c469db 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -361,7 +361,10 @@ determines solid non-sky brushes in the world void MiniMapSetupBrushes( void ) { - SetupBrushesFlags(C_SOLID | C_SKY, C_SOLID); + SetupBrushesFlags(C_SOLID | C_SKY, C_SOLID, 0, 0); + // at least one must be solid + // none may be sky + // not all may be nodraw } qboolean MiniMapEvaluateSampleOffsets(int *bestj, int *bestk, float *bestval) @@ -716,20 +719,25 @@ int MiniMapBSPMain( int argc, char **argv ) if(v > ma) ma = v; } - s = 1 / (ma - mi); - o = mi / (ma - mi); - - // equations: - // brightness + contrast * v - // after autolevel: - // brightness + contrast * (v * s - o) - // = - // (brightness - contrast * o) + (contrast * s) * v - minimap.brightness = minimap.brightness - minimap.contrast * o; - minimap.contrast *= s; - - Sys_Printf( "Auto level: Brightness changed to %f\n", minimap.brightness ); - Sys_Printf( "Auto level: Contrast changed to %f\n", minimap.contrast ); + if(ma > mi) + { + s = 1 / (ma - mi); + o = mi / (ma - mi); + + // equations: + // brightness + contrast * v + // after autolevel: + // brightness + contrast * (v * s - o) + // = + // (brightness - contrast * o) + (contrast * s) * v + minimap.brightness = minimap.brightness - minimap.contrast * o; + minimap.contrast *= s; + + Sys_Printf( "Auto level: Brightness changed to %f\n", minimap.brightness ); + Sys_Printf( "Auto level: Contrast changed to %f\n", minimap.contrast ); + } + else + Sys_Printf( "Auto level: failed because all pixels are the same value\n" ); } if(minimap.brightness != 0 || minimap.contrast != 1)