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.4 by root, Sun Feb 5 00:18:26 2006 UTC vs.
Revision 1.9 by root, Sun Feb 5 21:18:07 2006 UTC

8 8
9our $VERSION = '0.1'; 9our $VERSION = '0.1';
10 10
11use strict; 11use strict;
12 12
13use base 'Exporter';
14
13use Storable; 15use Storable;
14use List::Util qw(max); 16
17our @EXPORT = qw(read_pak read_arch arch2map $ARCH TILESIZE);
15 18
16our $LIB = $ENV{CROSSFIRE_LIBDIR} 19our $LIB = $ENV{CROSSFIRE_LIBDIR}
17 or die "\$CROSSFIRE_LIBDIR must be set\n"; 20 or die "\$CROSSFIRE_LIBDIR must be set\n";
18 21
19sub T (){ 32 } 22sub TILESIZE (){ 32 }
20 23
21our $ARCH; 24our $ARCH;
22our $TILE;
23 25
24sub read_pak($;$) { 26sub read_pak($;$) {
25 my ($path, $cache) = @_; 27 my ($path, $cache) = @_;
26 28
27 eval { 29 eval {
132 my ($mapx, $mapy); 134 my ($mapx, $mapy);
133 135
134 my $map; 136 my $map;
135 137
136 for (@{ $mapa->{arch} }) { 138 for (@{ $mapa->{arch} }) {
137 my ($x, $y) = ($_->{x}, $_->{y}); 139 my ($x, $y) = (delete $_->{x}, delete $_->{y});
138 140
139 if ($_->{_name} eq "map") { 141 if ($_->{_name} eq "map") {
140 $meta{info} = $_; 142 $meta{info} = $_;
141 143
142 $mapx = $_->{width} || $x; 144 $mapx = $_->{width} || $x;
152 } 154 }
153 } 155 }
154 156
155 $meta{width} = $mapx; 157 $meta{width} = $mapx;
156 $meta{height} = $mapy; 158 $meta{height} = $mapy;
159 $meta{map} = $map;
157 160
158 \%meta 161 \%meta
159} 162}
160 163
161sub init($) { 164sub init($) {
162 my ($cachedir) = @_; 165 my ($cachedir) = @_;
163 166
164 $ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst"; 167 $ARCH = read_arch "$LIB/archetypes", "$cachedir/archetypes.pst";
165 $TILE = read_pak "$LIB/crossfire.0", "$cachedir/crossfire.0.pst";
166} 168}
167 169
168=head1 AUTHOR 170=head1 AUTHOR
169 171
170 Marc Lehmann <schmorp@schmorp.de> 172 Marc Lehmann <schmorp@schmorp.de>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines