nuclide/build_game.sh
Marco Cawthorne 649ed825ad
Big commit, work over various triggers. Clean up debug prints and make
them more consistent. Warnings are in yellow, while errors are in red.

New cvar: g_developerTimestamp will display timestamps next to debug messages
originating from the game-logic. Set g_developer to 1 to see them.
A lot of useful into, such as which entity id messages originate from
should aid in debugging quite a bit.

SP level transitions should also be more reliable now in terms of
transferring entities and the like.

Some levels have awkward transition areas and you might find yourself
jumping between levels frequently. Workarounds are in the works.
2024-03-02 00:40:08 -08:00

106 lines
No EOL
2.1 KiB
Bash
Executable file

#!/bin/sh
. ./build.cfg
safe_copy()
{
if [ -f "$1" ]
then
cp -v "$1" "$2"
fi
}
radiant_build()
{
if [ "$SKIP_RADIANT" = "1" ]; then
exit 0
fi
./make_mapdef.sh "$1"
# copy files over to RADIANT
if [ ! -z "$RADIANT_PATH" ]
then
if [ -d "$RADIANT_PATH/gamepacks/games" ];
then
mkdir -p "$RADIANT_PATH/gamepacks/$1.game/$1/"
safe_copy "./$1/radiant.game" "$RADIANT_PATH/gamepacks/games/$1.game"
safe_copy "./$1/entities.def" "$RADIANT_PATH/gamepacks/$1.game/$1/entities.def"
safe_copy "./$1/radiant.xml" "$RADIANT_PATH/gamepacks/$1.game/default_build_menu.xml"
fi
fi
}
if [ "$SKIP_UPDATE" = "1" ]; then
BUILD_UPDATE=0
fi
# if we're attempting to update the projects, check for git
if [ "$BUILD_UPDATE" -eq 1 ]; then
if ! [ -x "$(command -v git)" ]; then
printf "'git' is not installed.\n"
exit 1
fi
fi
set -e
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
PATH="$SCRPATH/bin:$PATH"
if [ -x "$(command -v fteqcc)" ]; then
# We want to compile a specific game
if [ $# -gt 0 ]; then
if [ "$BUILD_UPDATE" -eq 1 ]; then
# git pull on the main repo
git pull
fi
cd "$SCRPATH/$1"/src
if [ "$BUILD_UPDATE" -eq 1 ]; then
# git pull on the main repo
git pull
fi
make
cd "$SCRPATH"
radiant_build "$1"
exit 0
fi
export OLDDIR=$(pwd)
cd ./src
if [ "$BUILD_UPDATE" -eq 1 ]; then
# git pull on the main repo
git pull
fi
make
cd "$OLDDIR"
# update repos first in case there's dependencies
find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | grep -v worldspawn | while read MFILE_N; do
NEWDIR=$(dirname "$MFILE_N")
cd "$NEWDIR"
if [ -f "$NEWDIR/../.git/config" ]; then
printf "Updating git repo inside $NEWDIR\n"
if [ "$BUILD_UPDATE" -eq 1 ]; then
git pull
fi
fi
cd $OLDDIR
done;
# now loop through _again_ to build
find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | grep -v worldspawn | while read MFILE_N; do
NEWDIR=$(dirname "$MFILE_N")
cd "$NEWDIR"
make
cd ..
export GAMEDIR=$(basename $PWD)
cd $OLDDIR
radiant_build "$GAMEDIR"
done;
else
printf "FTEQCC compiler is not present, please run build_engine.sh\n"
fi