… | |
… | |
4 | #TODO: fix dialogue |
4 | #TODO: fix dialogue |
5 | #TODO: update file format version |
5 | #TODO: update file format version |
6 | |
6 | |
7 | # this script checks, fixes and simplifies @match expressions in a map |
7 | # this script checks, fixes and simplifies @match expressions in a map |
8 | |
8 | |
|
|
9 | use common::sense; |
|
|
10 | |
9 | use Deliantra; |
11 | use Deliantra; |
10 | use Deliantra::Map; |
12 | use Deliantra::Map; |
11 | |
13 | |
12 | load_archetypes; |
14 | Deliantra::load_archetypes; |
13 | |
15 | |
14 | our $dirty; |
16 | our $dirty; |
|
|
17 | our $path; |
15 | |
18 | |
16 | sub fix_msg($) { |
19 | sub fix_msg($) { |
17 | my ($msg) = @_; |
20 | my ($msg) = @_; |
18 | |
21 | |
19 | local $_ = $msg; |
22 | local $_ = $msg; |
… | |
… | |
43 | |
46 | |
44 | $_ |
47 | $_ |
45 | } |
48 | } |
46 | |
49 | |
47 | sub patch_arch($) { |
50 | sub patch_arch($) { |
|
|
51 | warn "$path: references unknown archetype $_[0]{_name}\n" |
|
|
52 | unless exists $ARCH{ $_[0]{_name} }; |
|
|
53 | |
48 | if ($_[0]{face} =~ /\.[1-9]\d\d$/) { |
54 | if ($_[0]{face} =~ /\.[1-9]\d\d$/) { |
49 | $_[0]{face} =~ s/\.([2-9])\1\1$/.x1$1/; # 222, 333, 444 |
55 | $_[0]{face} =~ s/\.([2-9])\1\1$/.x1$1/; # 222, 333, 444 |
50 | $_[0]{face} =~ s/\.1(\d\d)$/.x$1/; # 1AB xAB |
56 | $_[0]{face} =~ s/\.1(\d\d)$/.x$1/; # 1AB xAB |
51 | $dirty++; |
57 | $dirty++; |
52 | } |
|
|
53 | |
|
|
54 | unless (exists $ARCH{ $_[0]{_name} }) { |
|
|
55 | die "$_[0]{_name}\n";#d# |
|
|
56 | } |
58 | } |
57 | } |
59 | } |
58 | |
60 | |
59 | sub patch_inv($) { |
61 | sub patch_inv($) { |
60 | my ($arch) = @_; |
62 | my ($arch) = @_; |