Crossfire JXClient, Trunk
MapUpdaterStateTest.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 
34 import javax.swing.ImageIcon;
35 import org.jetbrains.annotations.NotNull;
36 import org.junit.Assert;
37 import org.junit.Test;
38 
43 public class MapUpdaterStateTest {
44 
48  private static final byte @NotNull [] PNG32X32 = { //
49  (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47, (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a, //
50  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d, (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52, //
51  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x20, //
52  (byte)0x08, (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x73, (byte)0x7a, (byte)0x7a, //
53  (byte)0xf4, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47, //
54  (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce, (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00, //
55  (byte)0x00, (byte)0x1a, (byte)0x49, (byte)0x44, (byte)0x41, (byte)0x54, (byte)0x58, (byte)0xc3, //
56  (byte)0xed, (byte)0xc1, (byte)0x01, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x82, //
57  (byte)0x20, (byte)0xff, (byte)0xaf, (byte)0x6e, (byte)0x48, (byte)0x40, (byte)0x01, (byte)0x00, //
58  (byte)0x00, (byte)0x00, (byte)0xef, (byte)0x06, (byte)0x10, (byte)0x20, (byte)0x00, (byte)0x01, //
59  (byte)0x97, (byte)0xf7, (byte)0x57, (byte)0xd7, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
60  (byte)0x49, (byte)0x45, (byte)0x4e, (byte)0x44, (byte)0xae, (byte)0x42, (byte)0x60, (byte)0x82, //
61  };
62 
66  private static final byte @NotNull [] PNG64X64 = { //
67  (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47, (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a, //
68  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d, (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52, //
69  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x40, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x40, //
70  (byte)0x08, (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xaa, (byte)0x69, (byte)0x71, //
71  (byte)0xde, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47, //
72  (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce, (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00, //
73  (byte)0x00, (byte)0x27, (byte)0x49, (byte)0x44, (byte)0x41, (byte)0x54, (byte)0x78, (byte)0xda, //
74  (byte)0xed, (byte)0xc1, (byte)0x01, (byte)0x0d, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xc2, //
75  (byte)0xa0, (byte)0xf7, (byte)0x4f, (byte)0x6d, (byte)0x0e, (byte)0x37, (byte)0xa0, (byte)0x00, //
76  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
77  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x77, //
78  (byte)0x03, (byte)0x40, (byte)0x40, (byte)0x00, (byte)0x01, (byte)0xaf, (byte)0x7a, (byte)0x0e, //
79  (byte)0xe8, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x49, (byte)0x45, (byte)0x4e, //
80  (byte)0x44, (byte)0xae, (byte)0x42, (byte)0x60, (byte)0x82, //
81  };
82 
86  private static final byte @NotNull [] PNG128X256 = { //
87  (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47, (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a, //
88  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d, (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52, //
89  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, //
90  (byte)0x08, (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x7b, (byte)0xf9, (byte)0x7e, //
91  (byte)0xa7, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47, //
92  (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce, (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00, //
93  (byte)0x00, (byte)0x95, (byte)0x49, (byte)0x44, (byte)0x41, (byte)0x54, (byte)0x78, (byte)0xda, //
94  (byte)0xed, (byte)0xc1, (byte)0x01, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, //
95  (byte)0x90, (byte)0xfe, (byte)0xaf, (byte)0xee, (byte)0x08, (byte)0x0a, (byte)0x00, (byte)0x00, //
96  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
97  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
98  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
99  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
100  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
101  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
102  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
103  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
104  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
105  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
106  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
107  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
108  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
109  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
110  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //
111  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, (byte)0xaa, (byte)0x01, (byte)0x01, //
112  (byte)0x1e, (byte)0x00, (byte)0x01, (byte)0xbc, (byte)0x1b, (byte)0xb9, (byte)0x6f, (byte)0x00, //
113  (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x49, (byte)0x45, (byte)0x4e, (byte)0x44, (byte)0xae, //
114  (byte)0x42, (byte)0x60, (byte)0x82, //
115  };
116 
121  @Test
122  public void testFogOfWar1() {
123  final FaceCache faceCache = new FaceCache();
124  final FacesManager facesManager = new TestFacesManager(faceCache);
125  defineFace(faceCache, 1, "M", PNG64X64);
126  defineFace(faceCache, 2, "_", PNG32X32);
127 
128  final MapUpdaterState mapUpdaterState = new MapUpdaterState(facesManager, new Animations(null), new CfAnimations(new ItemSet(), facesManager, new Animations(null)));
129 
130  mapUpdaterState.newMap(5, 5);
131  synchronized (mapUpdaterState.mapBegin()) {
132  mapUpdaterState.mapFace(new Location(0, 0, 0), 2, true);
133  mapUpdaterState.mapFace(new Location(1, 0, 0), 2, true);
134  mapUpdaterState.mapFace(new Location(0, 1, 0), 2, true);
135  mapUpdaterState.mapFace(new Location(1, 1, 0), 2, true);
136  mapUpdaterState.mapFace(new Location(1, 1, 6), 1, true);
137  mapUpdaterState.mapEnd(true);
138  }
139  Assert.assertEquals("""
140  [H0=_,T6=M][H0=_,T6=M]
141  [H0=_,T6=M][H0=_,H6=M]
142  """, toString(mapUpdaterState.getMap(), 0, 0, 2, 2));
143 
144  synchronized (mapUpdaterState.mapBegin()) {
145  mapUpdaterState.mapClear(1, 0);
146  mapUpdaterState.mapEnd(true);
147  }
148  Assert.assertEquals("""
149  [H0=_,T6=M][#,H0=_,T6=M]
150  [H0=_,T6=M][H0=_,H6=M]
151  """, toString(mapUpdaterState.getMap(), 0, 0, 2, 2));
152 
153  synchronized (mapUpdaterState.mapBegin()) {
154  mapUpdaterState.mapClear(1, 1);
155  mapUpdaterState.mapEnd(true);
156  }
157  Assert.assertEquals("""
158  [H0=_][#,H0=_,T6=M]
159  [H0=_][#,H0=_,H6=M]
160  """, toString(mapUpdaterState.getMap(), 0, 0, 2, 2));
161  }
162 
166  @Test
167  public void testDisplayArtifacts1() {
168  final FaceCache faceCache = new FaceCache();
169  final FacesManager facesManager = new TestFacesManager(faceCache);
170  defineFace(faceCache, 307, "behemoth.x31", PNG64X64);
171  defineFace(faceCache, 308, "behemoth.x32", PNG64X64);
172  defineFace(faceCache, 309, "behemoth.x33", PNG64X64);
173  defineFace(faceCache, 310, "behemoth.x71", PNG64X64);
174  defineFace(faceCache, 932, "charwoman.132", PNG32X32);
175  defineFace(faceCache, 4607, "woodfloor.111", PNG32X32);
176  defineFace(faceCache, 312, "behemoth.x73", PNG64X64);
177 
178  final MapUpdaterState mapUpdaterState = new MapUpdaterState(facesManager, new Animations(null), new CfAnimations(new ItemSet(), facesManager, new Animations(null)));
179 
180  mapUpdaterState.newMap(10, 10);
181  synchronized (mapUpdaterState.mapBegin()) {
182  mapUpdaterState.mapFace(new Location(7, 8, 0), 4607, true);
183  mapUpdaterState.mapFace(new Location(8, 8, 0), 4607, true);
184  mapUpdaterState.mapFace(new Location(9, 8, 0), 4607, true);
185  mapUpdaterState.mapFace(new Location(7, 9, 0), 4607, true);
186  mapUpdaterState.mapFace(new Location(8, 9, 0), 4607, true);
187  mapUpdaterState.mapFace(new Location(9, 9, 0), 4607, true);
188  mapUpdaterState.mapFace(new Location(9, 9, 6), 312, true);
189  mapUpdaterState.mapEnd(true);
190  }
191 
192  mapUpdaterState.tick(26);
193  synchronized (mapUpdaterState.mapBegin()) {
194  mapUpdaterState.mapFace(new Location(9, 9, 6), 307, true);
195  mapUpdaterState.mapEnd(true);
196  }
197 
198  mapUpdaterState.tick(27);
199  mapUpdaterState.tick(28);
200  synchronized (mapUpdaterState.mapBegin()) {
201  mapUpdaterState.mapFace(new Location(9, 9, 6), 308, true);
202  mapUpdaterState.mapEnd(true);
203  }
204 
205  mapUpdaterState.tick(29);
206  synchronized (mapUpdaterState.mapBegin()) {
207  mapUpdaterState.mapFace(new Location(0, 5, 6), 0, true);
208  mapUpdaterState.mapEnd(true);
209  }
210 
211  mapUpdaterState.tick(30);
212  synchronized (mapUpdaterState.mapBegin()) {
213  mapUpdaterState.mapFace(new Location(9, 9, 6), 309, true);
214  mapUpdaterState.mapEnd(true);
215  }
216 
217  mapUpdaterState.tick(31);
218  mapUpdaterState.tick(32);
219  synchronized (mapUpdaterState.mapBegin()) {
220  mapUpdaterState.mapFace(new Location(9, 9, 6), 308, true);
221  mapUpdaterState.mapEnd(true);
222  }
223 
224  mapUpdaterState.tick(33);
225  mapUpdaterState.tick(34);
226  synchronized (mapUpdaterState.mapBegin()) {
227  mapUpdaterState.mapFace(new Location(9, 9, 6), 0, true);
228  mapUpdaterState.mapFace(new Location(10, 9, 6), 307, true);
229  mapUpdaterState.mapEnd(true);
230  }
231 
232  mapUpdaterState.tick(35);
233  mapUpdaterState.tick(36);
234  synchronized (mapUpdaterState.mapBegin()) {
235  mapUpdaterState.mapFace(new Location(0, 6, 6), 932, true);
236  mapUpdaterState.mapFace(new Location(9, 9, 6), 312, true);
237  mapUpdaterState.mapClear(10, 9);
238  mapUpdaterState.mapEnd(true);
239  }
240 
241  mapUpdaterState.tick(37);
242  mapUpdaterState.tick(38);
243  synchronized (mapUpdaterState.mapBegin()) {
244  mapUpdaterState.mapFace(new Location(8, 9, 6), 310, true);
245  mapUpdaterState.mapFace(new Location(9, 9, 6), 0, true);
246  mapUpdaterState.mapEnd(true);
247  }
248 
249  mapUpdaterState.tick(39);
250 
251  Assert.assertEquals("""
252  [H0=woodfloor.111,T6=behemoth.x71][H0=woodfloor.111,T6=behemoth.x71][H0=woodfloor.111][]
253  [H0=woodfloor.111,T6=behemoth.x71][H0=woodfloor.111,H6=behemoth.x71][H0=woodfloor.111][#,H6=behemoth.x31]
254  """, toString(mapUpdaterState.getMap(), 7, 8, 4, 2));
255  }
256 
260  @Test
261  public void testDisplayArtifacts2() {
262  final FaceCache faceCache = new FaceCache();
263  final FacesManager facesManager = new TestFacesManager(faceCache);
264  defineFace(faceCache, 7, "a.x11", PNG64X64);
265  defineFace(faceCache, 8, "b.x12", PNG64X64);
266 
267  final MapUpdaterState mapUpdaterState = new MapUpdaterState(facesManager, new Animations(null), new CfAnimations(new ItemSet(), facesManager, new Animations(null)));
268 
269  mapUpdaterState.newMap(10, 10);
270  synchronized (mapUpdaterState.mapBegin()) {
271  mapUpdaterState.mapFace(new Location(5, 10, 6), 7, true);
272  mapUpdaterState.mapEnd(true);
273  }
274 
275  synchronized (mapUpdaterState.mapBegin()) {
276  mapUpdaterState.mapFace(new Location(4, 10, 6), 8, true);
277  mapUpdaterState.mapClear(5, 10);
278  mapUpdaterState.mapEnd(true);
279  }
280 
281  Assert.assertEquals("""
282  [T6=b.x12][T6=b.x12][]
283  [T6=b.x12][H6=b.x12][#,H6=a.x11]
284  """, toString(mapUpdaterState.getMap(), 3, 9, 3, 2));
285  }
286 
290  @Test
291  public void testDisplayArtifacts3() {
292  final FaceCache faceCache = new FaceCache();
293  final FacesManager facesManager = new TestFacesManager(faceCache);
294  final MapUpdaterState mapUpdaterState = new MapUpdaterState(facesManager, new Animations(null), new CfAnimations(new ItemSet(), facesManager, new Animations(null)));
295 
296  mapUpdaterState.newMap(23, 16);
297  defineFace(faceCache, 1316, "demon_lord.x11", PNG128X256);
298 
299  synchronized (mapUpdaterState.mapBegin()) {
300  mapUpdaterState.mapFace(new Location(4, 17, 6), 1316, true);
301  mapUpdaterState.mapEnd(true);
302  }
303 
304  synchronized (mapUpdaterState.mapBegin()) {
305  mapUpdaterState.mapScroll(-1, 0);
306  mapUpdaterState.mapFace(new Location(5, 17, 6), 1316, true);
307  mapUpdaterState.mapEnd(true);
308  }
309 
310  synchronized (mapUpdaterState.mapBegin()) {
311  mapUpdaterState.mapClear(5, 17);
312  mapUpdaterState.mapFace(new Location(6, 17, 6), 1316, true);
313  mapUpdaterState.mapEnd(true);
314  }
315 
316  synchronized (mapUpdaterState.mapBegin()) {
317  mapUpdaterState.mapScroll(-1, 0);
318  mapUpdaterState.mapFace(new Location(7, 17, 6), 1316, true);
319  mapUpdaterState.mapEnd(true);
320  }
321 
322  synchronized (mapUpdaterState.mapBegin()) {
323  mapUpdaterState.mapScroll(-1, 0);
324  mapUpdaterState.mapFace(new Location(8, 17, 6), 1316, true);
325  mapUpdaterState.mapEnd(true);
326  }
327 
328  synchronized (mapUpdaterState.mapBegin()) {
329  mapUpdaterState.mapScroll(-1, 0);
330  mapUpdaterState.mapFace(new Location(9, 17, 6), 1316, true);
331  mapUpdaterState.mapEnd(true);
332  }
333  Assert.assertEquals(""+"[][T6=demon_lord.x11][T6=demon_lord.x11][T6=demon_lord.x11][T6=demon_lord.x11][][][][]\n", toString(mapUpdaterState.getMap(), 5, 10, 9, 1));
334 
335  synchronized (mapUpdaterState.mapBegin()) {
336  mapUpdaterState.mapScroll(-1, 0);
337  mapUpdaterState.mapFace(new Location(11, 17, 6), 1316, true);
338  mapUpdaterState.mapEnd();
339  }
340  Assert.assertEquals(""+"[][][][T6=demon_lord.x11][T6=demon_lord.x11][T6=demon_lord.x11][T6=demon_lord.x11][][]\n", toString(mapUpdaterState.getMap(), 5, 10, 9, 1));
341  }
342 
353  @NotNull
354  private static String toString(@NotNull final CfMap map, final int x0, final int y0, final int w, final int h) {
355  final StringBuilder sb = new StringBuilder();
356  //noinspection SynchronizationOnLocalVariableOrMethodParameter
357  synchronized (map) {
358  for (int y = y0; y < y0+h; y++) {
359  for (int x = x0; x < x0+w; x++) {
360  sb.append('[');
361 
362  boolean firstFace = true;
363 
364  if (map.isFogOfWar(x, y)) {
365  sb.append('#');
366  firstFace = false;
367  }
368 
369  for (int l = 0; l < Map2.NUM_LAYERS; l++) {
370  final Face face = map.getFace(x, y, l);
371  if (face != null) {
372  if (!firstFace) {
373  sb.append(',');
374  }
375  sb.append('H');
376  sb.append(l);
377  sb.append('=');
378  sb.append(face.getFaceName());
379  firstFace = false;
380  }
381 
382  final CfMapSquare headMapSquare = map.getHeadMapSquare(x, y, l);
383  if (headMapSquare != null) {
384  final Face headFace = headMapSquare.getFace(l);
385  if (!firstFace) {
386  sb.append(',');
387  }
388  sb.append('T');
389  sb.append(l);
390  sb.append('=');
391  sb.append(headFace == null ? "null" : headFace.getFaceName());
392  firstFace = false;
393  }
394  }
395  sb.append(']');
396  }
397  sb.append('\n');
398  }
399  }
400  return sb.toString();
401  }
402 
410  private static void defineFace(@NotNull final FaceCache faceCache, final int faceNum, @NotNull final String faceName, final byte @NotNull [] data) {
411  final Face face = new Face(faceNum, faceName, 0);
412  faceCache.addFace(face);
413 
414  final ImageIcon originalImageIcon;
415  try {
416  originalImageIcon = new ImageIcon(data);
417  } catch (final IllegalArgumentException ex) {
418  Assert.fail("Invalid .png data for face "+face+": "+ex.getMessage());
419  throw new AssertionError(ex);
420  }
421 
422  if (originalImageIcon.getIconWidth() <= 0 || originalImageIcon.getIconHeight() <= 0) {
423  Assert.fail("Invalid .png size for face "+face);
424  throw new AssertionError();
425  }
426 
427  final FaceImages faceImages = FaceImagesUtils.newFaceImages(originalImageIcon);
428  face.setFaceImages(faceImages);
429  }
430 
431 }
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.PNG32X32
static final byte[] PNG32X32
A .png file of size 64x64.
Definition: MapUpdaterStateTest.java:48
com.realtime.crossfire.jxclient.faces.FacesManager
Maintains a mapping of face numbers to face data.
Definition: FacesManager.java:40
com.realtime.crossfire.jxclient.map.MapUpdaterState.mapScroll
void mapScroll(final int dx, final int dy)
Part of "map2" parsing: scroll the map view.
Definition: MapUpdaterState.java:344
com.realtime.crossfire.jxclient.faces.Face
A.
Definition: Face.java:37
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest
Regression tests for MapUpdaterState.
Definition: MapUpdaterStateTest.java:43
com.realtime.crossfire.jxclient.items.ItemSet
Model class maintaining the CfItems known to the player.
Definition: ItemSet.java:44
com.realtime.crossfire.jxclient.map.MapUpdaterState.mapFace
void mapFace(@NotNull final Location location, final int faceNum)
Part of "map2" parsing: set the face of a cell.
Definition: MapUpdaterState.java:243
com.realtime.crossfire.jxclient.faces.FaceCache
A cache for Face instances.
Definition: FaceCache.java:33
com.realtime.crossfire.jxclient.map.MapUpdaterState.tick
void tick(final int tickNo)
A "tick" command has been received.
Definition: MapUpdaterState.java:431
com.realtime.crossfire.jxclient.animations.Animations
Manages animations received from the server.
Definition: Animations.java:38
com.realtime.crossfire.jxclient.faces.FaceImagesUtils
Utility class for creating FaceImages instances.
Definition: FaceImagesUtils.java:36
com.realtime.crossfire.jxclient.map.CfMap
Represents a map (as seen by the client).
Definition: CfMap.java:46
com.realtime.crossfire.jxclient.map.CfMapSquare.getHeadMapSquare
CfMapSquare getHeadMapSquare(final int layer)
Returns the map square of the head of a multi-square object.
Definition: CfMapSquare.java:307
com.realtime.crossfire.jxclient.map.MapUpdaterState.newMap
void newMap(final int mapWidth, final int mapHeight)
A "newmap" command has been received.
Definition: MapUpdaterState.java:377
com.realtime.crossfire.jxclient.faces
Manages image information ("faces") needed to display the map view, items, and spell icons.
Definition: AbstractFaceQueue.java:23
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.testDisplayArtifacts1
void testDisplayArtifacts1()
Checks that a regression causing display artifacts is fixed.
Definition: MapUpdaterStateTest.java:167
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.toString
static String toString(@NotNull final CfMap map, final int x0, final int y0, final int w, final int h)
Returns a string representation of a rectangular area of a CfMap instance.
Definition: MapUpdaterStateTest.java:354
com.realtime.crossfire.jxclient.protocol
Definition: MagicMap.java:23
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.testDisplayArtifacts3
void testDisplayArtifacts3()
Checks that a regression causing display artifacts is fixed.
Definition: MapUpdaterStateTest.java:291
com.realtime.crossfire.jxclient.map.MapUpdaterState.getMap
CfMap getMap()
Returns the current map instance.
Definition: MapUpdaterState.java:406
com.realtime.crossfire.jxclient.faces.Face.toString
String toString()
Definition: Face.java:138
com.realtime.crossfire.jxclient.faces.TestFacesManager
A FacesManager for regression tests.
Definition: TestFacesManager.java:34
com.realtime.crossfire.jxclient.animations
Definition: Animation.java:23
com.realtime.crossfire.jxclient.map.MapUpdaterState.mapBegin
Object mapBegin()
Parsing of a "map2" command has been started.
Definition: MapUpdaterState.java:228
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.testDisplayArtifacts2
void testDisplayArtifacts2()
Checks that a regression causing display artifacts is fixed.
Definition: MapUpdaterStateTest.java:261
com.realtime.crossfire.jxclient.faces.FaceImagesUtils.newFaceImages
static FaceImages newFaceImages(@NotNull final ImageIcon originalImageIcon)
Creates a new FaceImages instance from an "original" face; the "scaled" and "magic map" sized images ...
Definition: FaceImagesUtils.java:51
com.realtime.crossfire.jxclient.protocol.Map2
Interface defining constants for the "map2" Crossfire protocol message.
Definition: Map2.java:29
com.realtime.crossfire.jxclient.map.CfMapSquare.getFace
Face getFace(final int layer)
Returns the face of a layer.
Definition: CfMapSquare.java:278
com.realtime.crossfire.jxclient.map.CfAnimations
Manages a set of animated faces.
Definition: CfAnimations.java:47
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.PNG128X256
static final byte[] PNG128X256
A .png file of size 128x256.
Definition: MapUpdaterStateTest.java:86
com.realtime.crossfire.jxclient.faces.FaceImages
Consists of three ImageIcons representing a Face.
Definition: FaceImages.java:32
com.realtime.crossfire.jxclient.faces.Face.getFaceName
String getFaceName()
Returns the face name.
Definition: Face.java:124
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.testFogOfWar1
void testFogOfWar1()
Checks that a cleared multi-tile face causes all affected tiles to become fog-of-war.
Definition: MapUpdaterStateTest.java:122
com.realtime.crossfire.jxclient.map.MapUpdaterState.mapEnd
void mapEnd()
Parsing of "map2" has been finished.
Definition: MapUpdaterState.java:319
com.realtime.crossfire
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.PNG64X64
static final byte[] PNG64X64
A .png file of size 64x64.
Definition: MapUpdaterStateTest.java:66
com.realtime
com
com.realtime.crossfire.jxclient.protocol.Map2.NUM_LAYERS
int NUM_LAYERS
The total number of map layers to display.
Definition: Map2.java:34
com.realtime.crossfire.jxclient.items
Definition: AbstractItemView.java:23
com.realtime.crossfire.jxclient.map.CfMapSquare
Represents a square in a CfMap.
Definition: CfMapSquare.java:40
com.realtime.crossfire.jxclient.map.Location
A location on the map.
Definition: Location.java:32
com.realtime.crossfire.jxclient.map.MapUpdaterState
Update a CfMap model from protocol commands.
Definition: MapUpdaterState.java:49
com.realtime.crossfire.jxclient.faces.Face.setFaceImages
void setFaceImages(@NotNull final FaceImages faceImages)
Sets the images.
Definition: Face.java:92
com.realtime.crossfire.jxclient.map.MapUpdaterState.mapClear
void mapClear(final int x, final int y)
Part of "map2" parsing: clear a cell.
Definition: MapUpdaterState.java:233
com.realtime.crossfire.jxclient.map.MapUpdaterStateTest.defineFace
static void defineFace(@NotNull final FaceCache faceCache, final int faceNum, @NotNull final String faceName, final byte @NotNull[] data)
Adds a new face to a FaceCache.
Definition: MapUpdaterStateTest.java:410