From 87db1d2f47377e1525090e7656145ba8b6d64779 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 5 Jul 2020 21:30:31 -0400 Subject: Add randoom --- randoom | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 randoom (limited to 'randoom') diff --git a/randoom b/randoom new file mode 100755 index 0000000..dd86af6 --- /dev/null +++ b/randoom @@ -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" -- cgit v1.2.3