From 2cc7424193681f5a6ca034d8f07e1ae8d30bf8c5 Mon Sep 17 00:00:00 2001 From: avolkov Date: Fri, 4 Feb 2005 22:03:42 +0000 Subject: [PATCH] Colormap mapping script git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1514 8092fc87-c524-0410-9efc-e669fe64eaf9 --- tools/ctconv/ctmap.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tools/ctconv/ctmap.sh diff --git a/tools/ctconv/ctmap.sh b/tools/ctconv/ctmap.sh new file mode 100755 index 000000000..736d5a73f --- /dev/null +++ b/tools/ctconv/ctmap.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +if [ $# -gt 1 ]; then + echo "Syntax: ctmap.sh [indir] |sort [>map-file]" + echo "Creates a map of colormaps used by various images" + echo "Creates a map of colormaps used by various images" + exit 1 +elif [ $# -ne 1 ]; then + INDIR="." +else + INDIR="$1" +fi + +if [ ! -d "$INDIR" ]; then + echo "\"${INDIR}\" is not a good source dir" + exit 1 +fi + +INDIR="${INDIR%/}/" +OUTDIR="${OUTDIR%/}/" + +processone() { + FILE="$1" + LAST=-1 + +while read IMAGE TRANSCOLOR CMAP THEREST; do + if [ "$CMAP" -ne "$LAST" ]; then + LAST="$CMAP" + FCMAP="$CMAP" + while [ "${#FCMAP}" -lt 3 ]; do FCMAP="0$FCMAP"; done + echo $FCMAP $FILE + fi +done < $FILE +} + +for FILE in `find "$INDIR" -type f -a "(" -name "*.ani" -o -name "*.sml" -o \ + -name "*.med" -o -name "*.big" ")"`; do + processone "$FILE" +done