22 package com.realtime.crossfire.jxclient.map;
26 import org.jetbrains.annotations.NotNull;
27 import org.jetbrains.annotations.Nullable;
169 if (darkness == DEFAULT_DARKNESS) {
171 for (layer = 0; layer < faces.length; layer++) {
172 if (faces[layer] != DEFAULT_FACE || heads[layer] != null || smooths[layer] != 0) {
176 if (layer >= faces.length) {
193 final boolean markDirty = fogOfWar || this.darkness !=
darkness;
217 public int setSmooth(
final int layer,
final int smooth) {
218 final boolean fogOfWarCleared =
fogOfWar;
219 final boolean smoothChanged = smooths[layer] != smooth;
220 smooths[layer] = smooth;
221 final boolean markDirty = fogOfWar || smoothChanged;
226 return (fogOfWarCleared ? 1 : 0)|(smoothChanged ? 2 : 0);
235 return smooths[layer];
245 final boolean markDirty = fogOfWar || this.color !=
color;
269 if (faces[layer] != face) {
295 if (heads[layer] != mapSquare && (setAlways || heads[layer] == null || heads[layer].fogOfWar)) {
296 heads[layer] = mapSquare;
311 if (heads[layer] != null && !fogOfWar && heads[layer].fogOfWar) {
CfMapSquare getHeadMapSquare(final int layer)
Returns the map square of the head of a multi-square object.
Represents a square in a CfMap.
int getSmooth(final int layer)
Returns the smooth value of this square.
static final int DEFAULT_DARKNESS
The default darkness value for newly created squares.
Represents a map (as seen by the client).
void setFace(final int layer, @Nullable final Face face)
Sets the face of a layer.
int getX()
Returns the absolute map x-coordinate of this square.
void dirty()
Marks this square as dirty, i.e., needing redraw.
int getDarkness()
Returns the darkness value of this square.
final int y
The absolute y-coordinate of this square in its CfMap.
int darkness
The darkness value of the square in the range [0..255].
Manages image information ("faces") needed to display the map view, items, and spell icons...
boolean fogOfWar
Flag used to defer clearing the values: when a.
int getY()
Returns the absolute map y-coordinate of this square.
int NUM_LAYERS
The total number of map layers to display.
static final int DEFAULT_COLOR
The default magic map color for newly created squares.
Interface defining constants for the "map2" Crossfire protocol message.
static final int DEFAULT_SMOOTH
The default smooth value for newly created squares.
final int [] smooths
The smooth values of all layers as sent by the server.
boolean setColor(final int color)
Sets the magic map color of this square.
void squareModified(@NotNull final CfMapSquare mapSquare)
Marks a CfMapSquare as dirty.
boolean isFogOfWar()
Determines if the square is not up-to-date.
static final Face DEFAULT_FACE
The default face value for newly creates squares.
final CfMapSquare [] heads
If this square contains a non-head part of a multi-square object this points to the head square...
void clear()
Marks this square as 'fog-og-war'.
CfMapSquare(@NotNull final CfMap map, final int x, final int y)
Creates a new (empty) square.
int setSmooth(final int layer, final int smooth)
Sets the smooth value of this square.
boolean setDarkness(final int darkness)
Sets the darkness value of this square.
final int x
The absolute x-coordinate of this square in its CfMap.
Face getFace(final int layer)
Returns the face of a layer.
final Face [] faces
The faces (of head-parts) of all layers as sent by the server.
int color
The magic map color of the square.
int getColor()
Returns the magic map color of this square.
boolean resetFogOfWar()
Returns and resets the "fog-of-war" flag.
void setHeadMapSquare(final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways)
Sets the map square containing the head face for a layer.
final CfMap map
The CfMap this map square is part of.
static final int DARKNESS_FULL_BRIGHT
The darkness value for a full bright square.