From decb8ea1fc28202dfa20c6141f3a5b64321fbb0c Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Wed, 4 Aug 2021 13:20:11 +0200 Subject: [PATCH] make_mapdef.sh: output entities.def files into the game-dirs now, since the WorldSpawn editor will now read those instead of looking in its own dir --- make_mapdef.sh | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/make_mapdef.sh b/make_mapdef.sh index f1a1acba..ec256aed 100755 --- a/make_mapdef.sh +++ b/make_mapdef.sh @@ -2,24 +2,35 @@ ent_for_mod() { - mkdir -p ./bin/platform.game/$1/ - ENT_OUTFILE="./bin/platform.game/$1/entities.def" - rm "$ENT_OUTFILE" + # don't bother if we don't have sources + if ! [ -f "./$1/src/Makefile" ]; then + exit + fi - find ./$1/src/ -type f \( -iname \*.qc \) | while read EDEF_N; do - echo "Scanning for definitions inside $EDEF_N" - sed -n '/\/*QUAKED/,/*\//p' $EDEF_N >> "$ENT_OUTFILE" - done; - - cat ./bin/platform.game/platform/entities.def >> $ENT_OUTFILE + ENT_OUTFILE="./$1/entities.def" + echo '/*' > "$ENT_OUTFILE" + echo 'WorldSpawn entity definition file' >> "$ENT_OUTFILE" + echo "$1 specific definitions" >> "$ENT_OUTFILE" + echo 'auto-generated by make_mapdef.sh' >> "$ENT_OUTFILE" + echo '*/' >> "$ENT_OUTFILE" + echo '' >> "$ENT_OUTFILE" + + find ./$1/src/ -type f \( -iname \*.qc \) | while read EDEF_N; do + echo "Scanning for definitions inside $EDEF_N" + sed -n '/\/*QUAKED/,/*\//p' $EDEF_N >> "$ENT_OUTFILE" + done; + + cat ./platform/entities.def >> $ENT_OUTFILE } -BASE_ENT=./bin/platform.game/platform/entities.def -rm "$BASE_ENT" +# first dump all the general purpose entities +BASE_ENT="./platform/entities.def" +echo '/* general platform definitions */' > "$BASE_ENT" find ./src/gs-entbase/ -type f \( -iname \*.qc \) | while read EDEF_N; do - echo "Scanning for definitions inside $EDEF_N" - sed -n '/\/*QUAKED/,/*\//p' $EDEF_N >> "$BASE_ENT" + echo "Scanning for definitions inside $EDEF_N" + sed -n '/\/*QUAKED/,/*\//p' $EDEF_N >> "$BASE_ENT" done; +# each game gets its own ents + general purpose ents appended at the end ent_for_mod $1