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

all
data/font-nimbussansl.pk3dir/font-nimbussansl.cfg
misc/tools/shadescript/howto.txt [new file with mode: 0644]
misc/tools/shadescript/shade.sh [new file with mode: 0644]
misc/tools/shadescript/shade.vbs [new file with mode: 0644]
misc/tools/shadescript/template.shader [new file with mode: 0644]
misc/tools/xonotic-map-compiler-autobuild
misc/tools/xonotic-map-screenshot [new file with mode: 0755]
savecore.gdb [new file with mode: 0644]

diff --git a/all b/all
index 593e0b2e740b55715ff379803f69373d0b1c96d9..a4d195484e8d40245bd4b135b64a0c2ddcd213d9 100755 (executable)
--- a/all
+++ b/all
@@ -119,7 +119,7 @@ div0-gittools                 |
 d0_blind_id                   | http://github.com/divVerent/d0_blind_id.git       | master      |
 data/xonotic-maps.pk3dir      |                                                   | master      |
 mediasource                   |                                                   | master      | no
-fteqcc                        | git://github.com/Blub/qclib.git                   | master      |
+fteqcc                        | http://github.com/Blub/qclib.git                  | master      |
 "
 # todo: in darkplaces, change repobranch to div0-stable
 
@@ -667,9 +667,7 @@ case "$cmd" in
                                exit 1
                        fi
                fi
-               set -- "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic -mygames "$@"
-               # change this to:
-               #set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
+               set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
 
                # if pulseaudio is running: USE IT
                if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
@@ -680,10 +678,29 @@ case "$cmd" in
                        fi
                fi
 
+               binary=$1
+
                if [ -n "$USE_GDB" ]; then
                        set -- gdb --args "$@"
+               elif which gdb >/dev/null 2>&1; then
+                       set -- gdb --batch -x savecore.gdb --args "$@"
+               elif which catchsegv >/dev/null 2>&1; then
+                       set -- catchsegv "$@"
+               fi
+               rm -f xonotic.core
+               "$@" || true
+               if [ -f xonotic.core ]; then
+                       if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
+                               gdb "$binary" xonotic.core
+                       #elif yesno "You did not want to examine the core dump. Do you want to provide it - including your DarkPlaces checkout - to the Xonotic developers?"; then
+                       #       tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
+                       #       # somehow send it
+                       #       rm -f xonotic.core.tar.gz
+                       else
+                               echo "The core dump can be examined later by"
+                               echo "  gdb $binary xonotic.core"
+                       fi
                fi
-               "$@"
                ;;
        each|foreach)
                keep_going=false
@@ -847,7 +864,7 @@ case "$cmd" in
                                                        GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
                                                        reportdo4 cat "$t"
                                                        reportecho4 "--> merge failed"
-                                               elif ! "$SELF" compile -n 2>&1 | tee "$t"; then
+                                               elif ! "$SELF" compile 2>&1 | tee "$t"; then
                                                        git reset --hard "$org"
                                                        GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
                                                        reportdo4 cat "$t"
@@ -964,6 +981,7 @@ case "$cmd" in
                                if $gotomaster; then
                                        if $fetchupstream; then
                                                verbose git fetch origin
+                                               verbose git remote prune origin
                                        fi
                                        verbose git checkout -f "`repobranch "$d"`"
                                        verbose git reset --hard origin/"`repobranch "$d"`"
@@ -975,6 +993,7 @@ case "$cmd" in
                                        upstream="$rem/${bra#refs/heads/}"
                                        if $fetchupstream; then
                                                verbose git fetch "$rem"
+                                               verbose git remote prune "$rem"
                                        fi
                                        if ! git rev-parse "$upstream" >/dev/null 2>&1; then
                                                upstream="origin/`repobranch "$d"`"
@@ -1134,44 +1153,44 @@ case "$cmd" in
                ;;
        release-engine-win32)
                verbose "$SELF" release-compile win32 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
                        win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
                        '' ''
                verbose "$SELF" release-compile win32 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=0' \
                        '' '' \
                        release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
                ;;
        release-engine-win64)
                verbose "$SELF" release-compile win64 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DSUPPORTIPV6" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
                        win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
                        'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
                verbose "$SELF" release-compile win64 \
-                       'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
+                       'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=0' \
                        '' '' \
                        cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
                ;;
        release-engine-osx)
                # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
                verbose "$SELF" release-compile osx \
-                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks"' \
+                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks -DSUPPORTIPV6"' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
                        'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
                verbose "$SELF" release-compile osx \
-                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks"' \
+                       'STRIP=: CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks -DSUPPORTIPV6"' \
                        '' '' \
                        'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
                ;;
        release-engine-linux32)
                verbose "$SELF" release-compile linux32 \
-                       'STRIP=: CC="gcc -m32 -g -I.deps/include -L.deps/lib" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
+                       'STRIP=: CC="gcc -m32 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
                        release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
                ;;
        release-engine-linux64)
                verbose "$SELF" release-compile linux64 \
-                       'STRIP=: CC="gcc -m64 -g -I.deps/include -L.deps/lib" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
+                       'STRIP=: CC="gcc -m64 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
                        all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
                        release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
                ;;
index 4afab42f1296bab6d02029c86d70215b3e616d8f..0406392e23c8fa1a363630d9d1ca40887017ccea 100644 (file)
@@ -9,6 +9,6 @@ loadfont chat fonts/n019004l.pfb,gfx/vera-sans $con_chatsize
 loadfont centerprint fonts/unifont-5.1.20080907,gfx/vera-sans 9
 loadfont infobar gfx/vera-sans 8
 loadfont user0 fonts/n019004l.pfb,fonts/unifont-5.1.20080907,gfx/vera-sans 9.6 12 12.8 16
-loadfont user1 fonts/n019004l.pfb,fonts/unifont-5.1.20080907,gfx/vera-sans 4 5 6 7 8 9 10 12 $sbar_fontsize $scr_centersize // csqc font
+loadfont user1 fonts/n019004l.pfb,fonts/unifont-5.1.20080907,gfx/vera-sans 4 6 8 10 12 $hud_fontsize $scr_centersize // csqc font
 loadfont user2 fonts/n019004l.pfb,fonts/unifont-5.1.20080907,gfx/vera-sans 10 12 14 16 20 24 28 32 // csqc bigfont
 scoreboard_columns_set
diff --git a/misc/tools/shadescript/howto.txt b/misc/tools/shadescript/howto.txt
new file mode 100644 (file)
index 0000000..891b114
--- /dev/null
@@ -0,0 +1,9 @@
+First make sure your textures are in the correct paths, eg
+Correct: textures/yourset/wall/bricks.tga
+Wrong: textures/yourset/bricks.tga
+
+Copy shade.vbs and template.shader to textures/yourset/
+
+Edit the template.shader if you need non standard stuff
+
+Run the shade.vbs, copy textures/yourset/yourset.shader to scripts/yourset.shader, add yourset to scripts/shaderlist.txt
\ No newline at end of file
diff --git a/misc/tools/shadescript/shade.sh b/misc/tools/shadescript/shade.sh
new file mode 100644 (file)
index 0000000..1f95c42
--- /dev/null
@@ -0,0 +1,120 @@
+#!/bin/sh
+
+case "$#" in
+       2)
+               ;;
+       *)
+               echo "Usage: from xonotic-maps.pk3dir directory, copy and edit shader.template, then"
+               echo "  $0 texturepackname myshader.template"
+               exit 1
+               ;;
+esac
+
+LF="
+"
+
+exec 3>"scripts/$1.shader"
+template=`cat "$2"`
+
+find "textures/$1" -type f -path "textures/*/*/*.*" -not -name '*_norm.*' -not -name '*_glow.*' -not -name '*_gloss.*' -not -name '*_reflect.*' -not -name '*.xcf' | while IFS= read -r F; do
+       F=${F%.*}
+
+       noLightmap=false
+       isLiquid=false
+       isTransparent=false
+       bounceScale=1.00
+       shaderString="$template"
+       shaderHead=
+       shaderTail=
+       shaderQUI=
+       shaderDiffuse=
+       diffuseExtra=
+
+       case "$F" in
+               *decal*)
+                       noLightmap=true
+                       ;;
+       esac
+
+       # material type
+       case "$F" in
+               *water*)
+                       noLightmap=true
+                       isLiquid=true
+                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm water\n     qer_trans 20\n"
+                       ;;
+               *slime*)
+                       noLightmap=true
+                       isLiquid=true
+                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm slime\n     qer_trans 20\n"
+                       ;;
+               *lava*)
+                       noLightmap=true
+                       isLiquid=true
+                       shaderHead="$shaderHead surfaceparm trans\n     surfaceparm lava\n      qer_trans 20\n"
+                       ;;
+               *glass*)
+                       noLightmap=true
+                       shaderHead="$shaderHead surfaceparm trans\n"
+                       diffuseExtra="$diffuseExtra             blendfunc add\n"
+                       ;;
+               *metal*)
+                       bounceScale=`echo "$bounceScale + 0.25" | bc -l`
+                       shaderHead="$shaderHead surfaceparm metalsteps\n"
+                       ;;
+       esac
+
+       # what is it used for
+       case "$F" in
+               *grate*)
+                       bounceScale=`echo "$bounceScale + 0.25" | bc -l`
+                       shaderHead="$shaderHead surfaceparm trans\n"
+                       diffuseExtra="$diffuseExtra             blendfunc blend\n"
+                       ;;
+       esac
+
+       # further properties
+       case "$F" in
+               *shiny*)
+                       bounceScale=`echo "$bounceScale + 0.25" | bc -l`
+                       ;;
+       esac
+       case "$F" in
+               *dirt*|*terrain*|*old*)
+                       bounceScale=`echo "$bounceScale - 0.25" | bc -l`
+                       shaderHead="$shaderHead surfaceparm dust\n"
+                       ;;
+       esac
+
+       shaderDiffuse="$F"
+       if [ -f "$F""_gloss.tga" ] || [ -f "$F""_gloss.jpg" ] || [ -f "$F""_gloss.png" ]; then
+               bounceScale=`echo "$bounceScale + 0.25" | bc -l`
+       fi
+
+       if [ -f "$F""_qei.tga" ] || [ -f "$F""_qei.jpg" ] || [ -f "$F""_qei.png" ]; then
+               shaderQUI="$F""_qei"
+       else
+               shaderQUI="$F"
+       fi
+
+       if ! $noLightmap; then
+               shaderTail="    {\n             map \$lightmap\n                rgbGen identity\n               tcGen lightmap\n                blendfunc filter\n      }"
+       fi
+       case "$bounceScale" in
+               1|1.0|1.00)
+                       ;;
+               *)
+                       shaderHead="$shaderHead q3map_bouncescale $bounceScale\n"
+                       ;;
+       esac
+
+       shaderName="`echo "$F" | cut -d / -f 1-2`/`echo "$F" | cut -d / -f 3`-`echo "$F" | cut -d / -f 4`"
+       echo "$shaderString$LF$LF" | sed -e "
+               s,%shader_name%,$shaderName,g;
+               s,%qei_name%,$shaderQUI,g;
+               s,%shader_head%,$shaderHead,g;
+               s,%diffuse_map%,$shaderDiffuse,g;
+               s,%diffuse_map_extra%,$diffuseExtra,g;
+               s,%shader_tail%,$shaderTail,g;
+       " >&3
+done
diff --git a/misc/tools/shadescript/shade.vbs b/misc/tools/shadescript/shade.vbs
new file mode 100644 (file)
index 0000000..e5dc4be
--- /dev/null
@@ -0,0 +1,172 @@
+option explicit 
+
+
+Const ForReading = 1\r
+Const ForWriting = 2\r
+Const ForAppending = 8\r
+
+dim CRLF 
+
+CRLF = Chr(13) & Chr(10)\r
+
+dim scriptFullName, scriptPath \r
+scriptFullName = WScript.ScriptFullName\r
+scriptPath = Left ( scriptFullName, InStrRev ( scriptFullName, WScript.ScriptName) - 1 )
+\r
+dim objFSO, setfolder, re, shader, objShaderTemplate, shaderTemplate
+Set objFSO = CreateObject("Scripting.FileSystemObject")\r
+Set setfolder = objFSO.GetFolder(scriptPath)\r
+Set re = New RegExp
+
+re.IgnoreCase = True
+re.Global = True
+re.Pattern = ""\r
+\r
+Set shader = objFSO.OpenTextFile (scriptPath & "\" & setfolder.name & ".shader", ForWriting, True)\r
+
+Set objShaderTemplate = objFSO.OpenTextFile(scriptPath & "\template.shader", ForReading)
+shaderTemplate = objShaderTemplate.ReadAll()
+
+function filetitle(sfilename)
+       filetitle = Left(sfilename, len(sfilename) - 4)
+end function 
+\r
+dim noLightmap, isLiquid, isTransparent, bounceScale, shaderString
+dim shaderHead, shaderTail, shaderQUI, shaderDiffuse, diffuseExtra
+dim subfold, texfile, fn
+
+For Each subfold in setfolder.Subfolders\r
+       ' shader.write "Folder: " & subfold.Name & CRLF\r
+       For Each texfile In subfold.Files
+               'Defaults               
+               noLightmap              = false
+               isLiquid                = false
+               isTransparent   = false
+               bounceScale     = 1
+               shaderString    = shaderTemplate
+               
+               shaderHead              = ""
+               shaderTail              = ""
+               shaderQUI               = ""
+               shaderDiffuse   = ""
+               diffuseExtra    = ""
+               
+               ' First ignore any extra map or Thumbs.db
+               re.Pattern = "_bump.|_gloss.|_norm.|_glow.|Thumbs.db"
+               if not re.test(texfile.name) then                       \r
+                       re.pattern = "decal"
+                       if re.test(texfile.name) then
+                               noLightmap = true
+                       end if
+                       
+                       re.pattern = "water"
+                       if re.test(texfile.name) then
+                               noLightmap = true
+                               isLiquid = true
+                               shaderHead = shaderHead & "     surfaceparm trans" & CRLF
+                               shaderHead = shaderHead & "     surfaceparm water" & CRLF
+                               shaderHead = shaderHead & "     qer_trans 20" & CRLF
+                               diffuseExtra = "blendfunc blend"
+                       end if
+                       
+                       re.pattern = "slime"
+                       if re.test(texfile.name) then
+                               noLightmap = true
+                               isLiquid = true
+                               shaderHead = shaderHead & "     surfaceparm trans" & CRLF
+                               shaderHead = shaderHead & "     surfaceparm slime" & CRLF
+                               shaderHead = shaderHead & "     qer_trans 20" & CRLF
+                       end if
+                       
+                       re.pattern = "lava"
+                       if re.test(texfile.name) then
+                               noLightmap = true
+                               isLiquid = true
+                               shaderHead = shaderHead & "     surfaceparm trans" & CRLF
+                               shaderHead = shaderHead & "     surfaceparm lava" & CRLF
+                               shaderHead = shaderHead & "     qer_trans 20" & CRLF
+                               diffuseExtra = "                blendfunc add"
+                       end if
+                       
+                       re.pattern = "glass"
+                       if re.test(texfile.name) then
+                               noLightmap = true
+                               shaderHead = shaderHead & "     surfaceparm trans" & CRLF
+                               diffuseExtra = "                blendfunc add"
+                       end if
+                       
+                       re.pattern = "metal"
+                       if re.test(texfile.name) then
+                               bounceScale = bounceScale + 0.25
+                               shaderHead = shaderHead & "     surfaceparm metalsteps" & CRLF
+                       end if
+                       
+                       re.pattern = "grate"
+                       if re.test(texfile.name) then
+                               bounceScale = bounceScale + 0.25
+                               shaderHead = shaderHead & "     surfaceparm trans" & CRLF
+                               diffuseExtra = "                blendfunc blend"
+                       end if
+                       
+                       re.pattern = "shiny"
+                       if re.test(texfile.name) then
+                               bounceScale = bounceScale + 0.25
+                       end if
+                       
+                       re.pattern = "dirt|terrain|old"
+                       if re.test(texfile.name) then
+                               bounceScale = bounceScale - 0.25
+                               shaderHead = shaderHead & "     surfaceparm dust" & CRLF
+                       end if
+                       
+                       shaderDiffuse = "textures/" & setfolder.name & "/" & subfold.name & "/" & texfile.name
+                       
+                       fn = scriptPath & "/" & subfold.name & "/" & filetitle(texfile.name) & "_gloss.tga" 
+                       if objFSO.FileExists(fn) Then
+                               bounceScale = bounceScale + 0.25
+                       end if
+                       
+                       fn = scriptPath & "/" & subfold.name & "/" & filetitle(texfile.name) & "_qei.tga" 
+                       if objFSO.FileExists(fn) Then
+                               shaderQUI = "textures/" & setfolder.name & "/" & subfold.name & "/" & filetitle(texfile.name) & "_qei.tga" 
+                       else
+                               shaderQUI = shaderDiffuse
+                       end if
+
+                       if not noLightmap then 
+                               shaderTail = "  {" & CRLF & "           map $lightmap" & CRLF & "               rgbGen identity" & CRLF & "             tcGen lightmap" & CRLF & "              blendfunc filter" & CRLF & "    }"
+                       end if
+                       
+                       if not bounceScale = 1 then 
+                               re.pattern = ","
+                               shaderHead = shaderHead & "     q3map_bounceScale " & re.Replace(bounceScale, ".") & CRLF
+                       end if
+                               
+                       re.Pattern = "%shader_name%"
+                       shaderString = re.Replace(shaderTemplate, "textures/" & setfolder.name & "/" & subfold.name & "-" & filetitle(texfile.name))
+
+                       re.Pattern = "%qei_name%"
+                       shaderString = re.Replace(shaderString, shaderQUI)
+
+                       re.Pattern = "%shader_head%"
+                       shaderString = re.Replace(shaderString, shaderHead)
+                       
+                       re.Pattern = "%diffuse_map%"
+                       shaderString = re.Replace(shaderString, shaderDiffuse)
+                       
+                       re.Pattern = "%diffuse_map_extra%"
+                       shaderString = re.Replace(shaderString, diffuseExtra)
+
+                       re.Pattern = "%shader_tail%"
+                       shaderString = re.Replace(shaderString, shaderTail)
+                       
+
+                       
+                       shader.write shaderString & CRLF & CRLF
+               end if\r
+       Next\r
+Next\r
+shader.Close\r
+\r
+\r
+\r
diff --git a/misc/tools/shadescript/template.shader b/misc/tools/shadescript/template.shader
new file mode 100644 (file)
index 0000000..b9d4787
--- /dev/null
@@ -0,0 +1,15 @@
+%shader_name%
+{
+       qer_editorimage %qei_name%
+       dpoffsetmapping - 2
+       dpglossintensitymod  3
+       dpglossexponentmod  4
+%shader_head%
+
+       {
+               map %diffuse_map%
+               %diffuse_map_extra%             
+       }
+
+%shader_tail%
+}
\ No newline at end of file
index 90a012325b829c864083833b20f87292821e07db..5c6db64de23a62450129bfe934511064b0d6b204 100755 (executable)
@@ -3,10 +3,14 @@
 set -e
 
 bspdir="$PWD/data"
-url=http://beta.xonotic.org/autobuild-bsp/
+url_http=http://beta.xonotic.org/autobuild-bsp/
 url_ssh=xonotic-beta:autobuild-bsp/
-cachedir="$HOME/xonotic-map-compiler.cache/"
-override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900"
+build_cachedir="$HOME/xonotic-map-compiler.cache/"
+screenshot_cachedir="$HOME/xonotic-map-screenshot.cache/"
+build_override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900"
+screenshot_override="9 600 +g_ctf 1"
+
+getthemap_fail=false
 
 allmaps()
 {
@@ -39,6 +43,32 @@ pre2spam()
        echo "[$branch $hash] starting map compile of $map"
 }
 
+ss2spam()
+{
+       map=$1
+       url=$2
+       branch=$3
+       hash=$4
+       status=$5
+
+       branch=${branch##refs/heads/}
+       branch=${branch##refs/remotes/}
+       branch=${branch##origin/}
+       hash=`echo "$hash" | cut -c 1-7`
+
+       s_error=
+
+       if [ "$status" -ne 0 ]; then
+               s_error="exited with status $status"
+       fi
+
+       if [ -n "$s_error" ]; then
+               echo "[$branch $hash] \ 34screenshots of $map could not be made: $s_error"
+       else
+               echo "[$branch $hash] screenshots of $map are available on $url"
+       fi
+}
+
 log2spam()
 {
        map=$1
@@ -127,7 +157,7 @@ buildthemap()
        t0=`date +%s`
        (
                cd maps
-               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $override > "$M.log"
+               ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $build_override > "$M.log"
        )
        t1=`date +%s`
        dt=$(($t1 - $t0))
@@ -147,6 +177,45 @@ buildthemap()
        fi
 }
 
+screenshotthemap()
+{
+       REFNAME=$1
+       HASH=$2
+       url=$3
+       M=$4
+       blobhash=$5
+       if HEAD "$url$M-$blobhash/"; then
+               continue
+       fi
+       rm -rf ~/.xonotic
+       (
+               cd ../..
+               if [ -n "$DISPLAY" ]; then
+                       misc/tools/xonotic-map-screenshot "$M" $screenshot_override +"scr_screenshot_name \"$M-\""
+               else
+                       startx "$PWD/misc/tools/xonotic-map-screenshot" "$M" $screenshot_override +"scr_screenshot_name \"$M-\"" -- :8
+               fi
+       )
+       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"
+               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"
+       fi
+       chmod 1777 "$M-$blobhash"
+       ln -snf "../$M-$blobhash" "$M" # from ALL branches, so beware!
+       rsync -vaSHP "$M-$blobhash" "$url_ssh"
+       rsync -vaSHP "$M" "$url_ssh""latest/"
+       if [ -n "$IRCSPAM" ]; then
+               $IRCSPAM < "maps/$M.ircss"
+       fi
+}
+
 getthemap()
 {
        url=$1
@@ -161,12 +230,14 @@ getthemap()
                if ! curl -o "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
                        rm -f "$bspdir/$M-$blobhash.pk3"
                        echo "WARNING: could not download $url$M-$blobhash.pk3, maybe not ready yet"
+                       getthemap_fail=true
                        return 0
                fi
        fi
        if ! unzip -l "$bspdir/$M-$blobhash.pk3"; then
                rm -f "$bspdir/$M-$blobhash.pk3"
                echo "WARNING: could not download $url$M-$blobhash.pk3, invalid zip file"
+               getthemap_fail=true
                return 0
        fi
 }
@@ -175,14 +246,51 @@ case "$1" in
        build)
                cd data/xonotic-maps.pk3dir
                git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
-                       if [ -f "$cachedir/$HASH" ]; then
+                       case "$REFNAME" in
+                               */archived/*)
+                                       continue
+                                       ;;
+                       esac
+                       if [ -f "$build_cachedir/$HASH" ]; then
                                continue
                        fi
                        git reset --hard
                        git clean -xfd
                        git checkout -f "$HASH"
-                       allmaps buildthemap "$REFNAME" "$HASH" "$url"
-                       touch "$cachedir/$HASH"
+                       allmaps buildthemap "$REFNAME" "$HASH" "$url_http"
+                       touch "$build_cachedir/$HASH"
+               done
+               git checkout -f master
+               ;;
+       screenshot)
+               cd data/xonotic-maps.pk3dir
+               git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
+                       case "$REFNAME" in
+                               */archived/*)
+                                       continue
+                                       ;;
+                       esac
+                       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"
+                       fi
                done
                git checkout -f master
                ;;
@@ -194,7 +302,7 @@ case "$1" in
                        fi
                done
                cd data/xonotic-maps.pk3dir
-               allmaps getthemap "$url" "$bspdir.old" "$bspdir"
+               allmaps getthemap "$url_http" "$bspdir.old" "$bspdir"
                echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"
                ls -l "$bspdir.old"
                ;;
@@ -202,7 +310,7 @@ case "$1" in
                mkdir -p "$bspdir"
                cd "$bspdir"
                rm -f *-????????????????????????????????????????-????????????????????????????????????????.pk3
-               wget -r -l1 -A "*.pk3" -N --no-parent --no-directories "$url""latest"
+               wget -r -l1 -A "*.pk3" -N --no-parent --no-directories "$url_http""latest"
                ;;
        log2spam-test)
                log2spam "mapname" "http://mapurl" "branch" "commit" "0"
diff --git a/misc/tools/xonotic-map-screenshot b/misc/tools/xonotic-map-screenshot
new file mode 100755 (executable)
index 0000000..0d3127e
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+map=$1; shift
+count=$1; shift
+watchdog=$1; shift
+
+# convert count to unary
+count=`yes x | head -n "$count" | tr -cd x`
+
+./all run \
+       -nosound \
+       +'vid_fullscreen 0' \
+       +'exec effects-ultimate.cfg' \
+       "$@" \
+       +'r_motionblur 0' \
+       +'r_damageblur 0' \
+       +'r_letterbox -1' \
+       +'r_drawviewmodel 0' \
+       +'crosshair 0' \
+       +'sv_cheats 2' \
+       +'set catchme "catchme_"' \
+       +"alias catchme_$count \"quit\"" \
+       +'alias "autoscreenshot" "$catchme; set catchme \"${catchme}x\"; impulse 911; defer 2 \"screenshot; autoscreenshot\""' \
+       +'alias cl_hook_gamestart_all "cmd join; defer 1 god; defer 2 noclip; defer 3 autoscreenshot"' \
+       +"defer \"$watchdog\" quit" \
+       +"map \"$map\"" \
+       +'timelimit 0' \
+       +'fraglimit 0'
diff --git a/savecore.gdb b/savecore.gdb
new file mode 100644 (file)
index 0000000..33c4b40
--- /dev/null
@@ -0,0 +1,9 @@
+handle SIGHUP nostop print pass
+handle SIGINT nostop print pass
+handle SIGCONT nostop print pass
+handle SIGTSTP nostop print pass
+run
+set pagination off
+echo \n\nIf the following commands show errors, that can be ignored:\n
+bt full
+generate-core-file xonotic.core