… | |
… | |
19 | my ($cacheprefix) = @_; |
19 | my ($cacheprefix) = @_; |
20 | |
20 | |
21 | eval { |
21 | eval { |
22 | -M "$cacheprefix.pst" < -M "$Crossfire::LIB/crossfire.0" |
22 | -M "$cacheprefix.pst" < -M "$Crossfire::LIB/crossfire.0" |
23 | && ($Crossfire::TILE = new_from_file Gtk2::Gdk::Pixbuf "$cacheprefix.png") |
23 | && ($Crossfire::TILE = new_from_file Gtk2::Gdk::Pixbuf "$cacheprefix.png") |
24 | && (*Crossfire::FACE = Storable::retrieve "$cacheprefix.pst") |
24 | && (*Crossfire::FACE = Storable::retrieve ("$cacheprefix.pst")) |
25 | } or do { |
25 | } or do { |
26 | my $tile = read_pak "$Crossfire::LIB/crossfire.0"; |
26 | my $tile = read_pak "$Crossfire::LIB/crossfire.0"; |
27 | |
27 | |
28 | my %cache; |
28 | my %cache; |
29 | |
29 | |
… | |
… | |
37 | |
37 | |
38 | my $tile = $cache{$name} = {}; |
38 | my $tile = $cache{$name} = {}; |
39 | |
39 | |
40 | my $pb = $tile->{$name} = new_from_file Gtk2::Gdk::Pixbuf $filename; |
40 | my $pb = $tile->{$name} = new_from_file Gtk2::Gdk::Pixbuf $filename; |
41 | |
41 | |
42 | unlink $file; |
42 | unlink $filename; |
43 | |
43 | |
44 | $tile->{pb} = $pb; |
44 | $tile->{pb} = $pb; |
45 | $tile->{idx} = $idx; |
45 | $tile->{idx} = $idx; |
46 | $tile->{w} = int $pb->get_width / TILESIZE; |
46 | $tile->{w} = int $pb->get_width / TILESIZE; |
47 | $tile->{h} = int $pb->get_height / TILESIZE; |
47 | $tile->{h} = int $pb->get_height / TILESIZE; |
… | |
… | |
63 | } |
63 | } |
64 | } |
64 | } |
65 | } |
65 | } |
66 | |
66 | |
67 | $pb->save ("$cacheprefix.png", "png"); |
67 | $pb->save ("$cacheprefix.png", "png"); |
68 | Storable::nstore \%cache, "$cacheprefix.pst"; |
68 | Storable::nstore (\%cache, "$cacheprefix.pst"); |
69 | |
69 | |
70 | $Crossfire::TILE = $pb; |
70 | $Crossfire::TILE = $pb; |
71 | *Crossfire::FACE = \%cache; |
71 | *Crossfire::FACE = \%cache; |
72 | } |
72 | } |
73 | } |
73 | } |