23 package com.realtime.crossfire.jxclient.gui.map;
30 import java.awt.Graphics;
31 import java.util.Arrays;
32 import java.util.concurrent.atomic.AtomicBoolean;
33 import javax.swing.ImageIcon;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
87 private static final int @NotNull []
DX = {1, 2, 2, 2, 1, 0, 0, 0,};
92 private static final int @NotNull []
DY = {0, 0, 1, 2, 2, 2, 1, 0,};
145 private final boolean @NotNull []
done =
new boolean[8];
176 public void paintSmooth(@NotNull
final Graphics graphics,
final int x,
final int y,
final int px,
final int py,
final int layer, @NotNull
final CfMap map,
final int tileSize) {
177 for (
int deltaX = 0; deltaX <= 2; deltaX++) {
178 for (
int deltaY = 0; deltaY <= 2; deltaY++) {
179 if (deltaX != 1 || deltaY != 1) {
180 final CfMapSquare mapSquare = map.getMapSquare(x+deltaX-1, y+deltaY-1);
187 final int level = map.
getSmooth(x, y, layer);
189 for (
int i = 0; i < 8; i++) {
196 final int smoothlevel = node.
getSmooth(layer);
197 if (smoothlevel <= level) {
211 Arrays.fill(
done,
false);
214 for (
int i = 0; i < 8; i++) {
224 final int currentSmoothFace =
smoothFace[lowest];
230 for (
int i = 0; i < 8; i++) {
239 if (currentSmoothFace == 0) {
245 map.squarePendingFace(x, y, currentSmoothFace);
248 drawImage(graphics, px, py, tileSize*weight, 0, imageIcon, tileSize);
251 drawImage(graphics, px, py, tileSize*weightC, tileSize, imageIcon, tileSize);
268 private static void drawImage(@NotNull
final Graphics graphics,
final int dstX,
final int dstY,
final int srcX,
final int srcY, @NotNull
final ImageIcon imageIcon,
final int tileSize) {
269 graphics.drawImage(imageIcon.getImage(), dstX, dstY, dstX+tileSize, dstY+tileSize, srcX, srcY, srcX+tileSize, srcY+tileSize,
null);