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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines