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/net/tmwa/playerhandler.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/net/tmwa/playerhandler.cpp') diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 6ef669e4..5c57b8aa 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -152,6 +152,7 @@ PlayerHandler::PlayerHandler() SMSG_PLAYER_STAT_UPDATE_5, SMSG_PLAYER_STAT_UPDATE_6, SMSG_PLAYER_ARROW_MESSAGE, + SMSG_MAP_MASK, 0 }; handledMessages = _messages; @@ -512,6 +513,15 @@ void PlayerHandler::handleMessage(MessageIn &msg) } } break; + + case SMSG_MAP_MASK: + { + const int mask = msg.readInt32(); + msg.readInt32(); // unused + if (Map *map = Game::instance()->getCurrentMap()) + map->setMask(mask); + } + break; } } -- cgit v1.2.3-70-g09d2