1 | #!@PERL@ |
1 | #!@PERL@ |
2 | |
2 | |
3 | # |
3 | # |
4 | # This file is part of Deliantra, the Roguelike Realtime MMORPG. |
4 | # This file is part of Deliantra, the Roguelike Realtime MMORPG. |
5 | # |
5 | # |
6 | # Copyright (©) 2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
6 | # Copyright (©) 2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
7 | # |
7 | # |
8 | # Deliantra is free software: you can redistribute it and/or modify it under |
8 | # Deliantra is free software: you can redistribute it and/or modify it under |
9 | # the terms of the Affero GNU General Public License as published by the |
9 | # the terms of the Affero GNU General Public License as published by the |
10 | # Free Software Foundation, either version 3 of the License, or (at your |
10 | # Free Software Foundation, either version 3 of the License, or (at your |
11 | # option) any later version. |
11 | # option) any later version. |
… | |
… | |
437 | return; |
437 | return; |
438 | } |
438 | } |
439 | |
439 | |
440 | for (split /\n/, $data) { |
440 | for (split /\n/, $data) { |
441 | chomp; |
441 | chomp; |
442 | my ($face, $visibility, $fg, $bg, $glyph) = split /\s+/; |
442 | my ($face, $visibility, $fg, $bg, $glyph) = split /\s+/, $_, 5; |
443 | # bg not used except for text clients |
443 | # bg not used except for text clients |
444 | |
444 | |
445 | utf8::decode $glyph; |
445 | utf8::decode $glyph; |
446 | $glyph =~ s/^\?(?=.)//; # remove "autoglyph" flag |
446 | $glyph =~ s/^\?(?=.)//; # remove "autoglyph" flag |
|
|
447 | $glyph =~ s/^"(.+)"$/$1/; # allow for ""-style quoting |
447 | |
448 | |
448 | $fg = "white" if $fg eq "none"; # lots of faces have no fg colour yet |
449 | $fg = "white" if $fg eq "none"; # lots of faces have no fg colour yet |
449 | |
450 | |
450 | (my $fgi = $COLOR{$fg}) |
451 | (my $fgi = $COLOR{$fg}) |
451 | // warn "WARNING: $path: $face specifies unknown foreground colour '$fg'.\n"; |
452 | // warn "WARNING: $path: $face specifies unknown foreground colour '$fg'.\n"; |
… | |
… | |
455 | my $fi = $FACEINFO{$face} ||= { }; |
456 | my $fi = $FACEINFO{$face} ||= { }; |
456 | $fi->{visibility} = $visibility * 1; |
457 | $fi->{visibility} = $visibility * 1; |
457 | $fi->{magicmap} = $fgi; # foreground colour becomes magicmap |
458 | $fi->{magicmap} = $fgi; # foreground colour becomes magicmap |
458 | |
459 | |
459 | $glyph .= " " if 2 > length $glyph; # TODO kanji |
460 | $glyph .= " " if 2 > length $glyph; # TODO kanji |
|
|
461 | die "glyph $face too long" if 2 < length $glyph; |
460 | |
462 | |
461 | $fi->{glyph} = ""; |
463 | $fi->{glyph} = ""; |
462 | for (split //, $glyph, -1) { |
464 | for (split //, $glyph) { |
463 | utf8::encode $_; |
465 | utf8::encode $_; |
464 | $fi->{glyph} .= (chr $fgi) . (chr $bgi) . $_; |
466 | $fi->{glyph} .= (chr $fgi) . (chr $bgi) . $_; |
465 | } |
467 | } |
466 | } |
468 | } |
467 | } |
469 | } |