Aktuelle Version |
Dein Text |
Zeile 99: |
Zeile 99: |
| print STDERR "NPC $npcname auf $x/$y nicht gefunden\n" unless ($npcname eq "" or $npcname eq "none"); | | print STDERR "NPC $npcname auf $x/$y nicht gefunden\n" unless ($npcname eq "" or $npcname eq "none"); |
| } else { | | } else { |
| if (defined($mapcolor{$x}->{$y}->[0])) { | | $mapcolor{$x}->{$y} = npcclass($npc{$tmpname}); |
| if (npcclass($npc{$tmpname}) > $mapcolor{$x}->{$y}->[0]) {
| | } |
| $mapcolor{$x}->{$y}->[1] = npcclass($npc{$tmpname});
| |
| } elsif (npcclass($npc{$tmpname}) != $mapcolor{$x}->{$y}->[0]) {
| |
| $mapcolor{$x}->{$y}->[1] = $mapcolor{$x}->{$y}->[0];
| |
| $mapcolor{$x}->{$y}->[0] = npcclass($npc{$tmpname});
| |
| }
| |
| } else {
| |
| $mapcolor{$x}->{$y}->[0] = npcclass($npc{$tmpname});
| |
| }
| |
| }
| |
| } | | } |
|
| |
|
Zeile 134: |
Zeile 125: |
| my $ax = ($x - $bounds[0]) * $width + ($width - $tilesize) / 2; | | my $ax = ($x - $bounds[0]) * $width + ($width - $tilesize) / 2; |
| my $ay = ($y - $bounds[1]) * $width + ($width - $tilesize) / 2; | | my $ay = ($y - $bounds[1]) * $width + ($width - $tilesize) / 2; |
| $map->filledRectangle($ax, $ay, $ax + $tilesize - 1, $ay + $tilesize - 1, $colors->{$mapcolor{$x}->{$y}->[0]}); | | $map->filledRectangle($ax, $ay, $ax + $tilesize - 1, $ay + $tilesize - 1, $colors->{$mapcolor{$x}->{$y}}); |
| if (defined($mapcolor{$x}->{$y}->[1])) {
| |
| my $poly = new GD::Polygon();
| |
| $poly->addPt($ax + $tilesize - 1, $ay);
| |
| $poly->addPt($ax + $tilesize - 1, $ay + $tilesize - 1);
| |
| $poly->addPt($ax, $ay + $tilesize - 1);
| |
| $map->filledPolygon($poly, $colors->{$mapcolor{$x}->{$y}->[1]});
| |
| # Gleichheit der Farben! ;-)
| |
| # Der "Fairness" halber wird die Mittellinie mit der Mischfarbe gezeichnet.
| |
| # Naja, eigentlich sieht's einfach besser aus.
| |
| my @rgb1 = $map->rgb($colors->{$mapcolor{$x}->{$y}->[0]});
| |
| my @rgb2 = $map->rgb($colors->{$mapcolor{$x}->{$y}->[1]});
| |
| my $intermediate = $map->colorExact(($rgb1[0] + $rgb2[0]) / 2, ($rgb1[1] + $rgb2[1]) / 2, ($rgb1[2] + $rgb2[2]) / 2);
| |
| $intermediate = $map->colorAllocate(($rgb1[0] + $rgb2[0]) / 2, ($rgb1[1] + $rgb2[1]) / 2, ($rgb1[2] + $rgb2[2]) / 2) if ($intermediate == -1);
| |
| $map->line($ax + $tilesize - 1, $ay, $ax, $ay + $tilesize - 1, $intermediate);
| |
| }
| |
| } | | } |
| } | | } |
Zeile 172: |
Zeile 148: |
| } | | } |
| </nowiki></pre> | | </nowiki></pre> |
|
| |
| {| cellspacing="8" cellpadding="0" style="width:100%; clear:both; margin:0.5em auto; background-color:#f7f8ff; border:2px solid #8888aa;"
| |
| | http://upload.wikimedia.org/wikipedia/commons/thumb/6/62/PD-icon.svg/64px-PD-icon.svg.png
| |
| | Diese Artikel wurde von ihrem Urheberrechtsinhaber in die Gemeinfreiheit („public domain“) übergeben. Dies gilt weltweit und zeitlich unbeschränkt.
| |
| <small>Für den Fall, dass dies nach lokaler Rechtslage nicht möglich ist, wie beispielsweise in Deutschland:</small><br />Der Urheberrechtsinhaber hat für diesen Artikel ein unbeschränktes Nutzungsrecht ohne Bedingungen im gesetzlich möglichen Umfang gewährt.
| |
| |}
| |