--- deliantra/server/utils/cfutil.in 2007/04/05 13:50:49 1.22 +++ deliantra/server/utils/cfutil.in 2007/04/13 05:08:51 1.25 @@ -22,7 +22,7 @@ use Coro::AIO; use POSIX (); use Digest::MD5; -use Storable; $Storable::canonical = 1; +use Coro::Storable; $Storable::canonical = 1; sub usage { warn < $T || $h > $T) && $face !~ /_S\./) { # split my @tile; @@ -285,17 +286,27 @@ my $anim = delete $o->{anim}; if ($anim) { + # possibly add $ext to the animation name to avoid + # the need to specify archnames for all parts + # of a multipart archetype. $o->{animation} = "$o->{_name}"; + my $facings = 1; + my @frames; for (@$anim) { - $_ .= $ext unless /^facings\s|^blank.x11$|^empty.x11$/; + if (/^facings\s+(\d+)/) { + $facings = $1*1; + } elsif (/^blank.x11$|^empty.x11$/) { + push @frames, $_; + } else { + push @frames, "$_$ext"; + } } - $ANIM{"$o->{_name}$ext"} = - join "", map "$_\n", - "anim $o->{_name}", - @$anim, - "mina"; + $ANIMINFO{$o->{animation}} = { + facings => $facings, + frames => \@frames, + }; } for my $face ($o->{face} || (), @{$anim || []}) { @@ -308,11 +319,11 @@ } if (my $smooth = delete $o->{smoothface}) { - my ($face, $smooth) = split /\s+/, $smooth; - # skip empty_S.x11, it seems to server no purpose whatsoever - # but increases bandwidth demands and worse. - unless ($smooth eq "empty_S.x11") { - $FACEINFO{$face}{smooth} = $smooth; + my %kv =split /\s+/, $smooth; + my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support + while (my ($face, $smooth) = each %kv) { + $FACEINFO{$face}{smooth} = $smooth; + $FACEINFO{$face}{smoothlevel} = $level; } } } @@ -383,12 +394,6 @@ ); { - open my $fh, ">:utf8", "$DATADIR/animations~" - or die "$DATADIR/animations~: $!"; - print $fh join "", map $ANIM{$_}, sort keys %ANIM - } - - { open my $fh, ">:utf8", "$DATADIR/archetypes~" or die "$DATADIR/archetypes~: $!"; substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; @@ -416,11 +421,14 @@ open my $fh, ">:perlio", "$DATADIR/facedata~" or die "$DATADIR/facedata~: $!"; - $FACEINFO{""} = { version => 1}; - print $fh Storable::nfreeze \%FACEINFO; + print $fh freeze { + version => 2, + faceinfo => \%FACEINFO, + animinfo => \%ANIMINFO, + }; } - for (qw(archetypes facedata animations treasures)) { + for (qw(archetypes facedata treasures)) { chmod 0644, "$DATADIR/$_~"; rename "$DATADIR/$_~", "$DATADIR/$_" or die "$DATADIR/$_: $!";