ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.85 by root, Fri May 14 22:56:47 2010 UTC vs.
Revision 1.89 by root, Tue Oct 5 23:26:56 2010 UTC

156 and die "map installation failed.\n"; 156 and die "map installation failed.\n";
157 157
158 print "maps installed successfully.\n"; 158 print "maps installed successfully.\n";
159} 159}
160 160
161sub autoglyph {
162 my ($stem, $face) = @_;
163
164 if ($stem =~ /^wall\/|Nimwall/) {
165# warn $stem;
166 "+"
167 } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) {
168 "."
169 } elsif ($stem =~ /^player\//) {
170 "\@"
171 } else {
172 substr $stem, 0, 1
173 }
174}
175
161{ 176{
162 our %ANIMINFO; 177 our %ANIMINFO;
163 our %FACEINFO; 178 our %FACEINFO;
164 our %RESOURCE; 179 our %RESOURCE;
165 our @ARC; 180 our @ARC;
174 our $c_trs = new Coro::Channel; 189 our $c_trs = new Coro::Channel;
175 our $c_res = new Coro::Channel; 190 our $c_res = new Coro::Channel;
176 191
177 our @c_png; 192 our @c_png;
178 193
179 sub commit_png($$$) { 194 sub commit_png($$$$) {
180 my ($name, $data, $T) = @_; 195 my ($stem, $name, $data, $T) = @_;
181 196
197 $FACEINFO{$name}{"stem"} = substr $stem, 1 + length $PATH;
182 $FACEINFO{$name}{"data$T"} = $data; 198 $FACEINFO{$name}{"data$T"} = $data;
183 } 199 }
184 200
185 sub process_png { 201 sub process_png {
186 while (@c_png) { 202 while (@c_png) {
404 420
405 if (0 > aio_load $file, $tile) { 421 if (0 > aio_load $file, $tile) {
406 die "$path: unable to read tile +$x+$y, aborting.\n"; 422 die "$path: unable to read tile +$x+$y, aborting.\n";
407 } 423 }
408 IO::AIO::aio_unlink $file unless $CACHE; 424 IO::AIO::aio_unlink $file unless $CACHE;
409 commit_png $x|$y ? "$face+$x+$y" : $face, $tile, $T; 425 commit_png $stem, $x|$y ? "$face+$x+$y" : $face, $tile, $T;
410 } 426 }
411 } else { 427 } else {
412 # use as-is (either small, use smooth) 428 # use as-is (either small, use smooth)
413 commit_png $face, $png, $T; 429 commit_png $stem, $face, $png, $T;
414 } 430 }
415 431
416 aio_unlink $path if $delete; 432 aio_unlink $path if $delete;
417 } 433 }
418 } 434 }
433 449
434 $o->{editor_folder} ||= "\x00$dir"; # horrible kludge 450 $o->{editor_folder} ||= "\x00$dir"; # horrible kludge
435 451
436 my $visibility = delete $o->{visibility}; 452 my $visibility = delete $o->{visibility};
437 my $magicmap = delete $o->{magicmap}; 453 my $magicmap = delete $o->{magicmap};
454 my $glyph = delete $o->{glyph};
438 455
439 # find upper left corner :/ 456 # find upper left corner :/
440 # omg, this is sooo broken 457 # omg, this is sooo broken
441 my ($dx, $dy); 458 my ($dx, $dy);
442 for (my $o = $o; $o; $o = $o->{more}) { 459 for (my $o = $o; $o; $o = $o->{more}) {
452 469
453 $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face}; 470 $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face};
454 471
455 $visibility = delete $o->{visibility} if exists $o->{visibility}; 472 $visibility = delete $o->{visibility} if exists $o->{visibility};
456 $magicmap = delete $o->{magicmap} if exists $o->{magicmap}; 473 $magicmap = delete $o->{magicmap} if exists $o->{magicmap};
474 $glyph = delete $o->{glyph} if exists $o->{glyph};
457 475
458 my $anim = delete $o->{anim}; 476 my $anim = delete $o->{anim};
459 477
460 if ($anim) { 478 if ($anim) {
461 # possibly add $ext to the animation name to avoid 479 # possibly add $ext to the animation name to avoid
492 510
493 next if $face =~ /^blank.x11$|^empty.x11$/; 511 next if $face =~ /^blank.x11$|^empty.x11$/;
494 512
495 $info->{visibility} = $visibility if defined $visibility; 513 $info->{visibility} = $visibility if defined $visibility;
496 $info->{magicmap} = $magicmap if defined $magicmap; 514 $info->{magicmap} = $magicmap if defined $magicmap;
515 $info->{glyph} = $glyph if defined $glyph;
497 } 516 }
498 517
499 if (my $smooth = delete $o->{smoothface}) { 518 if (my $smooth = delete $o->{smoothface}) {
500 my %kv = split /\s+/, $smooth; 519 my %kv = split /\s+/, $smooth;
501 my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support 520 my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support
796 make_hash $k, $v->{data64}, $v->{hash64}; 815 make_hash $k, $v->{data64}, $v->{hash64};
797 816
798 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; 817 #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n";
799 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; 818 #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n";
800 819
820 my $stem = delete $v->{stem};
821 $v->{glyph} //= autoglyph $stem, $v;
822
801 if (my $magicmap = $v->{magicmap}) { 823 if (my $magicmap = $v->{magicmap}) {
802 $magicmap =~ y/A-Z_\-/a-z/d; 824 $magicmap =~ y/A-Z_\-/a-z/d;
803 $v->{magicmap} = $COLOR{$magicmap}; 825 $v->{magicmap} = $COLOR{$magicmap};
804 } 826 }
805 827

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines