]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - models/sprites/make-sprites.sh
Merge branch 'master' into Mario/nade_drop
[xonotic/xonotic-data.pk3dir.git] / models / sprites / make-sprites.sh
1 #!/bin/bash
2
3 width=512
4 height=64
5
6 sprwidth=512
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=1024
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="1024"
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/xonotic/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="1024px"
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:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
90        d="M 512,124 L 536,100 L 520,100 L 520,60 L 504,60 L 504,100 L 488,100 L 512,124 z "
91        id="path1872"
92        sodipodi:nodetypes="cccccccc" />
93     <text
94        xml:space="preserve"
95        style="font-size:120px;font-weight:bold;text-align:center;text-anchor:middle;opacity:1;fill:#$color;fill-opacity:1;stroke:#$bgcolor;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:xscale"
96        x="512"
97        y="50"
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                 convert "${name}_frame$frame.png" "${name}_frame$frame.tga"
134                 rm -f "${name}_frame$frame.png"
135                 args="$args -sprite ${name}_frame$frame.tga $(($sprwidth / 2)) $(($sprheight - 1)) $interval"
136                 frame=$(($frame + 1))
137         done
138         #./makespr32 -o "$name.sp2" -proj 5 -group $args
139 }
140
141 sprite as-push            "Push"          ff8000 000000 0.0
142 sprite as-destroy         "Destroy"       ff8000 000000 0.0
143 sprite as-defend          "Defend"        0080ff 000000 0.0
144 sprite bluebase           "Blue Base"     0050ff 000000 0.0
145 sprite danger             "DANGER"        ff0000 ffff00 0.0
146 sprite flagcarrier        "Flag carrier"  ffff00 000000 0.0
147 sprite flagdropped        "Dropped flag"  00ffff 000000 0.0
148 sprite helpme             "Help me!"      ffff00 ff0000 0.0
149 sprite here               "Here"          00ff00 000000 0.0
150 sprite key-dropped        "Dropped key"   00ffff 000000 0.0
151 sprite keycarrier-blue    "Key carrier"   0050ff 000000 0.0
152 sprite keycarrier-finish  "Run here"      00ffff 000000 0.0
153 sprite keycarrier-friend  "Key carrier"   00ff00 000000 0.0
154 sprite keycarrier-pink    "Key carrier"   ff00ff 000000 0.0
155 sprite keycarrier-red     "Key carrier"   ff0000 000000 0.0
156 sprite keycarrier-yellow  "Key carrier"   ffff00 000000 0.0
157 sprite redbase            "Red base"      ff0000 000000 0.0
158 sprite waypoint           "Waypoint"      008080 000000 0.0
159 sprite ons-gen-red        "Generator"     ff0000 000000 0.0
160 sprite ons-gen-blue       "Generator"     0050ff 000000 0.0
161 sprite ons-gen-shielded   "Generator"     808080 000000 0.0
162 sprite ons-cp-neut        "Control point" ffff00 000000 0.0
163 sprite ons-cp-red         "Control point" ff0000 000000 0.0
164 sprite ons-cp-blue        "Control point" 0050ff 000000 0.0
165 sprite ons-cp-atck-neut   "Control point" ffff00 000000 0.5 000000 ffff00 0.5
166 sprite ons-cp-atck-red    "Control point" ff0000 000000 0.5 ff0000 ffff00 0.5
167 sprite ons-cp-atck-blue   "Control point" 0050ff 000000 0.5 0050ff ffff00 0.5
168 sprite ons-cp-dfnd-red    "Control point" ff0000 000000 0.5 ff0000 ffffff 0.5
169 sprite ons-cp-dfnd-blue   "Control point" 0050ff 000000 0.5 0050ff ffffff 0.5
170 sprite race-checkpoint    "Checkpoint"    ff8000 000000 0.0
171 sprite race-finish        "Finish"        ff8000 000000 0.0
172 sprite race-start         "Start"         ff8000 000000 0.0
173 sprite nb-ball            "Ball"          e8d8a0 000000 0.0
174 sprite ka-ball            "Ball"          00ffff 000000 0.0
175 sprite ka-ballcarrier     "Ball carrier"  ff0000 000000 0.0
176
177 sprite wpn-laser          "Laser"         ff8080 000000 0.0 # bright red
178 sprite wpn-shotgun        "Shotgun"       804000 000000 0.0 # brown
179 sprite wpn-uzi            "Machine Gun"   ffff00 000000 0.0 # yellow
180 sprite wpn-gl             "Mortar"        ff0000 000000 0.0 # red
181 sprite wpn-electro        "Electro"       0080ff 000000 0.0 # bluish cyan
182 sprite wpn-crylink        "Crylink"       ff80ff 000000 0.0 # bright pink
183 sprite wpn-nex            "Nex"           00ffff 000000 0.0 # cyan
184 sprite wpn-hagar          "Hagar"         ffff80 000000 0.0 # bright yellow
185 sprite wpn-rl             "Rocket Launcher" ffff00 000000 0.0 # yellow
186 sprite wpn-porto          "Port-O-Launch" 808080 000000 0.0 # grey
187 sprite wpn-minstanex      "Minstanex"     80ffff 000000 0.0 # bright cyan
188 sprite wpn-hookgun        "Hook"          008000 000000 0.0 # dark green
189 sprite wpn-fireball       "Fireball"      ff8000 000000 0.0 # orange
190 sprite wpn-hlac           "HLAC"          00ff00 000000 0.0 # green
191 sprite wpn-campingrifle   "Rifle"         80ff00 000000 0.0 # orange
192 sprite wpn-minelayer      "Mine Layer"    ccff00 000000 0.0 # yellowish orange
193
194 sprite dom-neut           "Control point" 00ffff 000000 0.0
195 sprite dom-red            "Control point" ff0000 000000 0.0
196 sprite dom-blue           "Control point" 0050ff 000000 0.0
197 sprite dom-yellow         "Control point" ffff00 000000 0.0
198 sprite dom-pink           "Control point" ff00ff 000000 0.0
199
200 sprite item-invis         "Invisibility"  0050ff 000000 0.5 0050ff ffff00 0.5
201 sprite item-extralife     "Extra life"    ff0000 000000 0.5 ff0000 ffff00 0.5
202 sprite item-speed         "Speed"         ff00ff 000000 0.5 ff00ff ffff00 0.5
203 sprite item-strength      "Strength"      0050ff 000000 0.5 0050ff ffff00 0.5
204 sprite item-shield        "Shield"        ff00ff 000000 0.5 ff00ff ffff00 0.5
205 sprite item-fuelregen     "Fuel regen"    ff8000 000000 0.5 ff8000 ffff00 0.5
206 sprite item-jetpack       "Jet Pack"      808080 000000 0.5 808080 ffff00 0.5
207
208 sprite freezetag_frozen   "Frozen!"       40e6ff 000000 0.0 # bright cyan
209
210 sprite tagged-target                    "Tagged"                                80ff0f 000000 0.25 80ff0f ffff80 0.25