#!/bin/bash

xcffile=$1
shift

function make_tiles(){
    local background=$1
    mkdir -p $background
    for piece in "floor" "wall" "wall-end-"{"t","b",""}{"l","r"} "floor-"{"start","end"}"-"{"l","r"} "arch-"{"l","r"}
    do
        xcf2png $xcffile "$piece" "$background" --mode Screen > $background/"$piece.png"
    done
}

if [ $# -gt 0 ]
then
    for background in $*
    do
        make_tiles $background
    done
else
    for background in "fan_gold" "fan_green" "red" "blue" "flower_dark" "flower_light"
    do
        make_tiles $background
    done
fi


