]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/main.c
support -sRGBcolor for flares
[xonotic/netradiant.git] / tools / quake3 / q3map2 / main.c
index f9017d5f938f1444e536979a3b0e9a4f6897885e..b8c469dbdbd16e0188dbe8c8125efe4ee7601f9f 100644 (file)
@@ -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)