diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-28 20:56:41 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-28 20:57:58 +0100 |
commit | 264be2108c51837fa92085f6c839e66aebbcfc9e (patch) | |
tree | e1f535d4cda5f399e5e622f6154690a0a4e08c4b /src/net/tmwa/network.cpp | |
parent | d86a1df562e00a6e930683534b9d001f45a951ff (diff) | |
download | mana-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.gz mana-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.bz2 mana-264be2108c51837fa92085f6c839e66aebbcfc9e.tar.xz mana-264be2108c51837fa92085f6c839e66aebbcfc9e.zip |
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
Diffstat (limited to 'src/net/tmwa/network.cpp')
-rw-r--r-- | src/net/tmwa/network.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c1ba615f..d0a5dc62 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -40,7 +40,7 @@ // indicator for a variable-length packet const uint16_t VAR = 1; -uint16_t packet_lengths[0x220] = { +uint16_t packet_lengths[] = { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -82,9 +82,12 @@ uint16_t packet_lengths[0x220] = { VAR,VAR, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56,VAR, 4, 5, 10, // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2,VAR, 16, 0, 8,VAR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + VAR,122,VAR,VAR,VAR,VAR, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +static const int packet_lengths_size + = static_cast<int>(sizeof(packet_lengths) / sizeof(uint16_t)); const unsigned int BUFFER_SIZE = 65536; namespace TmwAthena { @@ -287,7 +290,7 @@ bool Network::messageReady() // TODO don't hard-code this single case if (msgId == SMSG_SERVER_VERSION_RESPONSE) len = 10; - else if (msgId < 0x220) + else if (msgId < packet_lengths_size) len = packet_lengths[msgId]; if (len == VAR) |