all repos — doom @ 68612bf7682d757b1aa5eb5d3410e6fdfb98383c

Grab bag of versioned doom files (maps, scripts, notes, etc)

tools/render-timelapse (view raw, download)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
#!/bin/bash


if [[ $# -ne 3 ]]
then
    echo "Usage: ./render-timelapse <GIT_DIR> <MAP_FILENAME> <OUTPUT_DIR>"
    echo -e "\texample: ./render-images . FOO.WAD out"

    exit 1
fi

if ! [ -x "$(command -v wad2svg)" ]
then
    echo "This script requires the program 'wad2svg'"
    exit 1
fi

GIT_DIR="$1"
MAP_FILENAME="$2"
OUTPUT_DIR="$3"

WAD_DIR=~/doom/DOOM2.WAD

mkdir -p "$OUTPUT_DIR"

echo -n "Collecting up map versions "

for commit in $(git -C "$GIT_DIR" log --reverse --format=format:%at_%h)
do
    echo -n .

    timestamp=$(echo $commit | cut -d_ -f1)
    sha=$(echo $commit | cut -d_ -f2)

    git -C "$GIT_DIR" show \
        ${sha}:${MAP_FILENAME} \
        > ${OUTPUT_DIR}/.${timestamp}_${sha}.${MAP_FILENAME}
done

echo \ done
echo -n "Converting map versions to SVGs "

for file in $OUTPUT_DIR/.*.WAD
do
    echo -n .

    wad2svg $file MAP01 --image_height 640 --image_width 480 > "${file}.svg" 2>/dev/null

    #wad2image $file -c yadex -n 1 -i "$WAD_DIR" -o "$OUTPUT_DIR" --thing-scale 2 -t 3
    #mv "$OUTPUT_DIR/map01.png" -- "${file}.png"
done

echo \ done
echo -n "Combining SVGs into animated GIF ... "

OUTPUT_ARTEFACT_PATH="${OUTPUT_DIR}/${MAP_FILENAME}.gif"

shopt -s extglob nullglob
magick -delay 10 -loop 1 "$OUTPUT_DIR"/.*.@(svg|png) "$OUTPUT_ARTEFACT_PATH"

echo \ done
echo -e "Output: '${OUTPUT_ARTEFACT_PATH}'"