| 1 |
#! perl # mandatory depends=map-world |
| 2 |
|
| 3 |
# renders the original "classic" world, using an |
| 4 |
# archetype and region "picture" and overlays |
| 5 |
# generated mostly from the crossfire world map. |
| 6 |
|
| 7 |
our $TILE_W = $ext::map_world::TILE_W; |
| 8 |
our $TILE_H = $ext::map_world::TILE_H; |
| 9 |
|
| 10 |
our $GRID_W = 30; |
| 11 |
our $GRID_H = 30; |
| 12 |
|
| 13 |
ext::map_world::register __PACKAGE__, |
| 14 |
100, 100, 0, |
| 15 |
129, 129, 0, |
| 16 |
pri => 0, |
| 17 |
; |
| 18 |
|
| 19 |
our $ARCH; |
| 20 |
our $REGN; |
| 21 |
|
| 22 |
sub reload() { |
| 23 |
cf::trace "loading classic worldmap.\n"; |
| 24 |
$ARCH = cf::decode_storable cf::unlzf cf::load_file "$DATADIR/worldmap-classic.arch"; |
| 25 |
$REGN = cf::decode_storable cf::unlzf cf::load_file "$DATADIR/worldmap-classic.regn"; |
| 26 |
cf::trace "loaded classic worldmap.\n"; |
| 27 |
} |
| 28 |
|
| 29 |
{ |
| 30 |
my $guard = cf::lock_acquire "ext::map_world_classic"; |
| 31 |
|
| 32 |
cf::post_init { |
| 33 |
cf::async_ext { |
| 34 |
$Coro::current->{desc} = "classic worldmap loader"; |
| 35 |
reload; |
| 36 |
undef $guard; |
| 37 |
}; |
| 38 |
}; |
| 39 |
} |
| 40 |
|
| 41 |
sub post_load { |
| 42 |
my ($self) = @_; |
| 43 |
|
| 44 |
my $guard = cf::lock_acquire "ext::map_world_classic"; |
| 45 |
|
| 46 |
my $stride = $GRID_W * $TILE_W; |
| 47 |
my $top = $self->{oy} * $TILE_H * $stride |
| 48 |
+ $self->{ox} * $TILE_W; |
| 49 |
|
| 50 |
$self->add_underlay ($ARCH->{tbl}, $top, $stride, $ARCH->{plt}); |
| 51 |
$self->set_regiondata ($REGN->{tbl}, $top, $stride, $REGN->{plt}); |
| 52 |
|
| 53 |
$self->SUPER::post_load; |
| 54 |
} |
| 55 |
|