#! perl # mandatory depends=map-world # renders the original "classic" world, using an # archetype and region "picture" and overlays # generated mostly from the crossfire world map. our $TILE_W = $ext::map_world::TILE_W; our $TILE_H = $ext::map_world::TILE_H; our $GRID_W = 30; our $GRID_H = 30; ext::map_world::register __PACKAGE__, 100, 100, 0, 129, 129, 0, pri => 0, ; our $ARCH; our $REGN; sub reload() { cf::trace "loading classic worldmap.\n"; $ARCH = cf::decode_storable cf::unlzf cf::load_file "$DATADIR/worldmap-classic.arch"; $REGN = cf::decode_storable cf::unlzf cf::load_file "$DATADIR/worldmap-classic.regn"; cf::trace "loaded classic worldmap.\n"; } { my $guard = cf::lock_acquire "ext::map_world_classic"; cf::post_init { cf::async_ext { $Coro::current->{desc} = "classic worldmap loader"; reload; undef $guard; }; }; } sub post_load { my ($self) = @_; my $guard = cf::lock_acquire "ext::map_world_classic"; my $stride = $GRID_W * $TILE_W; my $top = $self->{oy} * $TILE_H * $stride + $self->{ox} * $TILE_W; $self->add_underlay ($ARCH->{tbl}, $top, $stride, $ARCH->{plt}); $self->set_regiondata ($REGN->{tbl}, $top, $stride, $REGN->{plt}); $self->SUPER::post_load; }