ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.112 by root, Thu Jun 21 00:07:54 2007 UTC vs.
Revision 1.114 by root, Sun Sep 16 13:28:41 2007 UTC

808 808
809 my (%ignore); 809 my (%ignore);
810 my (@section_order, %section, @attr_order); 810 my (@section_order, %section, @attr_order);
811 811
812 while (my $type = shift @import) { 812 while (my $type = shift @import) {
813 push @import,
814 grep $_,
815 map $Crossfire::Data::TYPE{$_},
813 push @import, @{$type->{import} || []}; 816 @{$type->{import} || []};
814 817
815 $attr->{$_} ||= $type->{$_} 818 $attr->{$_} ||= $type->{$_}
816 for qw(name desc use); 819 for qw(name desc use);
817 820
818 for (@{$type->{ignore} || []}) { 821 for (@{$type->{ignore} || []}) {
943=cut 946=cut
944 947
945sub load_tilecache() { 948sub load_tilecache() {
946 require Gtk2; 949 require Gtk2;
947 950
948 if (-e "$LIB/facedata") { # Crossfire TRT faces
949 cache_file "$LIB/facedata", "$VARDIR/tilecache.pst", \&use_tilecache, 951 cache_file "$LIB/facedata", "$VARDIR/tilecache.pst", \&use_tilecache,
950 sub { 952 sub {
951 my %cache; 953 my %cache;
952 my $facedata = Storable::retrieve "$LIB/facedata"; 954 my $facedata = Storable::retrieve "$LIB/facedata";
953 955
954 $facedata->{version} == 2 956 $facedata->{version} == 2
955 or die "$LIB/facedata: version mismatch, cannot proceed."; 957 or die "$LIB/facedata: version mismatch, cannot proceed.";
956 958
957 my $faces = $facedata->{faceinfo}; 959 my $faces = $facedata->{faceinfo};
958 my $idx = 0; 960 my $idx = 0;
959 961
960 for (sort keys %$faces) { 962 for (sort keys %$faces) {
961 my ($face, $info) = ($_, $faces->{$_}); 963 my ($face, $info) = ($_, $faces->{$_});
962 964
963 my $pb = new Gtk2::Gdk::PixbufLoader; 965 my $pb = new Gtk2::Gdk::PixbufLoader;
964 $pb->write ($info->{data32}); 966 $pb->write ($info->{data32});
965 $pb->close; 967 $pb->close;
966 my $pb = $pb->get_pixbuf; 968 my $pb = $pb->get_pixbuf;
967 969
968 my $tile = $cache{$face} = { 970 my $tile = $cache{$face} = {
969 pb => $pb, 971 pb => $pb,
970 idx => $idx, 972 idx => $idx,
971 w => int $pb->get_width / TILESIZE, 973 w => int $pb->get_width / TILESIZE,
972 h => int $pb->get_height / TILESIZE, 974 h => int $pb->get_height / TILESIZE,
973 }; 975 };
974 976
975 $idx += $tile->{w} * $tile->{h}; 977 $idx += $tile->{w} * $tile->{h};
976 } 978 }
977 979
978 construct_tilecache_pb $idx, \%cache; 980 construct_tilecache_pb $idx, \%cache;
979 981
980 \%cache 982 \%cache
981 }; 983 };
982
983 *FACEDATA = Storable::retrieve "$LIB/facedata";
984
985 } elsif (-e "$LIB/crossfire.0") { # Crossfire1 version
986 cache_file "$LIB/crossfire.0", "$VARDIR/tilecache.pst", \&use_tilecache,
987 sub {
988 my $tile = read_pak "$LIB/crossfire.0";
989
990 my %cache;
991
992 my $idx = 0;
993
994 for my $name (sort keys %$tile) {
995 my $pb = new Gtk2::Gdk::PixbufLoader;
996 $pb->write ($tile->{$name});
997 $pb->close;
998 my $pb = $pb->get_pixbuf;
999
1000 my $tile = $cache{$name} = {
1001 pb => $pb,
1002 idx => $idx,
1003 w => int $pb->get_width / TILESIZE,
1004 h => int $pb->get_height / TILESIZE,
1005 };
1006
1007 $idx += $tile->{w} * $tile->{h};
1008 }
1009
1010 construct_tilecache_pb $idx, \%cache;
1011
1012 \%cache
1013 };
1014
1015 *FACEDATA = { };
1016 }
1017} 984}
1018 985
1019=head1 AUTHOR 986=head1 AUTHOR
1020 987
1021 Marc Lehmann <schmorp@schmorp.de> 988 Marc Lehmann <schmorp@schmorp.de>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines