nuclide-lite/Tools/build_wads.sh

51 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# ensure we use the tools provided in root
export PATH="$(pwd):$PATH"
CWD=$(pwd)
PALETTE="palette_nofb.lmp"
# 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" = "gfx" ]
then
PALETTE="palette.lmp"
fi
if [ ! "$DIRNAME" = "." ]
then
if [ -f "$WADDIR/WAD3" ]
then
printf "WAD3 building %s:\n" "$DIRNAME"
imgtool --genwad3 ../"$DIRNAME".wad ./"$DIRNAME"
else
if [ -f "../gfx/$PALETTE" ]
then
printf "WAD2 Building %s:\n" "$DIRNAME"
if [ -f "$CWD/$1/texturesrc/$DIRNAME/palette.lmp" ]
then
imgtool --palette "$CWD/$1/texturesrc/$DIRNAME/palette.lmp" --genwad2 ../"$DIRNAME".wad ./"$DIRNAME"
else
imgtool --palette ../gfx/$PALETTE --genwad2 ../"$DIRNAME".wad ./"$DIRNAME"
fi
else
printf "WAD2 (using Quake palette) building %s:\n" "$DIRNAME"
imgtool --genwad2 ../"$DIRNAME".wad ./"$DIRNAME"
fi
fi
fi
done
}
build_wads $1