#!/bin/bash

mkdir RAW
mkdir RLE

gcc pcx2vga.c -o pcx2vga
gcc rle.c -o rle

for i in {000..040}
do

if [ ! -e pcx/$i.pcx ]; then
  break
fi

./pcx2vga pcx/$i.pcx 240 RAW/$i.vga RAW/$i.pal
cp RAW/$i.pal RLE/$i.dat

./rle RAW/$i.vga dojob >> RLE/$i.dat

done


# now do front and ui
./pcx2vga pcx/ui.pcx 16 RAW/ui.vga RAW/ui.pal
./pcx2vga pcx/front.pcx 240 RAW/front.vga RAW/front.pal

cp RAW/ui.pal RLE/ui.dat
cp RAW/front.pal RLE/front.dat

./rle RAW/ui.vga dojob >> RLE/ui.dat
./rle RAW/front.vga dojob >> RLE/front.dat

mv RLE/* ../

rm -rf RLE
rm -rf RAW

exit 0