Class CfMapPatch
java.lang.Object
com.realtime.crossfire.jxclient.map.CfMapPatch
Represents a square area of
CfMapSquares.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearSquare(int x, int y) Clears the content of one square.voiddirty(int x, int y) Marks a square as dirty.intgetColor(int x, int y) Determines the magic map color value of one square.intgetDarkness(int x, int y) Determines the darkness value of one square.@Nullable FacegetFace(int x, int y, int layer) Determines the face of one square.@Nullable CfMapSquaregetHeadMapSquare(int x, int y, int layer) Returns the map square of the head of a multi-square object.intgetSmooth(int x, int y, int layer) Determines the smooth value of one square.@NotNull CfMapSquaregetSquare(int x, int y) Returns one map square.booleanisFogOfWar(int x, int y) Determines if a square is not up-to-date.booleanresetFogOfWar(int x, int y) Returns and reset the "fog-of-war" flag of a square.voidsetColor(int x, int y, int color) Sets the magic map color of one square.booleansetDarkness(int x, int y, int darkness) Sets the darkness value of one square.voidsetHeadMapSquare(int x, int y, int layer, @Nullable CfMapSquare mapSquare, boolean setAlways) Sets the map square containing the head face for a layer.intsetSmooth(int x, int y, int layer, int smooth) Sets the smooth value of one square.
-
Field Details
-
SIZE_LOG
public static final int SIZE_LOGLog2 ofSIZE.- See Also:
-
SIZE
public static final int SIZESize of patches in x- and y-direction.- See Also:
-
-
Constructor Details
-
CfMapPatch
Creates a new (empty) patch.- Parameters:
map- the map this map patch is part ofx0- the absolute map x-coordinate of the top left corner of this patchy0- the absolute map y-coordinate of the top left corner of this patch
-
-
Method Details
-
dirty
public void dirty(int x, int y) Marks a square as dirty.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square
-
clearSquare
public void clearSquare(int x, int y) Clears the content of one square. Note: the old square content remains available until at least one value will be changed ("fog of war").- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square
-
setDarkness
public boolean setDarkness(int x, int y, int darkness) Sets the darkness value of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squaredarkness- the darkness value to set; 0=dark, 255=full bright- Returns:
- whether fog-of-war has been cleared
-
getDarkness
public int getDarkness(int x, int y) Determines the darkness value of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square- Returns:
- the darkness value of the square; 0=dark, 255=full bright; not yet set faces return 0
-
setSmooth
public int setSmooth(int x, int y, int layer, int smooth) Sets the smooth value of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarelayer- the layer to setsmooth- the smooth value to set- Returns:
- whether fog-of-war has been cleared (1) or whether the smooth value has changed (2)
-
getSmooth
public int getSmooth(int x, int y, int layer) Determines the smooth value of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarelayer- the layer of the square- Returns:
- the smooth value of the square
-
setColor
public void setColor(int x, int y, int color) Sets the magic map color of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarecolor- the color to set
-
getColor
public int getColor(int x, int y) Determines the magic map color value of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square- Returns:
- the color
-
getFace
Determines the face of one square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarelayer- the layer of the face- Returns:
- the face; dark (i.e. not yet set) faces return
null
-
setHeadMapSquare
public void setHeadMapSquare(int x, int y, int layer, @Nullable @Nullable CfMapSquare mapSquare, boolean setAlways) Sets the map square containing the head face for a layer.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarelayer- the layer for the new head face between0andLAYERS-1mapSquare- the map square containing the head face; may benullsetAlways- if set, always update the face; if unset, only update when fog-of-war
-
getHeadMapSquare
Returns the map square of the head of a multi-square object.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the squarelayer- the layer to return the head for- Returns:
- the head map square, or
nullif this square does not contain a multi-tail
-
isFogOfWar
public boolean isFogOfWar(int x, int y) Determines if a square is not up-to-date.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square- Returns:
- whether the square is up-to-date
-
resetFogOfWar
public boolean resetFogOfWar(int x, int y) Returns and reset the "fog-of-war" flag of a square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square- Returns:
- whether this square's fog-of-war state has been reset
-
getSquare
Returns one map square.- Parameters:
x- the x-coordinate of the squarey- the y-coordinate of the square- Returns:
- the map square
-