diff options
-rwxr-xr-x | randoom | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -0,0 +1,59 @@ +#!/bin/sh + + +set -e + +DIR=~/.randoom +MIDIDIR=$DIR/midi +ENGINE=${ENGINE:-gzdoom} + +mkdir -p $DIR +cd $DIR + +wepselect=$(( ( $RANDOM / 1000 ) % 10 )) +case "$wepselect" in + 0|1|2) WEP=shotgun ;; + 3|4|5) WEP=supershotgun ;; + 6|7|8) WEP=chaingun ;; + 9) WEP=chainsaw ;; +esac + +EXTRA="+give $WEP +give backpack" + +if [ "$#" = "1" -a "$1" = "-a" ]; then + if [ -e slige.out -a -e D_RUNNIN.lmp ]; then + again=1 + EXTRA="$( cat extraargs )" + fi +elif [ "$#" = "1" -a "$1" = "-r" ]; then + OBLIGECFG=$HOME/.oblige/rockets.cfg + EXTRA="+give rocketlauncher +give backpack" +elif [ "$#" = "2" -a "$1" = "-k" ]; then + if [ -e slige.out ]; then + mv slige.out "$2".wad + echo "Keeping level as $2.wad" + exit 0 + fi +fi + +if [ "$again" != "1" ]; then + echo "$EXTRA" > extraargs + mv -f slige.out slige.out.old 2>/dev/null || true + mv -f D_RUNNIN.lmp D_RUNNIN.lmp.old 2>/dev/null || true + +# Pick some random music + if [ -d "$MIDIDIR" ]; then + MIDI="$( /bin/ls $MIDIDIR/*.mid | sort -R | head -1 )" + echo "'$MIDI'" + LMP=./D_RUNNIN.lmp + cat "$MIDI" > $LMP + fi + +# slige -doom2 -nulls +# warm -q slige.out +# glbsp -q slige.out -o slige.out + oblige --load ${OBLIGECFG:-$HOME/.oblige/CONFIG.txt} --batch slige.out +fi + +$ENGINE -iwad doom2 -skill 3 -warp 1 $EXTRA -file slige.out $LMP +echo "Used MIDI file: $MIDI" |