From: Rudolf Polzer Date: Thu, 6 May 2010 18:17:03 +0000 (+0200) Subject: Merge branch 'master' of ssh://xonotic@git.xonotic.org/xonotic X-Git-Tag: xonotic-v0.1.0preview~473 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=623a131a558d528a5ddc58ca580980ef8d4067db;hp=7bb12633412c3c067957b637b2127114e28a22cd Merge branch 'master' of ssh://xonotic@git.xonotic.org/xonotic --- diff --git a/misc/tools/xonotic-map-compiler b/misc/tools/xonotic-map-compiler index ae819b07..8b6cd4d5 100755 --- a/misc/tools/xonotic-map-compiler +++ b/misc/tools/xonotic-map-compiler @@ -99,6 +99,10 @@ while(@ARGV) { $options->{minimap} = undef; } + elsif($_ eq '-noshaderlist') + { + $options->{noshaderlist} = 1; + } elsif($_ eq '-order') { $options->{order} = [split /\s*,\s*/, shift @ARGV]; @@ -171,60 +175,73 @@ for my $m(@{$options->{maps}}) my %shaders = map { m!/([^/.]*)\.shader(?:$)! ? ($1 => 1) : () } glob "../scripts/*.shader"; - my $previous_shaderlist = undef; - my $shaderlist = ""; - if(open my $fh, "<", "$XONOTICDIR/data/xonotic-maps.pk3dir/scripts/shaderlist.txt") + my $restore_shaderlist = sub { }; + if(!$options->{noshaderlist}) { - while(<$fh>) + my $previous_shaderlist = undef; + my $shaderlist = ""; + if(open my $fh, "<", "$XONOTICDIR/data/xonotic-maps.pk3dir/scripts/shaderlist.txt") { - $shaderlist .= $_; - } + while(<$fh>) + { + $shaderlist .= $_; + } - # we may have to restore the file on exit - $previous_shaderlist = $shaderlist - if "$XONOTICDIR/data" eq $mapdir; - } - else - { - # possibly extract the shader list from a pk3? - local $ENV{N} = $XONOTICDIR; - $shaderlist = `cd "\$N" && for X in "\$N"/data/data*.pk3; do Y=\$X; done; unzip -p "\$Y" scripts/shaderlist.txt`; - } + # we may have to restore the file on exit + $previous_shaderlist = $shaderlist + if "$XONOTICDIR/data" eq $mapdir; + } + else + { + # possibly extract the shader list from a pk3? + local $ENV{N} = $XONOTICDIR; + $shaderlist = `cd "\$N" && for X in "\$N"/data/data*.pk3; do Y=\$X; done; unzip -p "\$Y" scripts/shaderlist.txt`; + } - my $shaderlist_new = ""; - for(split /\r?\n|\r/, $shaderlist) - { - delete $shaders{$_}; - $shaderlist_new .= "$_\n"; - } - if(%shaders) - { - for(sort keys %shaders) + my $shaderlist_new = ""; + for(split /\r?\n|\r/, $shaderlist) { + delete $shaders{$_}; $shaderlist_new .= "$_\n"; } - } - else - { - $shaderlist_new = undef; - } - - my $restore_shaderlist = sub - { - if(defined $shaderlist_new) + if(%shaders) { - if(defined $previous_shaderlist) + for(sort keys %shaders) { - open my $fh, ">", "$mapdir/scripts/shaderlist.txt"; - print $fh $previous_shaderlist; - close $fh; + $shaderlist_new .= "$_\n"; } - else + } + else + { + $shaderlist_new = undef; + } + + $restore_shaderlist = sub + { + if(defined $shaderlist_new) { - unlink "$mapdir/scripts/shaderlist.txt"; + if(defined $previous_shaderlist) + { + open my $fh, ">", "$mapdir/scripts/shaderlist.txt"; + print $fh $previous_shaderlist; + close $fh; + } + else + { + unlink "$mapdir/scripts/shaderlist.txt"; + } } + }; + + if(defined $shaderlist_new) + { + mkdir "$mapdir/scripts"; + open my $fh, ">", "$mapdir/scripts/shaderlist.txt"; + print $fh $shaderlist_new; + close $fh; } - }; + } + local $SIG{INT} = sub { print "SIGINT caught, cleaning up...\n"; @@ -234,14 +251,6 @@ for my $m(@{$options->{maps}}) eval { - if(defined $shaderlist_new) - { - mkdir "$mapdir/scripts"; - open my $fh, ">", "$mapdir/scripts/shaderlist.txt"; - print $fh $shaderlist_new; - close $fh; - } - unlink <$m/lm_*>; # delete old external lightmaps q3map2 '-bsp', @{$options->{bsp}}, "$m.map" or die "-bsp: $?"; diff --git a/misc/tools/xonotic-map-compiler-autobuild b/misc/tools/xonotic-map-compiler-autobuild new file mode 100755 index 00000000..8249686d --- /dev/null +++ b/misc/tools/xonotic-map-compiler-autobuild @@ -0,0 +1,30 @@ +#!/bin/sh + +bspdir="$PWD/bspfiles" +mkdir -p "$bspdir" +cd data/xonotic-maps.pk3dir +git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do + git reset --hard + git clean -xfd + git checkout "$HASH" + for F in maps/*.map.options; do + if ! [ -f "$F" ]; then + continue + fi + if ! [ -f "${F%.options}" ]; then + continue + fi + M=${F#maps/} + M=${M%.map.options} + blobhash="$M"-`git ls-files -s -- "$F" | cut -d ' ' -f 2`-`git ls-files -s -- "${F%.options}" | cut -d ' ' -f 2` + if [ -f "$bspdir/$blobhash.pk3" ]; then + continue + fi + ( + cd maps + ../../../misc/tools/xonotic-map-compiler "$M" -noshaderlist `head -n 1 "../$F"` 2>&1 | tee "$M.log" + ) + zip -9r "$bspdir/$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M/" "maps/$M.lin" "gfx/${M}_mini.tga" + done +done +git checkout master