diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-30 18:28:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-30 18:28:12 +0300 |
commit | fde614c1e6e944b4805e7e6a89689b9d546330ad (patch) | |
tree | e378b3d2ace8ae88a3eaf0e98657bbd227a748ab | |
parent | 0af4b6dd0f616564a55447c7ce5318c72f68e590 (diff) | |
download | plus-fde614c1e6e944b4805e7e6a89689b9d546330ad.tar.gz plus-fde614c1e6e944b4805e7e6a89689b9d546330ad.tar.bz2 plus-fde614c1e6e944b4805e7e6a89689b9d546330ad.tar.xz plus-fde614c1e6e944b4805e7e6a89689b9d546330ad.zip |
eathena: add packet SMSG_MAP_MUSIC 0x0b05.
-rw-r--r-- | src/net/ea/playerhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 4 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 5 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.h | 2 |
7 files changed, 24 insertions, 15 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 8fd63a641..baea3b1e6 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -26,6 +26,7 @@ #include "game.h" #include "party.h" #include "notifymanager.h" +#include "soundmanager.h" #include "units.h" #include "being/attributes.h" @@ -532,4 +533,15 @@ void PlayerHandler::processMapMask(Net::MessageIn &msg) map->setMask(mask); } +void PlayerHandler::processMapMusic(Net::MessageIn &msg) +{ + const int size = msg.readInt16("len") - 5; + const std::string music = msg.readString(size, "name"); + soundManager.playMusic(music); + + Map *const map = viewport->getMap(); + if (map) + map->setMusicFile(music); +} + } // namespace Ea diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 211baab2e..44510d573 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -74,6 +74,8 @@ class PlayerHandler notfinal : public Net::PlayerHandler static void processPlayerArrowMessage(Net::MessageIn &msg); static void processMapMask(Net::MessageIn &msg); + + static void processMapMusic(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 36d31329c..cd1b69f93 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -278,8 +278,10 @@ int16_t packet_lengths[] = 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, 0, +//0 1 2 3 4 5 6 7 8 9 a b c d e f +//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0B00 - 16, -1, 10, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, -1, 10, -1, -1, -1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 7e1458e90..e845884c8 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -60,6 +60,7 @@ PlayerHandler::PlayerHandler() : SMSG_PLAYER_HEAL, SMSG_PLAYER_SKILL_MESSAGE, SMSG_MAP_MASK, + SMSG_MAP_MUSIC, 0 }; handledMessages = _messages; @@ -135,6 +136,10 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processMapMask(msg); break; + case SMSG_MAP_MUSIC: + processMapMusic(msg); + break; + default: break; } diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 94c620efd..0ac0a1fcc 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -313,6 +313,8 @@ #define SMSG_MOB_INFO 0x0b03 +#define SMSG_MAP_MUSIC 0x0b05 + /********************************** * Packets from client to server * **********************************/ diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 8bea7d01e..cec4d2772 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -24,7 +24,6 @@ #include "configuration.h" #include "game.h" -#include "soundmanager.h" #include "being/attributes.h" #include "being/beingflag.h" @@ -329,17 +328,6 @@ void PlayerHandler::updateStatus(const uint8_t status) const outMsg.writeInt8(0, "unused"); } -void PlayerHandler::processMapMusic(Net::MessageIn &msg) -{ - const int size = msg.readInt16("len") - 5; - const std::string music = msg.readString(size, "name"); - soundManager.playMusic(music); - - Map *const map = viewport->getMap(); - if (map) - map->setMusicFile(music); -} - void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate5") diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 694961354..627c9387f 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -85,8 +85,6 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler const int mod, const bool notify) const override final; - static void processMapMusic(Net::MessageIn &msg); - static void processPlayerStatUpdate5(Net::MessageIn &msg); static void processWalkResponse(Net::MessageIn &msg); |