Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Maps for 0.89.3
Hi,
I grabbed crossfire-0.89.2.tar.Z, crossfire-0.89.maps.tar.Z and
incoming/crossedit-0.5.tar.Z from ftp.ifi.uoi.no:crossfire/
crossedit-0.5 seems to contain crossfire version 0.89.3, but without
images and maps. It supplies a mapconv-script which converts the maps
for 0.89.0 partly to the format required by the new versions, but in
the new version, a new field 'connected', for which previously the 'sp'
field was used. To fix this, I wrote the following perl-script.
Maybe you find this useful.
Anyway, thanks for crossfire!
-Till
---Cut here 8<----------------------------------
#!/usr/local/bin/perl -i.bak
# fixconnections: in crossfire 0.89.3, which comes with crossedit 0.5,
# connections between buttons and gates etc. do no longer
# use the sp field but have an extra 'connected' field
# exits, trapdoors and teleporters still
# use the sp field for the y position. holes do need both.
# In some maps, where sp was 0, sp was completely omitted.
# Some other stuff uses sp, too.
# To get maps for 0.89.3 from the maps for 0.89.0, cd to maps,
# first run the mapconv-skript supplied with crossedit 0.5,
# then rm *.oo *.om, then run this skript
# fixconnections *, then rm *.bak
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;
# process any FOO=bar switches
open(AT,"../archetypes") || die "aargh";
while (<AT>) {
($Fld1,$Fld2) = split(' ', $_, 9999);
if (/^Object /) {
$obj = $Fld2;
$xy = 0;
$conn = 0;
}
if (/^type 66$/) {
$xy = 1;
}
if (/^type 41$/) {
$xy = 1;
}
if (/^type 9[45]$/) {
$xy = 1;
}
if (/^type 9[1-4]$/) {
$conn = 1;
}
if (/^type 1[78]$/) {
$conn = 1;
}
if (/^type 2[679]$/) {
$conn = 1;
}
if (/^type 3[012]$/) {
$conn = 1;
}
if (/^type 62$/) {
$conn = 1;
}
if (/^type 112$/) {
$conn = 1;
}
if (/^end$/) {
$x{$obj}=1 if $xy;
$c{$obj}=1 if $conn;
}
}
close(AT);
$x{'map'}=1;
while(<>)
{
($Fld1,$Fld2) = split(' ', $_, 9999);
if (/^arch /) {
$arch=$Fld2;
$spseen=0;
}
if (/^sp /) {
if(defined($x{$arch}))
{
printf("%s", $_);
$spseen=1;
}
if(defined($c{$arch}))
{
printf("connected %s\n", $Fld2);
$spseen=1;
}
if($spseen==0)
{
printf("%s", $_);
}
}
else
{
if (/^end$/) {
if($spseen==0 && (defined($x{$arch}) || defined($c{$arch})))
{
printf("sp 0\n") if(defined($x{$arch})) ;
printf("connected 0\n") if(defined($c{$arch})) ;
}
}
printf("%s", $_);
}
}