From 264be2108c51837fa92085f6c839e66aebbcfc9e Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 28 Jan 2024 20:56:41 +0100 Subject: Added support for map/layer mask A custom "Mask" property on a layer or a "foregroundXmask" property on a map can now be used in combination with the SMSG_MAP_MASK to dynamically disable certain map layers from the server. Feature previously seen on ManaPlus and implemented for Mana client for compatibility. Also added a ResourceRef class for automating the Resource reference counting. Closes #44 --- src/map.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 2900b4d1..410ae16e 100644 --- a/src/map.h +++ b/src/map.h @@ -131,9 +131,13 @@ class MapLayer int getTileDrawWidth(int x1, int y1, int endX, int &width) const; + void setMask(int mask) { mMask = mask; } + int getMask() const { return mMask; } + private: int mX, mY; int mWidth, mHeight; + int mMask = 1; bool mIsFringeLayer; /**< Whether the actors are drawn. */ Image **mTiles; Map *mMap; /** The mother map pointer */ @@ -335,6 +339,8 @@ class Map : public Properties */ TileAnimation *getAnimationForGid(int gid) const; + void setMask(int mask); + protected: friend class Actor; @@ -415,6 +421,7 @@ class Map : public Properties std::map mTileAnimations; + int mMask = 1; }; #endif -- cgit v1.2.3-70-g09d2