X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=misc%2Ftools%2Fxonotic-map-compiler;h=f21daaf8dd6d9a6f591d757a6341fa4fb149492a;hp=d501437e4e2a23d3f779c452c4ddc0f23495b1ae;hb=c77d3763846c52e8a5848b1650fb5d3620b18235;hpb=fb187bb0cee595c3d0b0848aaac4592c25383e5e diff --git a/misc/tools/xonotic-map-compiler b/misc/tools/xonotic-map-compiler index d501437e..f21daaf8 100755 --- a/misc/tools/xonotic-map-compiler +++ b/misc/tools/xonotic-map-compiler @@ -25,13 +25,13 @@ use File::Temp; our $VISFLAGS = ''; # Default flags for the -light stage - our $LIGHTFLAGS = '-lightmapsearchpower 3 -deluxe -patchshadows -randomsamples -samples 4 -lightmapsize 512 -fast -fastbounce -dirty -bouncegrid -fill'; + our $LIGHTFLAGS = '-lightmapsize 1024 -lightmapsearchpower 4 -deluxe -patchshadows -randomsamples -samples 4 -fast -fastbounce -dirty -bouncegrid -fill'; # Default flags for the -minimap stage our $MINIMAPFLAGS = ''; # Default order of commands - our $ORDER = 'vis,light'; + our $ORDER = 'vis,light,scale'; # end of user changable part @@ -232,9 +232,15 @@ sub q3map2(@) } } -my ($prescale, $postscale) = ($options->{scalefactor} =~ /^([0-9.]+)(?::([0-9.]+))?$/); -$prescale = 1 if not defined $prescale; -$postscale = 1 if not defined $postscale; +if ($options->{scalefactor} =~ /^([0-9.]+):([0-9.]+)$/) +{ + die "Two-scale isn't supported" + if $1 != 1 and $2 != 1; + $options->{scalefactor} = $1 + if $2 == 1; + $options->{scalefactor} = $2 + if $1 == 1; +} my $origcwd = getcwd(); for my $m(@{$options->{maps}}) @@ -252,10 +258,8 @@ for my $m(@{$options->{maps}}) $m =~ s/\.(?:map|bsp)$//; - if($prescale != 1) - { - unshift @{$options->{bsp}}, "-keeplights"; - } + # never hurts, may help with rtlights + unshift @{$options->{bsp}}, "-keeplights"; local $SIG{INT} = sub { @@ -266,15 +270,8 @@ for my $m(@{$options->{maps}}) unlink <$m/lm_*>; # delete old external lightmaps q3map2 '-bsp', @{$options->{bsp}}, "$m.map" or die "-bsp: $?"; - if($prescale != 1) - { - q3map2 '-scale', @{$options->{scale}}, $prescale, "$m.bsp" - or die "-scale: $?"; - rename "${m}_s.bsp", "$m.bsp" - or die "rename ${m}_s.bsp $m.bsp: $!"; - } my @o = @{$options->{order}}; - push @o, qw/light vis/; + push @o, qw/vis scale light/; my %o = (); for(@o) @@ -296,14 +293,16 @@ for my $m(@{$options->{maps}}) or die "-vis: $?"; } } - } - - if($postscale != 1) - { - q3map2 '-scale', @{$options->{scale}}, $postscale, "$m.bsp" - or die "-scale: $?"; - rename "${m}_s.bsp", "$m.bsp" - or die "rename ${m}_s.bsp $m.bsp: $!"; + if($_ eq 'scale') + { + if ($options->{scalefactor} != 1) + { + q3map2 '-scale', @{$options->{scale}}, $options->{scalefactor}, "$m.bsp" + or die "-scale: $?"; + rename "${m}_s.bsp", "$m.bsp" + or die "rename ${m}_s.bsp $m.bsp: $!"; + } + } } if(defined $options->{minimap})