… | |
… | |
6 | |
6 | |
7 | =cut |
7 | =cut |
8 | |
8 | |
9 | package Deliantra; |
9 | package Deliantra; |
10 | |
10 | |
11 | our $VERSION = '1.30'; |
11 | our $VERSION = '2.0'; |
12 | |
12 | |
13 | use common::sense; |
13 | use common::sense; |
14 | |
14 | |
15 | use base 'Exporter'; |
15 | use base 'Exporter'; |
16 | |
16 | |
… | |
… | |
1010 | require Gtk2; |
1010 | require Gtk2; |
1011 | |
1011 | |
1012 | cache_file "$LIB/facedata", "$VARDIR/tilecache.pst", \&use_tilecache, |
1012 | cache_file "$LIB/facedata", "$VARDIR/tilecache.pst", \&use_tilecache, |
1013 | sub { |
1013 | sub { |
1014 | my %cache; |
1014 | my %cache; |
1015 | my $facedata = Storable::retrieve "$LIB/facedata"; |
1015 | my $facedata = Storable::retrieve "$LIB/faceinfo"; |
|
|
1016 | |
|
|
1017 | open my $fh, "<", "$LIB/facedata" |
|
|
1018 | or die "$LIB/facedata: $!"; |
1016 | |
1019 | |
1017 | $facedata->{version} == 2 |
1020 | $facedata->{version} == 2 |
1018 | or die "$LIB/facedata: version mismatch, cannot proceed."; |
1021 | or die "$LIB/facedata: version mismatch, cannot proceed."; |
1019 | |
1022 | |
1020 | my $faces = $facedata->{faceinfo}; |
1023 | my $faces = $facedata->{faceinfo}; |
… | |
… | |
1022 | |
1025 | |
1023 | for (sort keys %$faces) { |
1026 | for (sort keys %$faces) { |
1024 | my ($face, $info) = ($_, $faces->{$_}); |
1027 | my ($face, $info) = ($_, $faces->{$_}); |
1025 | |
1028 | |
1026 | my $pb = new Gtk2::Gdk::PixbufLoader; |
1029 | my $pb = new Gtk2::Gdk::PixbufLoader; |
|
|
1030 | |
|
|
1031 | if (exists $info->{data32}) { |
1027 | $pb->write ($info->{data32}); |
1032 | $pb->write ($info->{data32}); |
|
|
1033 | } else { |
|
|
1034 | sysseek $fh, $info->{fofs32}, 0; |
|
|
1035 | sysread $fh, my $buf, $info->{size32}; |
|
|
1036 | $pb->write ($buf); |
|
|
1037 | } |
1028 | $pb->close; |
1038 | $pb->close; |
1029 | my $pb = $pb->get_pixbuf; |
1039 | my $pb = $pb->get_pixbuf; |
1030 | |
1040 | |
1031 | my $tile = $cache{$face} = { |
1041 | my $tile = $cache{$face} = { |
1032 | pb => $pb, |
1042 | pb => $pb, |