summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/network.cpp2
-rw-r--r--src/net/tmwa/playerhandler.cpp19
-rw-r--r--src/net/tmwa/playerhandler.h1
-rw-r--r--src/net/tmwa/protocol.h1
4 files changed, 22 insertions, 1 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 1ed7ee581..24615ab16 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -78,7 +78,7 @@ int16_t packet_lengths[] =
// #0x0200
26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0,
2, -1, 16, 0, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -1, 122, -1, -1, -1, -1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 122, -1, -1, -1, -1, 10, -1, 0, 0, 0, 0, 0, 0, 0, 0,
};
static const int packet_lengths_size
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index df56176f0..b1fa64d25 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -25,6 +25,7 @@
#include "configuration.h"
#include "client.h"
#include "game.h"
+#include "soundmanager.h"
#include "net/net.h"
@@ -34,6 +35,8 @@
#include "gui/windows/whoisonline.h"
+#include "gui/viewport.h"
+
#include "debug.h"
extern Net::PlayerHandler *playerHandler;
@@ -58,6 +61,7 @@ PlayerHandler::PlayerHandler() :
SMSG_PLAYER_ARROW_MESSAGE,
SMSG_ONLINE_LIST,
SMSG_MAP_MASK,
+ SMSG_MAP_MUSIC,
0
};
handledMessages = _messages;
@@ -114,6 +118,10 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
processMapMask(msg);
break;
+ case SMSG_MAP_MUSIC:
+ processMapMusic(msg);
+ break;
+
default:
break;
}
@@ -310,4 +318,15 @@ void PlayerHandler::processMapMask(Net::MessageIn &msg) const
map->setMask(mask);
}
+void PlayerHandler::processMapMusic(Net::MessageIn &msg) const
+{
+ const int size = msg.readInt16() - 5;
+ const std::string music = msg.readString(size);
+ soundManager.playMusic(music);
+
+ Map *const map = viewport->getMap();
+ if (map)
+ map->setMusicFile(music);
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index 32f40434b..75022a452 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -55,6 +55,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void requestOnlineList() const override final;
void updateStatus(const uint8_t status) const override final;
void processMapMask(Net::MessageIn &msg) const;
+ void processMapMusic(Net::MessageIn &msg) const;
void respawn() const override final;
};
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index f3f395148..965c67a50 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -351,6 +351,7 @@ enum
#define SMSG_QUEST_PLAYER_VARS 0x0215
#define SMSG_BEING_MOVE3 0x0225
#define SMSG_MAP_MASK 0x0226
+#define SMSG_MAP_MUSIC 0x0227
#define CMSG_SEND_CLIENT_INFO 0x7533
#define SMSG_UPDATE_HOST2 0x7534