… | |
… | |
19 | use File::Temp; |
19 | use File::Temp; |
20 | use Crossfire; |
20 | use Crossfire; |
21 | use Coro; |
21 | use Coro; |
22 | use Coro::AIO; |
22 | use Coro::AIO; |
23 | use POSIX (); |
23 | use POSIX (); |
|
|
24 | use Digest::MD5; |
|
|
25 | use Coro::Storable; $Storable::canonical = 1; |
24 | |
26 | |
25 | sub usage { |
27 | sub usage { |
26 | warn <<EOF; |
28 | warn <<EOF; |
27 | Usage: cfutil [-v] [-q] [--force] [--cache] |
29 | Usage: cfutil [-v] [-q] [--force] [--cache] |
28 | [--install-arch path] |
30 | [--install-arch path] |
… | |
… | |
66 | } |
68 | } |
67 | |
69 | |
68 | sub inst_maps($) { |
70 | sub inst_maps($) { |
69 | my (undef, $path) = @_; |
71 | my (undef, $path) = @_; |
70 | |
72 | |
71 | print "installing '$path' to '$DATADIR/maps'\n\n"; |
73 | print "\nInstalling '$path' to '$DATADIR/maps'\n\n"; |
72 | |
74 | |
73 | if (!-f "$path/regions") { |
75 | if (!-f "$path/regions") { |
74 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
76 | warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; |
75 | exit 1 unless $FORCE; |
77 | exit 1 unless $FORCE; |
76 | } |
78 | } |
77 | |
79 | |
78 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"; |
80 | system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" |
|
|
81 | and die "map installation failed.\n"; |
|
|
82 | |
|
|
83 | print "maps installed successfully.\n"; |
79 | } |
84 | } |
80 | |
85 | |
81 | { |
86 | { |
82 | our @PNG; |
87 | our %ANIMINFO; |
|
|
88 | our %FACEINFO; |
83 | our @ARC; |
89 | our @ARC; |
|
|
90 | our %ARC; |
|
|
91 | our $TRS; |
84 | our $NFILE; |
92 | our $NFILE; |
85 | our @FACE; |
93 | |
86 | our $ANIM; |
94 | our $QUANTIZE = "+dither -colorspace RGB -colors 256"; |
87 | |
95 | |
88 | our (@png, @trs, @arc); # files we are interested in |
96 | our (@png, @trs, @arc); # files we are interested in |
89 | |
97 | |
90 | sub commit_png { |
98 | sub commit_png($$$) { |
91 | my ($name, $data) = @_; |
99 | my ($name, $data, $T) = @_; |
92 | |
100 | |
93 | push @PNG, [$name => $data]; |
101 | $FACEINFO{$name}{"data$T"} = $data; |
94 | } |
102 | } |
95 | |
103 | |
96 | sub process_png { |
104 | sub process_png { |
97 | while (@png) { |
105 | while (@png) { |
98 | my $path = pop @png; |
106 | my ($path, $delete) = @{pop @png}; |
99 | |
107 | |
100 | my $png; |
108 | my $png; |
101 | aio_lstat $path; |
109 | aio_lstat $path; |
102 | my ($size, $mtime) = (stat _)[7,9]; |
110 | my ($size, $mtime) = (stat _)[7,9]; |
103 | |
111 | |
104 | if (0 > aio_load $path, $png) { |
112 | if (0 > aio_load $path, $png) { |
105 | warn "$path: $!, skipping.\n"; |
113 | warn "$path: $!, skipping.\n"; |
106 | next; |
114 | next; |
107 | } |
115 | } |
108 | |
116 | |
109 | # quickly extratc width and height of the (necessarily PNG) image |
117 | my $stem = $path; |
110 | unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) { |
118 | my $T; |
111 | warn "$path: not a recongized png file, skipping.\n"; |
|
|
112 | next; |
|
|
113 | } |
|
|
114 | |
119 | |
115 | my ($w, $h) = unpack "NN", $1; |
120 | if ($stem =~ s/\.32x32\.png~?$//) { |
116 | |
|
|
117 | (my $face = $path) =~ s/^.*\///; |
|
|
118 | my $T = 32; |
121 | $T = 32; |
119 | |
122 | } elsif ($stem =~ s/\.64x64\.png~?$//) { |
120 | unless ($face =~ s/\.base\.(...)\.png$/.$1/) { |
123 | $T = 64; |
|
|
124 | } else { |
121 | warn "$path: weird filename, skipping.\n"; |
125 | warn "$path: weird filename, skipping.\n"; |
122 | next; |
126 | next; |
123 | } |
127 | } |
|
|
128 | |
|
|
129 | # quickly extract width and height of the (necessarily PNG) image |
|
|
130 | unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) { |
|
|
131 | warn "$path: not a recognized png file, skipping.\n"; |
|
|
132 | next; |
|
|
133 | } |
|
|
134 | |
|
|
135 | my ($w, $h) = unpack "NN", $1; |
124 | |
136 | |
125 | if ($w < $T || $h < $T) { |
137 | if ($w < $T || $h < $T) { |
126 | warn "$path: too small ($w $h), skipping.\n"; |
138 | warn "$path: too small ($w $h), skipping.\n"; |
127 | next; |
139 | next; |
128 | } |
140 | } |
… | |
… | |
130 | if ($w % $T || $h % $T) { |
142 | if ($w % $T || $h % $T) { |
131 | warn "$path: weird png size ($w $h), skipping.\n"; |
143 | warn "$path: weird png size ($w $h), skipping.\n"; |
132 | next; |
144 | next; |
133 | } |
145 | } |
134 | |
146 | |
|
|
147 | unless ($path =~ /~$/) { |
|
|
148 | # possibly enlarge |
|
|
149 | if (0 > aio_stat "$stem.64x64.png") { |
|
|
150 | my $other = "$stem.64x64.png~"; |
|
|
151 | |
|
|
152 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
|
|
153 | my $wrap = 0; # for the time being |
|
|
154 | fork_sub { |
|
|
155 | system "convert png:\Q$path\E -depth 8 rgba:-" |
|
|
156 | . "| $exec_prefix/bin/cfhq2xa $w $h $wrap" |
|
|
157 | . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $QUANTIZE -quality 00 png32:\Q$other\E~" |
|
|
158 | and die "convert/hq2xa pipeline error: status $? ($!)"; |
|
|
159 | system $OPTIPNG, "-o5", "-i0", "-q", "$other~"; |
|
|
160 | die "$other~ has zero size, aborting." unless -s "$other~"; |
|
|
161 | rename "$other~", $other; |
|
|
162 | }; |
|
|
163 | } |
|
|
164 | |
|
|
165 | push @png, [$other, !$CACHE]; |
|
|
166 | } |
|
|
167 | |
|
|
168 | # possibly scale down |
|
|
169 | if (0 > aio_stat "$stem.32x32.png") { |
|
|
170 | my $other = "$stem.32x32.png~"; |
|
|
171 | |
|
|
172 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
|
|
173 | fork_sub { |
|
|
174 | system "convert png:\Q$path\E -geometry 50% -filter lanczos $QUANTIZE -quality 00 png32:\Q$other\E~"; |
|
|
175 | system $OPTIPNG, "-o5", "-i0", "-q", "$other~"; |
|
|
176 | die "$other~ has zero size, aborting." unless -s "$other~"; |
|
|
177 | rename "$other~", $other; |
|
|
178 | }; |
|
|
179 | } |
|
|
180 | |
|
|
181 | #warn "scaled down $path to $other\n";#d# |
|
|
182 | push @png, [$other, !$CACHE]; |
|
|
183 | } |
|
|
184 | } |
|
|
185 | |
|
|
186 | (my $face = $stem) =~ s/^.*\///; |
|
|
187 | |
|
|
188 | # split all bigfaces, but avoid smoothfaces (*_S) |
135 | if (($w > $T || $h > $T) && $face !~ /_S\./) { |
189 | if (($w > $T || $h > $T) && $face !~ /_S\./) { |
136 | # split |
190 | # split |
137 | my @tile; |
191 | my @tile; |
138 | for my $x (0 .. (int $w / $T) - 1) { |
192 | for my $x (0 .. (int $w / $T) - 1) { |
139 | for my $y (0 .. (int $h / $T) - 1) { |
193 | for my $y (0 .. (int $h / $T) - 1) { |
… | |
… | |
147 | my @todo = grep { $_->[3] <= $mtime } @tile; |
201 | my @todo = grep { $_->[3] <= $mtime } @tile; |
148 | if (@todo) { |
202 | if (@todo) { |
149 | fork_sub { |
203 | fork_sub { |
150 | open my $convert, "|-", $CONVERT, |
204 | open my $convert, "|-", $CONVERT, |
151 | "png:-", |
205 | "png:-", |
152 | -negate,#d# |
|
|
153 | (map { |
206 | (map { |
154 | ( |
207 | ( |
155 | "(", |
208 | "(", |
156 | "+clone", |
209 | "+clone", |
157 | -crop => (sprintf "%dx%d+%d+%d", $T, $T, $_->[0] * $T, $_->[1] * $T), |
210 | -crop => (sprintf "%dx%d+%d+%d", $T, $T, $_->[0] * $T, $_->[1] * $T), |
|
|
211 | "+repage", |
|
|
212 | -quality => "00", |
158 | -write => "png:$_->[2]~", |
213 | -write => "png32:$_->[2]~", |
159 | "+delete", |
214 | "+delete", |
160 | ")", |
215 | ")", |
161 | ) |
216 | ) |
162 | } @todo), |
217 | } @todo), |
163 | "null:"; |
218 | "null:"; |
… | |
… | |
167 | close $convert; |
222 | close $convert; |
168 | |
223 | |
169 | # pass 2, optimise, and rename |
224 | # pass 2, optimise, and rename |
170 | for (@todo) { |
225 | for (@todo) { |
171 | system $OPTIPNG, "-o5", "-i0", "-q", "$_->[2]~"; |
226 | system $OPTIPNG, "-o5", "-i0", "-q", "$_->[2]~"; |
|
|
227 | die "$_->[2]~ has zero size, aborting." unless -s "$_->[2]~"; |
172 | rename "$_->[2]~", $_->[2]; |
228 | rename "$_->[2]~", $_->[2]; |
173 | } |
229 | } |
174 | }; |
230 | }; |
175 | } |
231 | } |
176 | |
232 | |
… | |
… | |
180 | |
236 | |
181 | if (0 > aio_load $file, $tile) { |
237 | if (0 > aio_load $file, $tile) { |
182 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
238 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
183 | } |
239 | } |
184 | IO::AIO::aio_unlink $file unless $CACHE; |
240 | IO::AIO::aio_unlink $file unless $CACHE; |
185 | commit_png $x|$y ? "$face+$x+$y" : $face, $tile; |
241 | commit_png $x|$y ? "$face+$x+$y" : $face, $tile, $T; |
186 | } |
242 | } |
187 | } else { |
243 | } else { |
188 | # use as-is (either small, use smooth) |
244 | # use as-is (either small, use smooth) |
189 | commit_png $face, $png; |
245 | commit_png $face, $png, $T; |
190 | } |
246 | } |
|
|
247 | |
|
|
248 | aio_unlink $path if $delete; |
191 | } |
249 | } |
192 | } |
250 | } |
193 | |
251 | |
194 | sub process_arc { |
252 | sub process_arc { |
195 | while (@arc) { |
253 | while (@arc) { |
… | |
… | |
199 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
257 | aio_load "$dir/$file", $arc; # simply pre-cache, as read_arch wants a file :/ |
200 | |
258 | |
201 | my $arc = read_arch "$dir/$file"; |
259 | my $arc = read_arch "$dir/$file"; |
202 | for my $o (values %$arc) { |
260 | for my $o (values %$arc) { |
203 | push @ARC, $o; |
261 | push @ARC, $o; |
|
|
262 | for (my $m = $o; $m; $m = $m->{more}) { |
|
|
263 | $ARC{$m->{_name}} = $m; |
|
|
264 | } |
|
|
265 | |
|
|
266 | $o->{editor_folder} = $dir; |
|
|
267 | |
|
|
268 | my $visibility = delete $o->{visibility}; |
|
|
269 | my $magicmap = delete $o->{magicmap}; |
|
|
270 | |
|
|
271 | # find upper left corner :/ |
|
|
272 | # omg, this is sooo broken |
204 | my ($dx, $dy); |
273 | my ($dx, $dy); |
205 | # omg, this is sooo broken |
|
|
206 | for (my $o = $o; $o; $o = $o->{more}) { |
274 | for (my $o = $o; $o; $o = $o->{more}) { |
207 | $dx = $o->{x} if $o->{x} < $dx; |
275 | $dx = $o->{x} if $o->{x} < $dx; |
208 | $dy = $o->{y} if $o->{y} < $dy; |
276 | $dy = $o->{y} if $o->{y} < $dy; |
209 | } |
277 | } |
|
|
278 | |
210 | for (my $o = $o; $o; $o = $o->{more}) { |
279 | for (my $o = $o; $o; $o = $o->{more}) { |
211 | my $x = $o->{x} - $dx; |
280 | my $x = $o->{x} - $dx; |
212 | my $y = $o->{y} - $dy; |
281 | my $y = $o->{y} - $dy; |
213 | if ($x|$y) { |
282 | |
214 | $_ .= "+$x+$y" for $o->{face}, @{$o->{anim} || []}; |
283 | my $ext = $x|$y ? "+$x+$y" : ""; |
215 | } |
284 | |
216 | } |
285 | $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face}; |
|
|
286 | |
|
|
287 | my $visibility = delete $o->{visibility} if exists $o->{visibility}; |
|
|
288 | my $magicmap = delete $o->{magicmap} if exists $o->{magicmap}; |
|
|
289 | |
217 | if (my $anim = delete $o->{anim}) { |
290 | my $anim = delete $o->{anim}; |
|
|
291 | |
|
|
292 | if ($anim) { |
|
|
293 | # possibly add $ext to the animation name to avoid |
|
|
294 | # the need to specify archnames for all parts |
|
|
295 | # of a multipart archetype. |
218 | $o->{animation} = $o->{_name}; |
296 | $o->{animation} = "$o->{_name}"; |
219 | $ANIM .= join "", map "$_\n", |
297 | my $facings = 1; |
220 | "anim $o->{_name}", |
298 | my @frames; |
|
|
299 | |
|
|
300 | for (@$anim) { |
|
|
301 | if (/^facings\s+(\d+)/) { |
|
|
302 | $facings = $1*1; |
|
|
303 | } elsif (/^blank.x11$|^empty.x11$/) { |
|
|
304 | push @frames, $_; |
|
|
305 | } else { |
|
|
306 | push @frames, "$_$ext"; |
221 | @$anim, |
307 | } |
222 | "mina"; |
308 | } |
|
|
309 | |
|
|
310 | $ANIMINFO{$o->{animation}} = { |
|
|
311 | facings => $facings, |
|
|
312 | frames => \@frames, |
|
|
313 | }; |
|
|
314 | } |
|
|
315 | |
|
|
316 | for my $face ($o->{face} || (), @{$anim || []}) { |
|
|
317 | next if $face =~ /^facings\s|^blank.x11$|^empty.x11$/; |
|
|
318 | |
|
|
319 | my $info = $FACEINFO{$face} ||= {}; |
|
|
320 | |
|
|
321 | $info->{visibility} = $visibility if defined $visibility; |
|
|
322 | $info->{magicmap} = $magicmap if defined $magicmap; |
|
|
323 | } |
|
|
324 | |
|
|
325 | if (my $smooth = delete $o->{smoothface}) { |
|
|
326 | my %kv =split /\s+/, $smooth; |
|
|
327 | my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support |
|
|
328 | while (my ($face, $smooth) = each %kv) { |
|
|
329 | $FACEINFO{$face}{smooth} = $smooth; |
|
|
330 | $FACEINFO{$face}{smoothlevel} = $level; |
|
|
331 | } |
|
|
332 | } |
223 | } |
333 | } |
224 | } |
334 | } |
225 | } |
335 | } |
226 | } |
336 | } |
227 | |
337 | |
228 | sub process_trs { |
338 | sub process_trs { |
229 | while (@trs) { |
339 | while (@trs) { |
230 | my ($dir, $file) = @{pop @trs}; |
340 | my ($dir, $file) = @{pop @trs}; |
|
|
341 | my $path = "$dir/$file"; |
|
|
342 | |
|
|
343 | my $trs; |
|
|
344 | if (0 > aio_load $path, $trs) { |
|
|
345 | warn "$path: $!, skipping.\n"; |
|
|
346 | next; |
|
|
347 | } |
|
|
348 | |
|
|
349 | $TRS .= $trs; |
231 | } |
350 | } |
232 | } |
351 | } |
233 | |
352 | |
234 | sub find_files; |
353 | sub find_files; |
235 | sub find_files { |
354 | sub find_files { |
… | |
… | |
242 | find_files "$path/$_" |
361 | find_files "$path/$_" |
243 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
362 | for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; |
244 | |
363 | |
245 | for my $file (@$nondirs) { |
364 | for my $file (@$nondirs) { |
246 | if ($file =~ /\.png$/) { |
365 | if ($file =~ /\.png$/) { |
247 | push @png, "$path/$file"; |
366 | push @png, ["$path/$file", 0]; |
248 | } elsif ($file =~ /\.trs$/) { |
367 | } elsif ($file =~ /\.trs$/) { |
249 | push @trs, [$path, $file]; |
368 | push @trs, [$path, $file]; |
250 | } elsif ($file =~ /\.arc$/) { |
369 | } elsif ($file =~ /\.arc$/) { |
251 | push @arc, [$path, $file]; |
370 | push @arc, [$path, $file]; |
252 | } else { |
371 | } else { |
… | |
… | |
257 | } |
376 | } |
258 | |
377 | |
259 | sub inst_arch($) { |
378 | sub inst_arch($) { |
260 | my (undef, $path) = @_; |
379 | my (undef, $path) = @_; |
261 | |
380 | |
|
|
381 | print "\n", |
262 | print "installing '$path' to '$DATADIR'\n\n"; |
382 | "Installing '$path' to '$DATADIR'\n", |
|
|
383 | "\n", |
|
|
384 | "This can take a long time if you run this\n", |
|
|
385 | "for the first time or do not use --cache.\n", |
|
|
386 | "\n", |
|
|
387 | "Unless you run verbosely, all following warning\n", |
|
|
388 | "or error messages indicate serious problems.\n", |
|
|
389 | "\n"; |
263 | |
390 | |
264 | if (!-d "$path/treasures") { |
391 | if (!-d "$path/treasures") { |
265 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
392 | warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; |
266 | exit 1 unless $FORCE; |
393 | exit 1 unless $FORCE; |
267 | } |
394 | } |
268 | |
395 | |
269 | find_files $path; |
396 | find_files $path; |
270 | IO::AIO::flush; |
397 | IO::AIO::flush; |
271 | |
398 | |
272 | $_->join for ( |
399 | $_->join for ( |
273 | (async \&process_png), (async \&process_png), |
400 | # four png crunchers work fine for my 2x smp machine |
|
|
401 | (async \&process_png), (async \&process_png), (async \&process_png), (async \&process_png), |
274 | (async \&process_trs), (async \&process_trs), |
402 | (async \&process_trs), (async \&process_trs), |
275 | (async \&process_arc), (async \&process_arc), |
403 | (async \&process_arc), (async \&process_arc), |
276 | ); |
404 | ); |
277 | |
405 | |
278 | { |
406 | { |
279 | open my $fh, ">:utf8", "$DATADIR/animations~" |
407 | # remove path prefix from editor_folder |
280 | or die "$DATADIR/animations~: $!"; |
408 | substr $_->{editor_folder}, 0, 1 + length $path, "" |
281 | print $fh $ANIM; |
409 | for values %ARC; |
|
|
410 | |
|
|
411 | # resolve inherit |
|
|
412 | while () { |
|
|
413 | my $progress; |
|
|
414 | my $loop; |
|
|
415 | |
|
|
416 | for my $o (values %ARC) { |
|
|
417 | if (my $other = $o->{inherit}) { |
|
|
418 | if (my $s = $ARC{$other}) { |
|
|
419 | if ($s->{inherit}) { |
|
|
420 | $loop = $s; |
|
|
421 | } else { |
|
|
422 | delete $o->{inherit}; |
|
|
423 | my %s = %$s; |
|
|
424 | delete @s{qw(_name more name name_pl)}; |
|
|
425 | %$o = ( %s, %$o ); |
|
|
426 | ++$progress; |
|
|
427 | } |
|
|
428 | } else { |
|
|
429 | warn "'$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n"; |
|
|
430 | delete $ARC{$o->{_name}}; |
|
|
431 | } |
|
|
432 | } |
|
|
433 | } |
|
|
434 | |
|
|
435 | unless ($progress) { |
|
|
436 | die "inheritance loop detected starting at archetype '$loop->{_name}', aborting.\n" |
|
|
437 | if $loop; |
|
|
438 | |
|
|
439 | last; |
|
|
440 | } |
282 | } |
441 | } |
283 | |
442 | |
284 | { |
|
|
285 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
443 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
286 | or die "$DATADIR/archetypes~: $!"; |
444 | or die "$DATADIR/archetypes~: $!"; |
287 | print $fh Crossfire::archlist_to_string \@ARC; |
445 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; |
288 | } |
446 | } |
289 | |
|
|
290 | @PNG = sort { $a->[0] cmp $b->[0] } @PNG; |
|
|
291 | |
447 | |
292 | { |
448 | { |
|
|
449 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
|
|
450 | or die "$DATADIR/treasures~: $!"; |
|
|
451 | print $fh $TRS; |
|
|
452 | } |
|
|
453 | |
|
|
454 | { |
|
|
455 | while (my ($k, $v) = each %FACEINFO) { |
|
|
456 | length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n"; |
|
|
457 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
|
|
458 | |
|
|
459 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
|
|
460 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
|
|
461 | |
|
|
462 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
|
|
463 | $v->{chksum64} = Digest::MD5::md5 $v->{data64}; |
|
|
464 | } |
|
|
465 | |
293 | open my $fh, ">:perlio", "$DATADIR/crossfire.0~" |
466 | open my $fh, ">:perlio", "$DATADIR/facedata~" |
294 | or die "$DATADIR/crossfire.0~: $!"; |
467 | or die "$DATADIR/facedata~: $!"; |
295 | printf $fh "IMAGE %d %d %s\x0a%s", $_, (length $PNG[$_][1]), $PNG[$_][0], $PNG[$_][1] |
468 | |
296 | for 0.. $#PNG; |
469 | print $fh freeze { |
|
|
470 | version => 2, |
|
|
471 | faceinfo => \%FACEINFO, |
|
|
472 | animinfo => \%ANIMINFO, |
297 | } |
473 | }; |
|
|
474 | } |
298 | |
475 | |
299 | rename "$DATADIR/archetypes~" , "$DATADIR/archetypes"; |
476 | for (qw(archetypes facedata treasures)) { |
300 | rename "$DATADIR/crossfire.0~", "$DATADIR/crossfire.0"; |
477 | chmod 0644, "$DATADIR/$_~"; |
301 | rename "$DATADIR/animations~" , "$DATADIR/animations"; |
478 | rename "$DATADIR/$_~", "$DATADIR/$_" |
|
|
479 | or die "$DATADIR/$_: $!"; |
|
|
480 | } |
302 | |
481 | |
303 | die "--install-arch not fully implemented\n"; |
482 | print "archetype data installed successfully.\n"; |
304 | } |
483 | } |
305 | } |
484 | } |
306 | |
485 | |
307 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
486 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
308 | GetOptions ( |
487 | GetOptions ( |