[nexuiz-commits] r6772 - trunk/misc/tools

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon May 25 14:34:08 EDT 2009


Author: div0
Date: 2009-05-25 14:34:07 -0400 (Mon, 25 May 2009)
New Revision: 6772

Modified:
   trunk/misc/tools/nexuiz-map-compiler
Log:
nexuiz-map-compiler: add option -order vis,light,minimap


Modified: trunk/misc/tools/nexuiz-map-compiler
===================================================================
--- trunk/misc/tools/nexuiz-map-compiler	2009-05-25 15:36:38 UTC (rev 6771)
+++ trunk/misc/tools/nexuiz-map-compiler	2009-05-25 18:34:07 UTC (rev 6772)
@@ -30,6 +30,9 @@
 	# Default flags for the -minimap stage
 	our $MINIMAPFLAGS = '';
 
+	# Default order of commands
+	our $ORDER = 'light,vis,minimap';
+
 # end of user changable part
 
 do "$ENV{HOME}/.nexuiz-map-compiler";
@@ -49,6 +52,7 @@
 	vis => [split /\s+/, $VISFLAGS],
 	light => [split /\s+/, $LIGHTFLAGS],
 	minimap => [split /\s+/, $MINIMAPFLAGS],
+	order => [split /\s*,\s*/, $ORDER],
 	maps => [],
 	scale => 1
 };
@@ -95,6 +99,10 @@
 	{
 		$options->{minimap} = undef;
 	}
+	elsif($_ eq '-order')
+	{
+		$options->{order} = [split /\s*,\s*/, shift @ARGV];
+	}
 	elsif($_ =~ /^-(-.*)/)
 	{
 		if($curmode eq 'maps')
@@ -244,16 +252,39 @@
 			rename "${m}_s.bsp", "$m.bsp"
 				or die "rename ${m}_s.bsp $m.bsp: $!";
 		}
-		if(defined $options->{light})
+		my @o = @{$options->{order}};
+		push @o, qw/light vis minimap/;
+		my %o = ();
+
+		for(@o)
 		{
-			q3map2 '-light',        @{$options->{light}}, "$m.map"
-				or die "-light: $?";
+			next if $o{$_}++;
+			if($_ eq 'light')
+			{
+				if(defined $options->{light})
+				{
+					q3map2 '-light',        @{$options->{light}}, "$m.map"
+						or die "-light: $?";
+				}
+			}
+			if($_ eq 'vis')
+			{
+				if(defined $options->{vis})
+				{
+					q3map2 '-vis',          @{$options->{vis}},   "$m.map"
+						or die "-vis: $?";
+				}
+			}
+			if($_ eq 'minimap')
+			{
+				if(defined $options->{minimap})
+				{
+					q3map2 '-minimap',      @{$options->{minimap}}, "$m.map"
+						or die "-minimap: $?";
+				}
+			}
 		}
-		if(defined $options->{vis})
-		{
-			q3map2 '-vis',          @{$options->{vis}},   "$m.map"
-				or die "-vis: $?";
-		}
+
 		if($postscale != 1)
 		{
 			q3map2 '-scale', $postscale, "$m.bsp"
@@ -261,11 +292,6 @@
 			rename "${m}_s.bsp", "$m.bsp"
 				or die "rename ${m}_s.bsp $m.bsp: $!";
 		}
-		if(defined $options->{minimap})
-		{
-			q3map2 '-minimap',      @{$options->{minimap}}, "$m.map"
-				or die "-minimap: $?";
-		}
 
 		unlink "$m.srf";
 



More information about the nexuiz-commits mailing list