~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to restricted/app-fortress/fortress/genmaps.sh

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# Convert map text files into the haxe Map.hx class
 
4
#
 
5
 
 
6
out=Maps.hx
 
7
in=maps.txt
 
8
 
 
9
echo "/*Generated by genmaps.sh*/" > $out
 
10
echo "package fortress;" >> $out
 
11
echo "class Maps" >> $out
 
12
echo "{" >> $out
 
13
 
 
14
# generate landmap data
 
15
echo -e "\tstatic public var data = [" >> $out
 
16
 
 
17
# Use ls to ensure in sorted order
 
18
files=`ls map_*.png`
 
19
count=0
 
20
for i in $files; do
 
21
        # separator if there was a previous item
 
22
        if [ $count -gt 0 ]; then
 
23
                echo -ne "\t," >> $out
 
24
        fi
 
25
        count=$(($count+1))
 
26
        
 
27
        echo Converting $i...
 
28
        ./convert.pl $i >> $out || exit -1
 
29
done
 
30
 
 
31
echo -e "\t];" >> $out
 
32
 
 
33
 
 
34
echo "}" >> $out