]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Merge branch 'master' into divVerent/crypto2
authorRudolf Polzer <divverent@alientrap.org>
Fri, 8 Oct 2010 19:45:54 +0000 (21:45 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 8 Oct 2010 19:45:54 +0000 (21:45 +0200)
Conflicts:
all

all
misc/tools/cached-converter.sh
misc/tools/fft-normalmap-to-heightmap.c
misc/tools/xonotic-map-compiler-autobuild

diff --git a/all b/all
index 12d312afbc8ffca5b09203bc66687b9f1da4335a..38c19007c51d70c5ae19bebae1a3c1d2fe77087e 100755 (executable)
--- a/all
+++ b/all
@@ -135,6 +135,18 @@ case "$base" in
                exit 1
                ;;
 esac
+pushbase=`git config remote.origin.pushurl || true`
+case "$pushbase" in
+       */xonotic.git)
+               pushbase=${pushbase%xonotic.git}
+               ;;
+       '')
+               ;;
+       *)
+               echo "The main repo is not xonotic.git, what have you done?"
+               exit 1
+               ;;
+esac
 
 repourl()
 {
@@ -157,6 +169,27 @@ repourl()
        fi
 }
 
+repopushurl()
+{
+       [ -n "$pushbase" ] || return 0
+       repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
+       if [ -n "$repo_t" ]; then
+               case "$repo_t" in
+                       *://*)
+                               ;;
+                       *)
+                               echo "$pushbase$repo_t"
+                               ;;
+               esac
+       else
+               if [ x"$1" = x"." ]; then
+                       echo "$pushbase""xonotic.git"
+               else
+                       echo "$pushbase${1##*/}.git"
+               fi
+       fi
+}
+
 repobranch()
 {
        repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
@@ -267,6 +300,13 @@ fix_upstream_rebase_mergefail()
 
 fix_git_config()
 {
+       verbose git config remote.origin.url "$1"
+       if [ -n "$2" ]; then
+               verbose git config remote.origin.pushurl "$2"
+       else
+               verbose git config --unset remote.origin.pushurl || true
+       fi
+       verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
        verbose git config core.autocrlf input
        if [ -z "`git config push.default`" ]; then
                verbose git config push.default current # or is tracking better?
@@ -296,20 +336,33 @@ case "$cmd" in
                        verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
                done
                ;;
+       fix_config)
+               for d in $repos; do
+                       url=`repourl "$d"`
+                       pushurl=`repopushurl "$d"`
+                       branch=`repobranch "$d"`
+                       if [ -d "$d0/$d" ]; then
+                               verbose cd "$d0/$d"
+                               fix_git_config "$url" "$pushurl"
+                               cd "$d0"
+                       fi
+               done
+               ;;
        update|pull)
                allow_pull=true
                if [ x"$1" = x"-N" ]; then
                        allow_pull=false
                fi
+               if $allow_pull; then
+                       "$SELF" fix_config
+               fi
                for d in $repos; do
                        url=`repourl "$d"`
+                       pushurl=`repopushurl "$d"`
                        branch=`repobranch "$d"`
                        if [ -d "$d0/$d" ]; then
                                if $allow_pull; then
                                        enter "$d0/$d" verbose
-                                       fix_git_config
-                                       verbose git config remote.origin.url "$url"
-                                       verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
                                        r=`git symbolic-ref HEAD`
                                        r=${r#refs/heads/}
                                        if git config branch.$r.remote >/dev/null 2>&1; then
@@ -332,7 +385,7 @@ case "$cmd" in
                        else
                                verbose git clone "$url" "$d0/$d"
                                enter "$d0/$d" verbose
-                               fix_git_config
+                               fix_git_config "$url" "$pushurl"
                                if [ "$branch" != "master" ]; then
                                        verbose git checkout --track -b "$branch" origin/"$branch"
                                fi
@@ -521,40 +574,48 @@ case "$cmd" in
                done
                ;;
        compile)
+               cleand0=false
+               cleandp=false
+               cleanqcc=false
+               cleanqc=false
+               debug=debug
+               while :; do
+                       case "$1" in
+                               -c)
+                                       cleand0=true
+                                       cleandp=true
+                                       cleanqcc=true
+                                       cleanqc=true
+                                       shift
+                                       ;;
+                               -r)
+                                       debug=release
+                                       shift
+                                       ;;
+                               *)
+                                       break
+                                       ;;
+                       esac
+               done
                if [ -z "$CC" ]; then
-                       export CC="gcc -DSUPPORT_IPV6"
+                       export CC="gcc -DSUPPORTIPV6"
                fi
                if [ -n "$WE_HATE_OUR_USERS" ]; then
-                       TARGETS="sv-debug cl-debug"
+                       TARGETS="sv-$debug cl-$debug"
                elif [ x"`uname`" = x"Darwin" ]; then
                        case "`uname -r`" in
                                ?.*)
-                                       TARGETS="sv-debug cl-debug sdl-debug"
+                                       TARGETS="sv-$debug cl-$debug sdl-$debug"
                                        ;;
                                *)
                                        # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
-                                       TARGETS="sv-debug sdl-debug"
+                                       TARGETS="sv-$debug sdl-$debug"
                                        ;;
                        esac
                        export CC="$CC -I$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
                else
-                       TARGETS="sv-debug cl-debug sdl-debug"
+                       TARGETS="sv-$debug cl-$debug sdl-$debug"
                fi
-               case "$1" in
-                       -c)
-                               cleand0=true
-                               cleandp=true
-                               cleanqcc=true
-                               cleanqc=true
-                               shift
-                               ;;
-                       *)
-                               cleand0=false
-                               cleandp=false
-                               cleanqcc=false
-                               cleanqc=false
-                               ;;
-               esac
                if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
                        # if we give the command make the arg "", it will surely fail (invalid filename),
                        # so better handle it as an empty client option
@@ -924,6 +985,8 @@ case "$cmd" in
                echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
                ;;
        clean)
+               "$SELF" fix_config
+               "$SELF" update -N
                force=false
                gotoupstream=false
                fetchupstream=false
index f6116a6571a71d55583a422fe0e63b6e3dea9872..e11b4576fa74441ef46f9d49668c5dadb3ee8a1a 100755 (executable)
@@ -41,6 +41,7 @@ cached()
        if ! $flag; then
                return 0
        fi
+       #sleep 0.25
        if [ x"$infile1" = x"$outfile1" ]; then
                keep=true
        fi
index 7b72fcbd8808a4678ed1e868e5ed1bbf8a3c0ecc..88ac27c9fde1e4288d3907f198669c0b06a6491a 100644 (file)
@@ -74,9 +74,9 @@ void nmap_to_hmap(unsigned char *map, const unsigned char *refmap, int w, int h,
                imgspace1[(w*y+x)] =  nx / nz * w; /* = dz/dx */
                imgspace2[(w*y+x)] = -ny / nz * h; /* = dz/dy */
 #else
-               imgspace1[(w*y+x)][0] =  nx / nz; /* = dz/dx */
+               imgspace1[(w*y+x)][0] =  nx / nz * w; /* = dz/dx */
                imgspace1[(w*y+x)][1] = 0;
-               imgspace2[(w*y+x)][0] = -ny / nz; /* = dz/dy */
+               imgspace2[(w*y+x)][0] = -ny / nz * h; /* = dz/dy */
                imgspace2[(w*y+x)][1] = 0;
 #endif
        }
@@ -122,7 +122,32 @@ void nmap_to_hmap(unsigned char *map, const unsigned char *refmap, int w, int h,
                        else
                                freqspace1[(w*y+x)] = 0;
 #else
-                       // not yet implemented
+                       fftw_complex response_x = {0, 0};
+                       fftw_complex response_y = {0, 0};
+                       double sum;
+                       for(i = -filterh / 2; i <= filterh / 2; ++i)
+                               for(j = -filterw / 2; j <= filterw / 2; ++j)
+                               {
+                                       response_x[0] += filter[(i + filterh / 2) * filterw + j + filterw / 2] * cos(-TWO_PI * (j * fx + i * fy));
+                                       response_x[1] += filter[(i + filterh / 2) * filterw + j + filterw / 2] * sin(-TWO_PI * (j * fx + i * fy));
+                                       response_y[0] += filter[(i + filterh / 2) * filterw + j + filterw / 2] * cos(-TWO_PI * (i * fx + j * fy));
+                                       response_y[1] += filter[(i + filterh / 2) * filterw + j + filterw / 2] * sin(-TWO_PI * (i * fx + j * fy));
+                               }
+
+                       sum = response_x[0] * response_x[0] + response_x[1] * response_x[1]
+                           + response_y[0] * response_y[0] + response_y[1] * response_y[1];
+
+                       if(sum > 0)
+                       {
+                               double s = freqspace1[(w*y+x)][0];
+                               freqspace1[(w*y+x)][0] = (response_x[0] * s                      + response_x[1] * freqspace1[(w*y+x)][1] + response_y[0] * freqspace2[(w*y+x)][0] + response_y[1] * freqspace2[(w*y+x)][1]) / sum;
+                               freqspace1[(w*y+x)][1] = (response_x[0] * freqspace1[(w*y+x)][1] - response_x[1] * s                      + response_y[0] * freqspace2[(w*y+x)][1] - response_y[1] * freqspace2[(w*y+x)][0]) / sum;
+                       }
+                       else
+                       {
+                               freqspace1[(w*y+x)][0] = 0;
+                               freqspace1[(w*y+x)][1] = 0;
+                       }
 #endif
                }
                else
@@ -168,7 +193,8 @@ void nmap_to_hmap(unsigned char *map, const unsigned char *refmap, int w, int h,
                v = creal(imgspace1[(w*y+x)] /= pow(w*h, 1.5));
 #else
                v = (imgspace1[(w*y+x)][0] /= pow(w*h, 1.5));
-               imgspace1[(w*y+x)][1] /= pow(w*h, 1.5);
+               // imgspace1[(w*y+x)][1] /= pow(w*h, 1.5);
+               // this value is never used
 #endif
                if(v < vmin || (x == 0 && y == 0))
                        vmin = v;
index 5c6db64de23a62450129bfe934511064b0d6b204..d366157d3df2f4db0f7fc70839c418ddf2e89de3 100755 (executable)
@@ -14,17 +14,27 @@ getthemap_fail=false
 
 allmaps()
 {
-       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=`git ls-files -s -- "$F" | cut -d ' ' -f 2`-`git ls-files -s -- "${F%.options}" | cut -d ' ' -f 2`
-               "$@" "$M" "$blobhash"
+       commithash=$1
+       shift
+       for F in `git show "${commithash}:maps/"`; do
+               case "$F" in
+                       *.map.options)
+                               ;;
+                       *)
+                               continue
+                               ;;
+               esac
+               M=${F%.map.options}
+               blobhash=`git rev-parse --revs-only "${commithash}:maps/$M.map.options" || true`-`git rev-parse --revs-only "${commithash}:maps/$M.map" || true`
+               case "$blobhash" in
+                       -*)
+                               ;;
+                       *-)
+                               ;;
+                       *)
+                               "$@" "$M" "$blobhash" "$commithash"
+                               ;;
+               esac
        done
 }
 
@@ -144,26 +154,37 @@ log2spam()
 buildthemap()
 {
        REFNAME=$1
-       HASH=$2
-       url=$3
-       M=$4
-       blobhash=$5
+       url=$2
+       M=$3
+       blobhash=$4
+       commithash=$5
        if HEAD "$url$M-$blobhash.pk3"; then
                continue
        fi
+
+       git reset --hard
+       git clean -xfd
+       git checkout -f "$commithash"
+
        if [ -n "$IRCSPAM" ]; then
-               pre2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" | $IRCSPAM
+               pre2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$commithash" | $IRCSPAM
        fi
        t0=`date +%s`
        (
                cd maps
-               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $build_override > "$M.log"
+               sz=`grep '^size ' "$M.mapinfo" 2>/dev/null || true`
+               if [ -n "$sz" ]; then
+                       minimap_override="-minimap + -minmax ${sz#size }"
+               else
+                       minimap_override=
+               fi
+               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $minimap_override $build_override > "$M.log"
        )
        t1=`date +%s`
        dt=$(($t1 - $t0))
        status=$?
        if [ -n "$IRCSPAM" ]; then
-               cat "maps/$M.log" | log2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" "$status" "$dt" > "maps/$M.irc"
+               cat "maps/$M.log" | log2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$commithash" "$status" "$dt" > "maps/$M.irc"
        fi
        zip -9r "$M-$blobhash.pk3" "maps/$M.bsp" "maps/$M.log" "maps/$M.irc" "maps/$M/" "maps/$M.lin" "gfx/${M}_mini.tga"
        ln -snf "../$M-$blobhash.pk3" "$M.pk3" # from ALL branches, so beware!
@@ -180,13 +201,14 @@ buildthemap()
 screenshotthemap()
 {
        REFNAME=$1
-       HASH=$2
-       url=$3
-       M=$4
-       blobhash=$5
+       url=$2
+       M=$3
+       blobhash=$4
+       commithash=$5
        if HEAD "$url$M-$blobhash/"; then
                continue
        fi
+
        rm -rf ~/.xonotic
        (
                cd ../..
@@ -198,14 +220,14 @@ screenshotthemap()
        )
        if ! mv ~/.xonotic/data/screenshots "$M-$blobhash"; then
                if [ -n "$IRCSPAM" ]; then
-                       #ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" 1 > "maps/$M.ircss"
-                       ss2spam "$M" "$url?d" "$REFNAME" "$HASH" 1 > "maps/$M.ircss"
+                       #ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$commithash" 1 > "maps/$M.ircss"
+                       ss2spam "$M" "$url?d" "$REFNAME" "$commithash" 1 > "maps/$M.ircss"
                fi
                return 1
        fi
        if [ -n "$IRCSPAM" ]; then
-               #ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" 0 > "maps/$M.ircss"
-               ss2spam "$M" "$url?d" "$REFNAME" "$HASH" 0 > "maps/$M.ircss"
+               #ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$commithash" 0 > "maps/$M.ircss"
+               ss2spam "$M" "$url?d" "$REFNAME" "$commithash" 0 > "maps/$M.ircss"
        fi
        chmod 1777 "$M-$blobhash"
        ln -snf "../$M-$blobhash" "$M" # from ALL branches, so beware!
@@ -223,6 +245,7 @@ getthemap()
        bspdir=$3
        M=$4
        blobhash=$5
+       commithash=$6
        if mv "$bspdir_old/$M-$blobhash.pk3" "$bspdir/$M-$blobhash.pk3"; then
                continue
        fi
@@ -242,69 +265,86 @@ getthemap()
        fi
 }
 
+indexthemap()
+{
+       REFNAME=$1
+       M=$2
+       blobhash=$3
+       commithash=$4
+       echo "$M $blobhash $commithash $REFNAME"
+}
+
+rundownload()
+{
+       mkdir -p "$bspdir" "$bspdir.old"
+       for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
+               if [ -e "$b" ]; then
+                       mv "$b" "$bspdir.old"/
+               fi
+       done
+       allmaps "HEAD" getthemap "$url_http" "$bspdir.old" "$bspdir"
+}
+
+branches()
+{
+       git for-each-ref 'refs/remotes' | grep -vE '    refs/remotes/([^/]*/HEAD|.*/archived/.*)$'
+}
+
+runmakeindex()
+{
+       cd data/xonotic-maps.pk3dir
+       branches | while read -r HASH TYPE REFNAME; do
+               allmaps "$HASH" indexthemap "$REFNAME"
+       done
+       cd ../..
+}
+
 case "$1" in
        build)
                cd data/xonotic-maps.pk3dir
-               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       case "$REFNAME" in
-                               */archived/*)
-                                       continue
-                                       ;;
-                       esac
+               branches | while read -r HASH TYPE REFNAME; do
                        if [ -f "$build_cachedir/$HASH" ]; then
                                continue
                        fi
-                       git reset --hard
-                       git clean -xfd
-                       git checkout -f "$HASH"
-                       allmaps buildthemap "$REFNAME" "$HASH" "$url_http"
+                       allmaps "$HASH" buildthemap "$REFNAME" "$url_http"
                        touch "$build_cachedir/$HASH"
                done
                git checkout -f master
                ;;
        screenshot)
+               runmakeindex > "branches.idx.new"
+               rsync -vaSHP "branches.idx.new" "$url_ssh""branches.idx.new"
+               rm -f "branches.idx.new"
                cd data/xonotic-maps.pk3dir
-               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       case "$REFNAME" in
-                               */archived/*)
-                                       continue
-                                       ;;
-                       esac
+               branches | while read -r HASH TYPE REFNAME; do
                        if [ -f "$screenshot_cachedir/$HASH" ]; then
                                continue
                        fi
+
                        git reset --hard
                        git clean -xfd
                        git checkout -f "$HASH"
 
-                       cd ../..
-                       mkdir -p "$bspdir" "$bspdir.old"
-                       for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
-                               if [ -e "$b" ]; then
-                                       mv "$b" "$bspdir.old"/
-                               fi
-                       done
-                       cd data/xonotic-maps.pk3dir
-                       allmaps getthemap "$url_http" "$bspdir.old" "$bspdir"
-
-                       if ! $getthemap_fail; then
-                               allmaps screenshotthemap "$REFNAME" "$HASH" "$url_http"
-                               touch "$screenshot_cachedir/$HASH"
+                       rundownload
+                       if $getthemap_fail; then
+                               continue
                        fi
+
+                       allmaps "$HASH" screenshotthemap "$REFNAME" "$url_http"
+
+                       touch "$screenshot_cachedir/$HASH"
                done
                git checkout -f master
                ;;
+       makeindex)
+               runmakeindex
+               ;;
        download)
-               mkdir -p "$bspdir" "$bspdir.old"
-               for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
-                       if [ -e "$b" ]; then
-                               mv "$b" "$bspdir.old"/
-                       fi
-               done
                cd data/xonotic-maps.pk3dir
-               allmaps getthemap "$url_http" "$bspdir.old" "$bspdir"
+               rundownload
+               cd ../..
                echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"
-               ls -l "$bspdir.old"
+               ls -l "$bspdir.old" || true
                ;;
        download-latest)
                mkdir -p "$bspdir"