nuclide-lite/Tools/build_wads.sh

39 lines
838 B
Bash
Executable file

#!/bin/sh
# ensure we use the tools provided in root
export PATH="$(pwd):$PATH"
CWD=$(pwd)
# texture wads
build_wads()
{
echo "building texturesrc/*.wad"
cd "$CWD/$1/texturesrc/"
# will make a .wad out of every sub directory.
find ./ -type d -maxdepth 1 | while read WADDIR
do
DIRNAME=$(basename "$WADDIR")
if [ ! "$DIRNAME" = "." ]
then
if [ -f "$WADDIR/WAD3" ]
then
printf "WAD3 building %s:\n" "$DIRNAME"
imgtool --genwad3 ../"$DIRNAME".wad ./"$DIRNAME"
else
if [ -f "../gfx/palette.lmp" ]
then
printf "WAD2 Building %s:\n" "$DIRNAME"
imgtool --palette ../gfx/palette.lmp --genwad2 ../"$DIRNAME".wad ./"$DIRNAME"
else
printf "WAD2 (using Quake palette) building %s:\n" "$DIRNAME"
imgtool --genwad2 ../"$DIRNAME".wad ./"$DIRNAME"
fi
fi
fi
done
}
build_wads $1