Crossfire JXClient, Trunk
CfMap.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff
19  * Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20  * Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21  */
22 
23 package com.realtime.crossfire.jxclient.map;
24 
28 import java.util.Collection;
29 import java.util.HashMap;
30 import java.util.HashSet;
31 import java.util.Map;
32 import java.util.Set;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
35 
46 public class CfMap {
47 
51  private int minX;
52 
56  private int maxX = -1;
57 
61  private int minY;
62 
66  private int maxY = -1;
67 
71  private int minPx;
72 
76  private int maxPx = -1;
77 
81  private int minPy;
82 
86  private int maxPy = -1;
87 
92  private int ox;
93 
98  private int oy;
99 
103  private int patchX;
104 
108  private int patchY;
109 
113  @Nullable
114  private CfMapPatch @Nullable [] @NotNull [] patch;
115 
119  @NotNull
120  private final Set<CfMapSquare> dirtyMapSquares = new HashSet<>();
121 
126  @NotNull
127  private final Map<Integer, Collection<CfMapSquare>> pendingFaceSquares = new HashMap<>();
128 
134  public void reset(final int mapWidth, final int mapHeight) {
135  minX = 0;
136  maxX = -1;
137  minY = 0;
138  maxY = -1;
139  minPx = 0;
140  maxPx = -1;
141  minPy = 0;
142  maxPy = -1;
143  patchX = 0;
144  patchY = 0;
145  patch = null;
146  dirtyMapSquares.clear();
147  pendingFaceSquares.clear();
148 
149  // force dirty flags to be set for the visible map region
150  clearSquare(0, 0);
151  clearSquare(mapWidth-1, mapHeight-1);
152  }
153 
160  public void setDarkness(final int x, final int y, final int darkness) {
161  assert Thread.holdsLock(this);
162  if (expandTo(x, y).setDarkness(ox, oy, darkness)) {
163  for (int l = 0; l < Map2.NUM_LAYERS; l++) {
165  }
166  }
167  }
168 
176  public int getDarkness(final int x, final int y) {
177  assert Thread.holdsLock(this);
178  final CfMapPatch mapPatch = getMapPatch(x, y);
179  return mapPatch == null ? CfMapSquare.DEFAULT_DARKNESS : mapPatch.getDarkness(ox, oy);
180  }
181 
189  public void setSmooth(final int x, final int y, final int layer, final int smooth) {
190  final int result = expandTo(x, y).setSmooth(ox, oy, layer, smooth);
191  if ((result&1) != 0) {
192  for (int l = 0; l < Map2.NUM_LAYERS; l++) {
194  }
195  }
196  if ((result&2) != 0) {
197  for (int dx = -1; dx <= +1; dx++) {
198  for (int dy = -1; dy <= +1; dy++) {
199  squareModified(getMapSquare(x+dx, y+dy));
200  }
201  }
202  }
203  }
204 
212  public int getSmooth(final int x, final int y, final int layer) {
213  final CfMapPatch mapPatch = getMapPatch(x, y);
214  return mapPatch == null ? CfMapSquare.DEFAULT_SMOOTH : mapPatch.getSmooth(ox, oy, layer);
215  }
216 
223  public void setMagicMap(final int x0, final int y0, final byte @NotNull [] @NotNull [] data) {
224  assert Thread.holdsLock(this);
225  for (int y = 0; y < data.length; y++) {
226  for (int x = 0; x < data[y].length; x++) {
227  final int color = data[y][x]&MagicMap.FACE_COLOR_MASK;
228  expandTo(x0+x, y0+y).setColor(ox, oy, color);
229  }
230  }
231  }
232 
239  public int getColor(final int x, final int y) {
240  assert Thread.holdsLock(this);
241  final CfMapPatch mapPatch = getMapPatch(x, y);
242  return mapPatch == null ? CfMapSquare.DEFAULT_COLOR : mapPatch.getColor(ox, oy);
243  }
244 
253  public void setFace(final int x, final int y, final int layer, @Nullable final Face face) {
254  assert Thread.holdsLock(this);
255  if (expandTo(x, y).resetFogOfWar(ox, oy)) {
257  for (int l = 0; l < Map2.NUM_LAYERS; l++) {
258  setFaceInternal(x, y, l, l == layer ? face : CfMapSquare.DEFAULT_FACE);
259  }
260  dirty(x, y);
261  } else {
262  setFaceInternal(x, y, layer, face);
263  }
264  }
265 
273  private void setFaceInternal(final int x, final int y, final int layer, @Nullable final Face face) {
274  final CfMapSquare headMapSquare = expandTo(x, y).getSquare(ox, oy);
275 
276  final Face oldFace = headMapSquare.getFace(layer);
277  if (oldFace != null) {
278  expandFace(x, y, layer, oldFace, headMapSquare, null);
279  }
280  headMapSquare.setFace(layer, face);
281  if (face != null) {
282  expandFace(x, y, layer, face, headMapSquare, headMapSquare);
283  }
284  }
285 
296  private void expandFace(final int x, final int y, final int layer, @NotNull final Face face, @NotNull final CfMapSquare oldMapSquare, @Nullable final CfMapSquare newMapSquare) {
297  final int sx = face.getTileWidth();
298  final int sy = face.getTileHeight();
299  for (int dx = 0; dx < sx; dx++) {
300  for (int dy = 0; dy < sy; dy++) {
301  if (dx > 0 || dy > 0) {
302  if (newMapSquare != null) {
303  setHeadMapSquare(x-dx, y-dy, layer, newMapSquare, true);
304  } else if (getHeadMapSquare(x-dx, y-dy, layer) == oldMapSquare) {
305  setHeadMapSquare(x-dx, y-dy, layer, null, true);
306  }
307  }
308  }
309  }
310  }
311 
320  private void dirtyFace(final int x, final int y, final int layer, @NotNull final Face face) {
321  final int sx = face.getTileWidth();
322  final int sy = face.getTileHeight();
323  for (int dx = 0; dx < sx; dx++) {
324  for (int dy = 0; dy < sy; dy++) {
325  if (dx > 0 || dy > 0) {
326  if (isFogOfWar(x-dx, y-dy)) {
327  dirty(x-dx, y-dy);
328  } else {
329  setHeadMapSquare(x-dx, y-dy, layer, null, false);
330  }
331  }
332  }
333  }
334  }
335 
343  @Nullable
344  public Face getFace(final int x, final int y, final int layer) {
345  assert Thread.holdsLock(this);
346  final CfMapPatch mapPatch = getMapPatch(x, y);
347  return mapPatch == null ? CfMapSquare.DEFAULT_FACE : mapPatch.getFace(ox, oy, layer);
348  }
349 
361  private void setHeadMapSquare(final int x, final int y, final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways) {
362  expandTo(x, y).setHeadMapSquare(ox, oy, layer, mapSquare, setAlways);
363  }
364 
373  @Nullable
374  public CfMapSquare getHeadMapSquare(final int x, final int y, final int layer) {
375  assert Thread.holdsLock(this);
376  final CfMapPatch mapPatch = getMapPatch(x, y);
377  return mapPatch == null ? null : mapPatch.getHeadMapSquare(ox, oy, layer);
378  }
379 
386  public void clearSquare(final int x, final int y) {
387  assert Thread.holdsLock(this);
388  final CfMapPatch mapPatch = expandTo(x, y);
389  mapPatch.clearSquare(ox, oy);
390  for (int layer = 0; layer < Map2.NUM_LAYERS; layer++) {
391  final Face face = mapPatch.getFace(ox, oy, layer);
392  if (face != null) {
393  dirtyFace(x, y, layer, face);
394  }
395  }
396  }
397 
403  public void dirty(final int x, final int y) {
404  assert Thread.holdsLock(this);
405  expandTo(x, y).dirty(ox, oy);
406  }
407 
414  public boolean isFogOfWar(final int x, final int y) {
415  assert Thread.holdsLock(this);
416  final CfMapPatch mapPatch = getMapPatch(x, y);
417  return mapPatch != null && mapPatch.isFogOfWar(ox, oy);
418  }
419 
428  @Nullable
429  private CfMapPatch getMapPatch(final int x, final int y) {
430  if (x < minX || x > maxX || y < minY || y > maxY) {
431  return null;
432  }
433 
434  final int px = ((x-patchX)>>CfMapPatch.SIZE_LOG)-minPx;
435  final int py = ((y-patchY)>>CfMapPatch.SIZE_LOG)-minPy;
436  assert px >= 0;
437  assert py >= 0;
438  assert px <= maxPx-minPx;
439  assert py <= maxPy-minPy;
440  ox = (x-patchX)&(CfMapPatch.SIZE-1);
441  oy = (y-patchY)&(CfMapPatch.SIZE-1);
442  assert ox >= 0;
443  assert oy >= 0;
444  assert ox < CfMapPatch.SIZE;
445  assert oy < CfMapPatch.SIZE;
446 
447  assert patch != null;
448  assert patch[px] != null;
449  final CfMapPatch mapPatch = patch[px][py];
450  if (mapPatch != null) {
451  return mapPatch;
452  }
453 
454  patch[px][py] = new CfMapPatch(this, x-patchX-ox, y-patchY-oy);
455  assert patch != null;
456  assert patch[px] != null;
457  return patch[px][py];
458  }
459 
465  private void scroll(final int dx, final int dy) {
466  assert Thread.holdsLock(this);
467  if (dx == 0 && dy == 0) {
468  return;
469  }
470 
471  minX += dx;
472  maxX += dx;
473  minY += dy;
474  maxY += dy;
475  patchX += dx;
476  patchY += dy;
477  }
478 
486  @NotNull
487  private CfMapPatch expandTo(final int x, final int y) {
488  if (minX > maxX || minY > maxY) {
489  // current map is undefined ==> start with 1x1 map
490  minX = x;
491  maxX = x;
492  minY = y;
493  maxY = y;
495  maxPx = minPx;
497  maxPy = minPy;
498  patch = new CfMapPatch[1][1];
499  //noinspection AssignmentToNull
500  patch[0][0] = null;
501  } else {
502  if (x < minX) {
503  increase(x-minX, 0);
504  }
505  if (x > maxX) {
506  increase(x-maxX, 0);
507  }
508  if (y < minY) {
509  increase(0, y-minY);
510  }
511  if (y > maxY) {
512  increase(0, y-maxY);
513  }
514  }
515 
516  final CfMapPatch result = getMapPatch(x, y);
517  assert result != null;
518  return result;
519  }
520 
528  private void increase(final int dx, final int dy) {
529  if (dx < 0) {
530  final int newMinX = minX+dx;
531  final int newMinPx = (newMinX-patchX)>>CfMapPatch.SIZE_LOG;
532  final int diffPw = minPx-newMinPx;
533  if (diffPw == 0) {
534  // new size fits within current patch ==> no change to
535  // <code>patch</code>
536  minX = newMinX;
537  } else {
538  // need to add (diffPw) patches to the left
539 
540  assert diffPw > 0;
541 
542  final int newPw = size(newMinPx, maxPx);
543  final int newPh = size(minPy, maxPy);
544  assert patch != null;
545  final int oldPw = patch.length;
546  final int oldPh = patch[0].length;
547 
548  // new width must be more than old size
549  assert newPw > oldPw;
550  assert newPw == oldPw+diffPw;
551  assert newPh == oldPh;
552 
553  minX = newMinX;
554  minPx = newMinPx;
555  patch = copyPatches(newPw, newPh, diffPw, 0, oldPw, oldPh);
556  }
557  } else if (dx > 0) {
558  final int newMaxX = maxX+dx;
559  final int newMaxPx = (newMaxX-patchX)>>CfMapPatch.SIZE_LOG;
560  final int diffPw = newMaxPx-maxPx;
561  if (diffPw == 0) {
562  // new size fits within current patch ==> no change to
563  // <code>patch</code>
564  maxX = newMaxX;
565  } else {
566  // need to add (diffPw) patches to the right
567 
568  assert diffPw > 0;
569 
570  final int newPw = size(minPx, newMaxPx);
571  final int newPh = size(minPy, maxPy);
572  assert patch != null;
573  final int oldPw = patch.length;
574  final int oldPh = patch[0].length;
575 
576  // new width must be more than old size
577  assert newPw > oldPw;
578  assert newPw == oldPw+diffPw;
579  assert newPh == oldPh;
580 
581  maxX = newMaxX;
582  maxPx = newMaxPx;
583  patch = copyPatches(newPw, newPh, 0, 0, oldPw, oldPh);
584  }
585  }
586 
587  if (dy < 0) {
588  final int newMinY = minY+dy;
589  final int newMinPy = (newMinY-patchY)>>CfMapPatch.SIZE_LOG;
590  final int diffPh = minPy-newMinPy;
591  if (diffPh == 0) {
592  // new size fits within current patch ==> no change to
593  // <code>patch</code>
594  minY = newMinY;
595  } else {
596  // need to add (diffPh) patches to the top
597 
598  assert diffPh > 0;
599 
600  final int newPw = size(minPx, maxPx);
601  final int newPh = size(newMinPy, maxPy);
602  assert patch != null;
603  final int oldPw = patch.length;
604  final int oldPh = patch[0].length;
605 
606  // new height must be more than old size
607  assert newPh > oldPh;
608  assert newPh == oldPh+diffPh;
609  assert newPw == oldPw;
610 
611  minY = newMinY;
612  minPy = newMinPy;
613  patch = copyPatches(newPw, newPh, 0, diffPh, oldPw, oldPh);
614  }
615  } else if (dy > 0) {
616  final int newMaxY = maxY+dy;
617  final int newMaxPy = (newMaxY-patchY)>>CfMapPatch.SIZE_LOG;
618  final int diffPh = newMaxPy-maxPy;
619  if (diffPh == 0) {
620  // new size fits within current patch ==> no change to
621  // <code>patch</code>
622  maxY = newMaxY;
623  } else {
624  // need to add (diffPh) patches to the bottom
625 
626  assert diffPh > 0;
627 
628  final int newPw = size(minPx, maxPx);
629  final int newPh = size(minPy, newMaxPy);
630  assert patch != null;
631  final int oldPw = patch.length;
632  final int oldPh = patch[0].length;
633 
634  // new height must be more than old size
635  assert newPh > oldPh;
636  assert newPh == oldPh+diffPh;
637  assert newPw == oldPw;
638 
639  maxY = newMaxY;
640  maxPy = newMaxPy;
641  patch = copyPatches(newPw, newPh, 0, 0, oldPw, oldPh);
642  }
643  }
644  }
645 
653  private static int size(final int min, final int max) {
654  return max-min+1;
655  }
656 
663  @NotNull
664  public CfMapSquare getMapSquare(final int x, final int y) {
665  assert Thread.holdsLock(this);
666  return expandTo(x, y).getSquare(ox, oy);
667  }
668 
675  @Nullable
676  public CfMapSquare getMapSquareUnlessDirty(final int x, final int y) {
677  assert Thread.holdsLock(this);
678  final CfMapSquare mapSquare = getMapSquare(x, y);
679  return dirtyMapSquares.contains(mapSquare) ? null : mapSquare;
680  }
681 
687  public int getOffsetX() {
688  assert Thread.holdsLock(this);
689  return patchX;
690  }
691 
697  public int getOffsetY() {
698  assert Thread.holdsLock(this);
699  return patchY;
700  }
701 
712  @NotNull
713  private CfMapPatch @NotNull [] @NotNull [] copyPatches(final int newWidth, final int newHeight, final int offsetX, final int offsetY, final int height, final int width) {
714  assert patch != null;
715  final CfMapPatch[][] newPatch = new CfMapPatch[newWidth][newHeight];
716  for (int y = 0; y < width; y++) {
717  for (int x = 0; x < height; x++) {
718  newPatch[offsetX+x][offsetY+y] = patch[x][y];
719  }
720  }
721  return newPatch;
722  }
723 
728  public void squareModified(@NotNull final CfMapSquare mapSquare) {
729  assert Thread.holdsLock(this);
730  dirtyMapSquares.add(mapSquare);
731  }
732 
739  public void squarePendingFace(final int x, final int y, final int faceNum) {
740  assert Thread.holdsLock(this);
741  pendingFaceSquares.computeIfAbsent(faceNum, k -> new HashSet<>()).add(getMapSquare(x, y));
742  }
743 
748  @NotNull
749  public Set<CfMapSquare> getDirtyMapSquares() {
750  assert Thread.holdsLock(this);
751  final Set<CfMapSquare> result = new HashSet<>(dirtyMapSquares);
752  dirtyMapSquares.clear();
753  return result;
754  }
755 
762  public void updateFace(final int faceNum, final int width, final int height) {
763  for (int y = 0; y < height; y++) {
764  for (int x = 0; x < width; x++) {
765  for (int layer = 0; layer < Map2.NUM_LAYERS; layer++) {
766  final Face face = getFace(x, y, layer);
767  if (face != null && face.getFaceNum() == faceNum) {
768  setFace(x, y, layer, face);
769  dirty(x, y);
770  }
771  }
772  }
773  }
774 
775  final Collection<CfMapSquare> mapSquares = pendingFaceSquares.remove(faceNum);
776  if (mapSquares != null) {
777  dirtyMapSquares.addAll(mapSquares);
778  }
779  }
780 
789  public boolean processMapScroll(final int dx, final int dy, final int width, final int height) {
790  if (Math.abs(dx) >= width || Math.abs(dy) >= height) {
791  scroll(dx, dy);
792  for (int y = 0; y < height; y++) {
793  for (int x = 0; x < width; x++) {
794  clearSquare(x, y);
795  }
796  }
797 
798  return true;
799  }
800 
801  int tx = dx;
802  while (tx > 0) {
803  scroll(-1, 0);
804  for (int y = 0; y < height; y++) {
805  clearSquare(-1, y);
806  clearSquare(width-1, y);
807  }
808  tx--;
809  }
810  while (tx < 0) {
811  scroll(+1, 0);
812  for (int y = 0; y < height; y++) {
813  clearSquare(0, y);
814  clearSquare(width, y);
815  }
816  tx++;
817  }
818 
819  int ty = dy;
820  while (ty > 0) {
821  scroll(0, -1);
822  for (int x = 0; x < width; x++) {
823  clearSquare(x, -1);
824  clearSquare(x, height-1);
825  }
826  ty--;
827  }
828  while (ty < 0) {
829  scroll(0, +1);
830  for (int x = 0; x <= width; x++) {
831  clearSquare(x, 0);
832  clearSquare(x, height);
833  }
834  ty++;
835  }
836 
837  return false;
838  }
839 
840 }
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.map.CfMapPatch.getFace
Face getFace(final int x, final int y, final int layer)
Definition: CfMapPatch.java:161
com.realtime.crossfire.jxclient.map.CfMap.setFaceInternal
void setFaceInternal(final int x, final int y, final int layer, @Nullable final Face face)
Definition: CfMap.java:273
com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_DARKNESS
static final int DEFAULT_DARKNESS
Definition: CfMapSquare.java:45
com.realtime.crossfire.jxclient.map.CfMap.maxPx
int maxPx
Definition: CfMap.java:76
com.realtime.crossfire.jxclient.map.CfMap.oy
int oy
Definition: CfMap.java:98
com.realtime.crossfire.jxclient.map.CfMapPatch.getColor
int getColor(final int x, final int y)
Definition: CfMapPatch.java:149
com.realtime.crossfire.jxclient.map.CfMap.getOffsetX
int getOffsetX()
Definition: CfMap.java:687
com.realtime.crossfire.jxclient.map.CfMap.patchY
int patchY
Definition: CfMap.java:108
com.realtime.crossfire.jxclient.map.CfMap.dirtyMapSquares
final Set< CfMapSquare > dirtyMapSquares
Definition: CfMap.java:120
com.realtime.crossfire.jxclient.map.CfMap.maxPy
int maxPy
Definition: CfMap.java:86
com.realtime.crossfire.jxclient.map.CfMap.setFace
void setFace(final int x, final int y, final int layer, @Nullable final Face face)
Definition: CfMap.java:253
com.realtime.crossfire.jxclient.map.CfMap
Definition: CfMap.java:46
com.realtime.crossfire.jxclient.map.CfMapPatch.getSquare
CfMapSquare getSquare(final int x, final int y)
Definition: CfMapPatch.java:220
com.realtime.crossfire.jxclient.map.CfMap.patchX
int patchX
Definition: CfMap.java:103
com.realtime.crossfire.jxclient.map.CfMap.minX
int minX
Definition: CfMap.java:51
com.realtime.crossfire.jxclient.map.CfMap.scroll
void scroll(final int dx, final int dy)
Definition: CfMap.java:465
com.realtime.crossfire.jxclient.map.CfMapPatch.getHeadMapSquare
CfMapSquare getHeadMapSquare(final int x, final int y, final int layer)
Definition: CfMapPatch.java:189
com.realtime.crossfire.jxclient.faces
Definition: AbstractFaceQueue.java:23
com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_FACE
static final Face DEFAULT_FACE
Definition: CfMapSquare.java:66
com.realtime.crossfire.jxclient.map.CfMap.maxY
int maxY
Definition: CfMap.java:66
com.realtime.crossfire.jxclient.map.CfMapPatch.setHeadMapSquare
void setHeadMapSquare(final int x, final int y, final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways)
Definition: CfMapPatch.java:176
com.realtime.crossfire.jxclient.map.CfMap.getMapPatch
CfMapPatch getMapPatch(final int x, final int y)
Definition: CfMap.java:429
com.realtime.crossfire.jxclient.map.CfMap.isFogOfWar
boolean isFogOfWar(final int x, final int y)
Definition: CfMap.java:414
com.realtime.crossfire.jxclient.protocol
Definition: MagicMap.java:23
com.realtime.crossfire.jxclient.map.CfMapPatch.getDarkness
int getDarkness(final int x, final int y)
Definition: CfMapPatch.java:105
com.realtime.crossfire.jxclient.map.CfMap.setDarkness
void setDarkness(final int x, final int y, final int darkness)
Definition: CfMap.java:160
com.realtime.crossfire.jxclient.map.CfMap.size
static int size(final int min, final int max)
Definition: CfMap.java:653
com.realtime.crossfire.jxclient.map.CfMapPatch
Definition: CfMapPatch.java:33
com.realtime.crossfire.jxclient.map.CfMapPatch.SIZE
static final int SIZE
Definition: CfMapPatch.java:43
com.realtime.crossfire.jxclient.protocol.Map2.NUM_LAYERS
int NUM_LAYERS
Definition: Map2.java:34
com.realtime.crossfire.jxclient.map.CfMapPatch.isFogOfWar
boolean isFogOfWar(final int x, final int y)
Definition: CfMapPatch.java:199
com.realtime.crossfire.jxclient.map.CfMapPatch.SIZE_LOG
static final int SIZE_LOG
Definition: CfMapPatch.java:38
com.realtime.crossfire.jxclient.map.CfMap.increase
void increase(final int dx, final int dy)
Definition: CfMap.java:528
com.realtime.crossfire.jxclient.map.CfMap.ox
int ox
Definition: CfMap.java:92
com.realtime.crossfire.jxclient.protocol.MagicMap.FACE_COLOR_MASK
int FACE_COLOR_MASK
Definition: MagicMap.java:35
com.realtime.crossfire.jxclient.map.CfMap.reset
void reset(final int mapWidth, final int mapHeight)
Definition: CfMap.java:134
com.realtime.crossfire.jxclient.map.CfMap.squareModified
void squareModified(@NotNull final CfMapSquare mapSquare)
Definition: CfMap.java:728
com.realtime.crossfire.jxclient.map.CfMap.minPy
int minPy
Definition: CfMap.java:81
com.realtime.crossfire.jxclient.map.CfMap.getSmooth
int getSmooth(final int x, final int y, final int layer)
Definition: CfMap.java:212
com.realtime.crossfire.jxclient.map.CfMap.getDarkness
int getDarkness(final int x, final int y)
Definition: CfMap.java:176
com.realtime.crossfire.jxclient.map.CfMap.setSmooth
void setSmooth(final int x, final int y, final int layer, final int smooth)
Definition: CfMap.java:189
com.realtime.crossfire.jxclient.map.CfMap.getMapSquare
CfMapSquare getMapSquare(final int x, final int y)
Definition: CfMap.java:664
com.realtime.crossfire.jxclient.map.CfMap.setHeadMapSquare
void setHeadMapSquare(final int x, final int y, final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways)
Definition: CfMap.java:361
com.realtime.crossfire.jxclient.protocol.Map2
Definition: Map2.java:29
com.realtime.crossfire.jxclient.protocol.MagicMap
Definition: MagicMap.java:29
com.realtime.crossfire.jxclient.map.CfMap.getOffsetY
int getOffsetY()
Definition: CfMap.java:697
com.realtime.crossfire.jxclient.map.CfMap.clearSquare
void clearSquare(final int x, final int y)
Definition: CfMap.java:386
com.realtime.crossfire.jxclient.map.CfMapSquare.getFace
Face getFace(final int layer)
Definition: CfMapSquare.java:278
com.realtime.crossfire.jxclient.map.CfMap.expandTo
CfMapPatch expandTo(final int x, final int y)
Definition: CfMap.java:487
com.realtime.crossfire.jxclient.map.CfMap.patch
CfMapPatch[][] patch
Definition: CfMap.java:114
com.realtime.crossfire.jxclient.map.CfMap.getColor
int getColor(final int x, final int y)
Definition: CfMap.java:239
com.realtime.crossfire.jxclient.map.CfMap.getMapSquareUnlessDirty
CfMapSquare getMapSquareUnlessDirty(final int x, final int y)
Definition: CfMap.java:676
com.realtime.crossfire.jxclient.map.CfMapPatch.setSmooth
int setSmooth(final int x, final int y, final int layer, final int smooth)
Definition: CfMapPatch.java:118
com.realtime.crossfire.jxclient.map.CfMap.squarePendingFace
void squarePendingFace(final int x, final int y, final int faceNum)
Definition: CfMap.java:739
com.realtime.crossfire.jxclient.map.CfMap.maxX
int maxX
Definition: CfMap.java:56
com.realtime.crossfire
com.realtime.crossfire.jxclient.map.CfMap.pendingFaceSquares
final Map< Integer, Collection< CfMapSquare > > pendingFaceSquares
Definition: CfMap.java:127
com.realtime.crossfire.jxclient.map.CfMap.dirty
void dirty(final int x, final int y)
Definition: CfMap.java:403
com.realtime
com
com.realtime.crossfire.jxclient.map.CfMap.copyPatches
CfMapPatch[][] copyPatches(final int newWidth, final int newHeight, final int offsetX, final int offsetY, final int height, final int width)
Definition: CfMap.java:713
com.realtime.crossfire.jxclient.faces.Face.getFaceNum
int getFaceNum()
Definition: Face.java:105
com.realtime.crossfire.jxclient.map.CfMap.processMapScroll
boolean processMapScroll(final int dx, final int dy, final int width, final int height)
Definition: CfMap.java:789
com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_SMOOTH
static final int DEFAULT_SMOOTH
Definition: CfMapSquare.java:50
com.realtime.crossfire.jxclient.map.CfMap.getDirtyMapSquares
Set< CfMapSquare > getDirtyMapSquares()
Definition: CfMap.java:749
com.realtime.crossfire.jxclient.map.CfMap.expandFace
void expandFace(final int x, final int y, final int layer, @NotNull final Face face, @NotNull final CfMapSquare oldMapSquare, @Nullable final CfMapSquare newMapSquare)
Definition: CfMap.java:296
com.realtime.crossfire.jxclient.map.CfMapPatch.setColor
void setColor(final int x, final int y, final int color)
Definition: CfMapPatch.java:139
com.realtime.crossfire.jxclient.map.CfMap.setMagicMap
void setMagicMap(final int x0, final int y0, final byte @NotNull[] @NotNull[] data)
Definition: CfMap.java:223
com.realtime.crossfire.jxclient.map.CfMapSquare.setFace
void setFace(final int layer, @Nullable final Face face)
Definition: CfMapSquare.java:265
com.realtime.crossfire.jxclient.map.CfMap.minPx
int minPx
Definition: CfMap.java:71
com.realtime.crossfire.jxclient.map.CfMap.minY
int minY
Definition: CfMap.java:61
com.realtime.crossfire.jxclient.map.CfMapSquare.DEFAULT_COLOR
static final int DEFAULT_COLOR
Definition: CfMapSquare.java:55
com.realtime.crossfire.jxclient.faces.Face
Definition: Face.java:37
com.realtime.crossfire.jxclient.map.CfMapSquare
Definition: CfMapSquare.java:40
com.realtime.crossfire.jxclient.map.CfMap.updateFace
void updateFace(final int faceNum, final int width, final int height)
Definition: CfMap.java:762
com.realtime.crossfire.jxclient.map.CfMap.getHeadMapSquare
CfMapSquare getHeadMapSquare(final int x, final int y, final int layer)
Definition: CfMap.java:374
com.realtime.crossfire.jxclient.map.CfMap.getFace
Face getFace(final int x, final int y, final int layer)
Definition: CfMap.java:344
com.realtime.crossfire.jxclient.map.CfMap.dirtyFace
void dirtyFace(final int x, final int y, final int layer, @NotNull final Face face)
Definition: CfMap.java:320
com.realtime.crossfire.jxclient.map.CfMapPatch.getSmooth
int getSmooth(final int x, final int y, final int layer)
Definition: CfMapPatch.java:129
com.realtime.crossfire.jxclient.map.CfMapPatch.dirty
void dirty(final int x, final int y)
Definition: CfMapPatch.java:73
com.realtime.crossfire.jxclient.map.CfMapPatch.clearSquare
void clearSquare(final int x, final int y)
Definition: CfMapPatch.java:83