]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/cached-converter.sh
Clean up how ./all uses git. Expect some breakage.
[xonotic/xonotic.git] / misc / tools / cached-converter.sh
index 77a4703c2147ecf6557c8a814830970dd84e86ec..072d7731955b38ba13bf20565d4289040ab0f919 100755 (executable)
@@ -10,7 +10,8 @@ set -e
 : ${do_dds:=true}
 : ${dds_tool:=compressonator-dxtc}
 : ${do_ogg:=false}
-: ${ogg_qual:=1}
+: ${ogg_ogg:=true}
+: ${ogg_qual:=2}
 : ${del_src:=false}
 : ${git_src_repo:=}
 : ${dds_noalpha:=dxt1}
@@ -66,9 +67,9 @@ use_magnet_to_acquire_checksum_faster()
        if [ -n "$magnet" ]; then
                magnet=${magnet#* }
                magnet=${magnet%% *}
-               sum=$sum$magnet
+               echo "$magnet"
        else
-               sum=$sum`git hash-object "$1"`
+               git hash-object "$1"
        fi
 }
 
@@ -88,10 +89,9 @@ acquire_checksum()
                        esac
                done
                if [ -n "$git_src_repo" ] && ! $_a_e; then
-                       _a_s=
-                       use_magnet_to_acquire_checksum_faster "${1#./}"
+                       _a_s=`use_magnet_to_acquire_checksum_faster "${1#./}"`
                        if [ -n "$2" ]; then
-                               use_magnet_to_acquire_checksum_faster "${2#./}"
+                               _a_s=$_a_s`use_magnet_to_acquire_checksum_faster "${2#./}"`
                        fi
                else
                        _a_s=`git hash-object "$1"`
@@ -204,7 +204,7 @@ reduce_jpeg2_dds()
        i=$1; shift
        ia=$1; shift
        o=$1; shift; shift 
-       convert "$i" "$ia" -compose CopyOpacity -composite "$tmpdir/x.tga" && \
+       convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_sepalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -213,7 +213,7 @@ reduce_jpeg2_dds_premul()
        i=$1; shift
        ia=$1; shift
        o=$1; shift; shift 
-       convert "$i" "$ia" -compose CopyOpacity -composite "$tmpdir/x.tga" && \
+       convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_prealpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -273,7 +273,7 @@ reduce_rgba_dds()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" "$tmpdir/x.tga" && \
+       convert "$i" -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_sepalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -281,7 +281,7 @@ reduce_rgba_dds_premul()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" "$tmpdir/x.tga" && \
+       convert "$i" -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_prealpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -306,7 +306,7 @@ reduce_rgb_dds()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" "$tmpdir/x.tga" && \
+       convert "$i" -type TrueColor "$tmpdir/x.tga" && \
        "$meprefix"compress-texture "$dds_tool" "$dds_noalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -348,6 +348,11 @@ for F in "$@"; do
        will_jpeg=$do_jpeg
        will_dds=$do_dds
        will_ogg=$do_ogg
+       if ! $ogg_ogg; then
+               case "$f" in
+                       *.ogg) will_ogg=false ;;
+               esac
+       fi
        case "$f" in
                ./sounds/misc/talk*.wav) will_ogg=false ;; # engine "feature"
                *_bump) will_dds=false ;;