--- deliantra/server/lib/collect.pl.in 2006/03/15 14:04:57 1.1.1.3 +++ deliantra/server/lib/collect.pl.in 2007/05/27 02:26:20 1.8 @@ -8,7 +8,7 @@ "\nWhere ARCHDIR is the directory where you stored the ". "raw archetypes.\n". "This script will then create these files:\n". - "archetypes,bmaps,bmaps.paths,faces,treasures.bld,animations.\n" + "archetypes,bmaps,bmaps.paths,faces,smooth,treasures.bld,animations.\n" ) } } @@ -32,7 +32,7 @@ $animations = "animations"; $paths = $bmaps."."."paths"; $faceExt = "\\.[a-zA-Z0-9][A-Z0-9][A-Z0-9]"; -$smooths = "smooth"; +$smooth = "smooth"; ### main &info("looking ..."); @@ -86,8 +86,8 @@ &facesOut; close(FACES); - &info("$smooths"); - open(SMOOTHS,">".$smooths) || &die("cannot open ".$smooths); + &info("$smooth"); + open(SMOOTHS,">".$smooth) || &die("cannot open ".$smooth); &smoothOut; close(SMOOTHS); @@ -172,14 +172,14 @@ local($lface,@values) = @_; if ($values[0] ne "") { -# blank.111 is a special case - +# blank.x11 is a special case - # since no foreground pixels will actually be drawn, foreground colors is -# not relevant. Several monsters use blank.111 as part of their +# not relevant. Several monsters use blank.x11 as part of their # animation to make them appear invisible, but have some other # foreground color set. # Same applies to empty also. - if ($fg{$lface} && $fg{$lface} ne $values[0] && $lface ne "blank.111" - && $lface ne "empty.111") { + if ($fg{$lface} && $fg{$lface} ne $values[0] && $lface ne "blank.x11" + && $lface ne "empty.x11") { &warn($arch." duplicate fg color ".$fg{$lface}."/".$values[0]." face ".$lface); } else { $fg{$lface} = $values[0]; @@ -192,8 +192,8 @@ $bg{$lface} = $values[1]; } } - if ($values[2] ne "" && $lface ne "blank.111" && $lface ne "empty.111") { -# blank.111 is a special case - see above explanation + if ($values[2] ne "" && $lface ne "blank.x11" && $lface ne "empty.x11") { +# blank.x11 is a special case - see above explanation # Its visibility is always 0. if ($visibility{$lface} && $visibility{$lface} ne $values[2]) { &warn($arch." duplicate visibilty ".$visibility{$lface}."/".$values[2]." face ".$lface); @@ -201,7 +201,7 @@ $visibility{$lface} = $values[2]; } } - if ($values[3] ne "" && lface ne "blank.111" && $lface ne "empty.111") { + if ($values[3] ne "" && lface ne "blank.x11" && $lface ne "empty.x11") { if ($magicmap{$lface} && $magicmap{$lface} ne $values[3]) { &warn($arch." duplicate magicmap color ".$magicmap{$lface}."/".$values[3]." face ".$lface); } else { @@ -233,13 +233,13 @@ open(ARC,$arch) || &die("cannot open ".$arch); line: while() { chop; - ($var,@values) = split; - if ($var eq "#") { - #developper comment, switch to next line + if (/^\s*(?:#.*|)$/) { + # comment, skip line $commentNum++; next line; - } - if ($var eq "Object") { + } + ($var, @values) = split; + if ($var =~ /^[Oo]bject$/) { $lface[0] = ""; $#lface = 0; $lfg = ""; @@ -250,8 +250,7 @@ $walkon = 0; $nopick = 0; $arch = join "_", @values; - } - if ($var eq "end") { + } elsif ($var eq "end") { if ($#lface !=0) { $#lface--; foreach $face (@lface) { @@ -261,28 +260,21 @@ if ($walkon && !$nopick) { &warn("File $arch has an object with walk_on set which can be picked up\n"); } - } + print ARCH "editor_folder $pathto\n" if $pathto ne ""; # Process the color/face info now - if ($var eq "color_fg") { + } elsif ($var eq "color_fg") { $lfg = $values[0]; next line; - } - if ($var eq "color_bg") { + } elsif ($var eq "color_bg") { $lbg = $values[0]; next line; - } - if ($var eq "end") { - print ARCH "editor_folder $pathto\n" if $pathto ne ""; - } - if ($var eq "visibility") { + } elsif ($var eq "visibility") { $lvis = $values[0]; next line; - } - if ($var eq "magicmap") { + } elsif ($var eq "magicmap") { $mm = $values[0]; next line; - } - if ($var eq "attacktype") { + } elsif ($var eq "attacktype") { $at = 0; foreach $t ( @values ) { if ( $t =~ /^\d+$/ ) { @@ -296,21 +288,19 @@ } } $_ = $var . ' ' . $at; - } - if ($var eq "is_floor") { + } elsif ($var eq "is_floor") { $floor = $values[0]; # is_floor is also needed for archs, so let it pass # through - } - elsif ($var eq "no_pick") { + } elsif ($var eq "no_pick") { $nopick = $values[0]; } elsif ($var eq "walk_on") { $walkon = $values[0]; - } - elsif ($var eq "face") { + } elsif ($var eq "face" && ! $faces{$values[0]}) { + &warn($arch." is missing face ".$values[0]) + } elsif ($var eq "face") { $lface[$#lface++] = $values[0] - } - elsif ($var eq "anim") { + } elsif ($var eq "anim") { if ($anim{$arch}) { &warn("$arch is a duplicate animation name"); $anim{$arch}=""; @@ -330,11 +320,7 @@ } print ARCH "animation $arch\n"; next line; # don't want the mina - } - if ($var eq "face" && ! $faces{$values[0]}) { - &warn($arch." is missing face ".$values[0]) - } - if ($var eq "smoothface") { + } elsif ($var eq "smoothface") { if ($smoothing{$values[0]} && ($smoothing{$values[0]} ne $values[1])) { &warn($arch." duplicate smoothface for ".$values[0].": ".$smoothing{$values[0]}." and ".$values[1]); } elsif ( ($values[0] eq "") || ($values[1] eq "")) { @@ -367,18 +353,18 @@ sub bmapsOut { &pheader; $idx = 0; - &pline("bug.111"); + &pline("bug.x11"); foreach $face (sort(keys %faces)) { - &pline($face) if $face !~ /bug\.111/; + &pline($face) if $face !~ /bug\.x11/; } } sub pathsOut { &pheader; $idx = 0; - &opline($root."/system/bug.111"); + &opline($root."/system/bug.x11"); foreach $face (sort(keys %faces)) { - &opline($faces{$face}) if $faces{$face} !~ /bug\.111/; + &opline($faces{$face}) if $faces{$face} !~ /bug\.x11/; } } @@ -481,7 +467,7 @@ local ($sm); print SMOOTHS "##########################################################\n"; print SMOOTHS "# Do not touch this file. #\n"; - print SMOOTHS "# It has been generated from the informations present #\n"; + print SMOOTHS "# It has been generated from the information present #\n"; print SMOOTHS "# in the archetype files. #\n"; print SMOOTHS "# To add new entries, simply add #\n"; print SMOOTHS "# smoothface xxx yyy #\n";