summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/network.cpp9
-rw-r--r--src/net/tmwa/network.h1
-rw-r--r--src/net/tmwa/playerhandler.cpp10
-rw-r--r--src/net/tmwa/protocol.h2
4 files changed, 19 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)
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 97c7970f..4df44b75 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -41,6 +41,7 @@
* the protocol accordingly.
*/
#define CLIENT_PROTOCOL_VERSION 1
+// 10 -> 11: SMSG_MAP_MASK DONE
namespace TmwAthena {
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;
}
}
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 768d6061..e9ea84e8 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -213,6 +213,8 @@ static const int STORAGE_OFFSET = 1;
#define SMSG_MVP 0x010c
+#define SMSG_MAP_MASK 0x0226
+
/**********************************
* Packets from client to server *
**********************************/