public class CfMap
extends java.lang.Object
CfMapSquares
can be stored.
The map will be automatically enlarged by accesses to new squares. Not yet set squares are considered dark.
All accesses must be synchronized on the map instance.
Constructor and Description |
---|
CfMap() |
Modifier and Type | Method and Description |
---|---|
void |
clearSquare(int x,
int y)
Clears the content of one square.
|
void |
dirty(int x,
int y)
Marks a single square as dirty.
|
int |
getColor(int x,
int y)
Returns the magic map color value of one square.
|
int |
getDarkness(int x,
int y)
Returns the darkness value of one square.
|
@NotNull java.util.Set<CfMapSquare> |
getDirtyMapSquares()
Returns the dirty map squares.
|
@Nullable Face |
getFace(int x,
int y,
int layer)
Determines the face of one square.
|
@Nullable CfMapSquare |
getHeadMapSquare(int x,
int y,
int layer)
Returns the map square of the head of a multi-square object.
|
@NotNull CfMapSquare |
getMapSquare(int x,
int y)
Returns a map square.
|
@Nullable CfMapSquare |
getMapSquareUnlessDirty(int x,
int y)
Returns a map square.
|
int |
getOffsetX()
Returns the offset to convert an absolute x-coordinate of a map square
(
CfMapSquare.getX() to a relative x-coordinate. |
int |
getOffsetY()
Returns the offset to convert an absolute y-coordinate of a map square
(
CfMapSquare.getY() to a relative y-coordinate. |
int |
getSmooth(int x,
int y,
int layer)
Returns the smooth value of one square.
|
boolean |
isFogOfWar(int x,
int y)
Determines if the tile is not up-to-date.
|
boolean |
processMapScroll(int dx,
int dy,
int width,
int height)
Processes a map scroll command.
|
void |
reset(int mapWidth,
int mapHeight)
Clears the map contents.
|
void |
setDarkness(int x,
int y,
int darkness)
Sets the darkness value of one square.
|
void |
setFace(int x,
int y,
int layer,
@Nullable Face face)
Sets the face of one square.
|
void |
setMagicMap(int x0,
int y0,
byte[][] data)
Sets the magic map color of one square.
|
void |
setSmooth(int x,
int y,
int layer,
int smooth)
Sets the smooth value of one square.
|
void |
squareModified(@NotNull CfMapSquare mapSquare)
Marks a
CfMapSquare as dirty. |
void |
squarePendingFace(int x,
int y,
int faceNum)
Marks a
CfMapSquare as containing a pending face. |
void |
updateFace(int faceNum,
int width,
int height)
Processes an updated face image.
|
public void reset(int mapWidth, int mapHeight)
mapWidth
- the width of the visible map areamapHeight
- the height of the visible map areapublic void setDarkness(int x, int y, int darkness)
x
- the x-coordinate of the squarey
- the y-coordinate of the squaredarkness
- the darkness value to set; 0=dark, 255=full brightpublic int getDarkness(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic void setSmooth(int x, int y, int layer, int smooth)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer to setsmooth
- the smooth value to setpublic int getSmooth(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer of the squarepublic void setMagicMap(int x0, int y0, byte[][] data)
x0
- the x-coordinate of the squarey0
- the y-coordinate of the squaredata
- the magic map data (y, x); will not be changedpublic int getColor(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic void setFace(int x, int y, int layer, @Nullable @Nullable Face face)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer to setface
- the face to set; may be null
to remove the face@Nullable public @Nullable Face getFace(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer of the facenull
@Nullable public @Nullable CfMapSquare getHeadMapSquare(int x, int y, int layer)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarelayer
- the layer to return the head fornull
if this square does not
contain a multi-tailpublic void clearSquare(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic void dirty(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the squarepublic boolean isFogOfWar(int x, int y)
x
- the x-coordinate of the squarey
- the y-coordinate of the square@NotNull public @NotNull CfMapSquare getMapSquare(int x, int y)
x
- the x-coordinatey
- the y-coordinate@Nullable public @Nullable CfMapSquare getMapSquareUnlessDirty(int x, int y)
x
- the x-coordinatey
- the y-coordinatenull
if it would be dirtypublic int getOffsetX()
CfMapSquare.getX()
to a relative x-coordinate.public int getOffsetY()
CfMapSquare.getY()
to a relative y-coordinate.public void squareModified(@NotNull @NotNull CfMapSquare mapSquare)
CfMapSquare
as dirty.mapSquare
- the map squarepublic void squarePendingFace(int x, int y, int faceNum)
CfMapSquare
as containing a pending face.x
- the x coordinate of the map squarey
- the y coordinate of the map squarefaceNum
- the pending face@NotNull public @NotNull java.util.Set<CfMapSquare> getDirtyMapSquares()
public void updateFace(int faceNum, int width, int height)
faceNum
- the face that has changedwidth
- the width of the visible map areaheight
- the height of the visible map areapublic boolean processMapScroll(int dx, int dy, int width, int height)
dx
- the distance to scroll in x-direction in squaresdy
- the distance to scroll in y-direction in squareswidth
- the width of the visible map area in map squaresheight
- the height of the visible map area in map squares