]> icculus.org git repositories - divverent/nexuiz.git/blob - data/models/sprites/make-sprites.sh
looking in engine source told me I have to add 1024 to ent.colormap for it to actuall...
[divverent/nexuiz.git] / data / models / sprites / make-sprites.sh
1 #!/bin/bash
2
3 width=256
4 height=64
5
6 sprwidth=256
7 sprheight=64
8
9 pngsprite()
10 {
11         local name text color bgcolor
12         name=$1
13         color=$2
14         bgcolor=$3
15         text=$4
16         svgwidth=512
17         svgheight=128
18
19         cat <<EOF >$name.svg
20 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
21 <!-- Created with Inkscape (http://www.inkscape.org/) -->
22 <svg
23    xmlns:dc="http://purl.org/dc/elements/1.1/"
24    xmlns:cc="http://web.resource.org/cc/"
25    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
26    xmlns:svg="http://www.w3.org/2000/svg"
27    xmlns="http://www.w3.org/2000/svg"
28    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
29    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
30    width="512"
31    height="128"
32    id="svg2"
33    sodipodi:version="0.32"
34    inkscape:version="0.45"
35    version="1.0"
36    inkscape:export-filename="bluebase.tga"
37    inkscape:export-xdpi="90"
38    inkscape:export-ydpi="90"
39    sodipodi:docname="template.svg"
40    sodipodi:docbase="/home/rpolzer/software/games/nexuiz/data/models/sprites"
41    inkscape:output_extension="org.inkscape.output.svg.inkscape"
42    sodipodi:modified="true">
43   <defs
44      id="defs4" />
45   <sodipodi:namedview
46      id="base"
47      pagecolor="#$bgcolor"
48      bordercolor="#666666"
49      borderopacity="1.0"
50      gridtolerance="10000"
51      guidetolerance="10"
52      objecttolerance="10"
53      inkscape:pageopacity="0"
54      inkscape:pageshadow="2"
55      inkscape:zoom="0.98994949"
56      inkscape:cx="375"
57      inkscape:cy="75.53288"
58      inkscape:document-units="px"
59      inkscape:current-layer="layer1"
60      width="512px"
61      height="128px"
62      showgrid="true"
63      gridspacingx="8px"
64      gridspacingy="8px"
65      gridempspacing="8"
66      inkscape:grid-points="true"
67      showguides="true"
68      inkscape:guide-bbox="true"
69      inkscape:window-width="849"
70      inkscape:window-height="590"
71      inkscape:window-x="198"
72      inkscape:window-y="66" />
73   <metadata
74      id="metadata7">
75     <rdf:RDF>
76       <cc:Work
77          rdf:about="">
78         <dc:format>image/svg+xml</dc:format>
79         <dc:type
80            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
81       </cc:Work>
82     </rdf:RDF>
83   </metadata>
84   <g
85      inkscape:label="Layer 1"
86      inkscape:groupmode="layer"
87      id="layer1">
88     <path
89        style="opacity:1;fill:#$color;fill-opacity:1;stroke:#$bgcolor;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294119"
90        d="M 256,126 L 280,102 L 264,102 L 264,62 L 248,62 L 248,102 L 232,102 L 256,126 z "
91        id="path1872"
92        sodipodi:nodetypes="cccccccc" />
93     <text
94        xml:space="preserve"
95        style="font-size:56px;font-weight:bold;text-align:center;text-anchor:middle;opacity:1;fill:#$color;fill-opacity:1;stroke:#$bgcolor;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294118"
96        x="255.49414"
97        y="49.957031"
98        id="text1874"><tspan
99          sodipodi:role="line"
100          id="tspan1876"
101          x="255.49414"
102          y="49.957031">$text</tspan></text>
103   </g>
104 </svg>
105 EOF
106         enlargex=$(($sprwidth - $width))
107         enlargey=$(($sprheight - $height))
108
109         
110
111         inkscape -z -w $sprwidth -h $sprheight \
112                 -a "$((-$enlargex * $svgwidth / $width / 2)):0:$(($svgwidth + $enlargex * $svgwidth / $width / 2)):$(($svgheight + $enlargey * $svgheight / $height))" \
113                 -e "$name.png" "$name.svg"
114 }
115
116 sprite()
117 {
118         local name text color bgcolor interval frame args
119         name=$1
120         text=$2
121         shift
122         shift
123         args=
124         frame=0
125         while [ $# -gt 0 ]; do
126                 color=$1
127                 bgcolor=$2
128                 interval=$3
129                 shift
130                 shift
131                 shift
132                 pngsprite "${name}_frame$frame" "$color" "$bgcolor" "$text"
133                 args="$args -sprite ${name}_frame$frame.png $(($sprwidth / 2)) $(($sprheight - 1)) $interval"
134                 frame=$(($frame + 1))
135         done
136         ./makespr32 -o "$name.sp2" -proj 5 -group $args
137 }
138
139 sprite bluebase           "BLUE BASE"     0000ff 000000 0.0
140 sprite danger             "DANGER"        ff0000 ffff00 0.0
141 sprite flagcarrier        "FLAG CARRIER"  ffff00 000000 0.0
142 sprite helpme             "HELP ME"       ffff00 ff0000 0.0
143 sprite here               "HERE"          00ff00 000000 0.0
144 sprite key-dropped        "DROPPED KEY"   00ffff 000000 0.0
145 sprite keycarrier-blue    "KEY CARRIER"   0000ff 000000 0.0
146 sprite keycarrier-finish  "RUN HERE"      00ffff 000000 0.0
147 sprite keycarrier-friend  "KEY CARRIER"   00ff00 000000 0.0
148 sprite keycarrier-pink    "KEY CARRIER"   ff00ff 000000 0.0
149 sprite keycarrier-red     "KEY CARRIER"   ff0000 000000 0.0
150 sprite keycarrier-yellow  "KEY CARRIER"   ffff00 000000 0.0
151 sprite redbase            "RED BASE"      ff0000 000000 0.0
152 sprite waypoint           "WAYPOINT"      008080 000000 0.0
153 sprite ons-gen-red        "GENERATOR"     ff0000 000000 0.0
154 sprite ons-gen-blue       "GENERATOR"     0000ff 000000 0.0
155 sprite ons-gen-shielded   "GENERATOR"     808080 000000 0.0
156 sprite ons-cp-neut        "CONTROL POINT" ffff00 000000 0.0
157 sprite ons-cp-red         "CONTROL POINT" ff0000 000000 0.0
158 sprite ons-cp-blue        "CONTROL POINT" 0000ff 000000 0.0
159 sprite ons-cp-atck-neut   "CONTROL POINT" ffff00 000000 0.5 000000 ffff00 0.5
160 sprite ons-cp-atck-red    "CONTROL POINT" ff0000 000000 0.5 ff0000 ffff00 0.5
161 sprite ons-cp-atck-blue   "CONTROL POINT" 0000ff 000000 0.5 0000ff ffff00 0.5
162 sprite ons-cp-dfnd-red    "CONTROL POINT" ff0000 000000 0.5 ff0000 ffffff 0.5
163 sprite ons-cp-dfnd-blue   "CONTROL POINT" 0000ff 000000 0.5 0000ff ffffff 0.5