diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-07-16 19:53:39 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-07-25 20:10:42 +0200 |
commit | 995268b33ad305c68e340bdffd3b67322a659694 (patch) | |
tree | 35a1283d98647cba1a73e0373e9d776f81640759 | |
parent | d754a64e3839b3888d489046546195792e4ecc34 (diff) | |
download | mana-995268b33ad305c68e340bdffd3b67322a659694.tar.gz mana-995268b33ad305c68e340bdffd3b67322a659694.tar.bz2 mana-995268b33ad305c68e340bdffd3b67322a659694.tar.xz mana-995268b33ad305c68e340bdffd3b67322a659694.zip |
Added handler to display text particles sent by server
Change is tested.
Reviewed-by: bjorn.
-rw-r--r-- | src/net/manaserv/effecthandler.cpp | 12 | ||||
-rw-r--r-- | src/net/manaserv/effecthandler.h | 1 | ||||
-rw-r--r-- | src/net/manaserv/manaserv_protocol.h | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp index d0aaf081..22d1f9cf 100644 --- a/src/net/manaserv/effecthandler.cpp +++ b/src/net/manaserv/effecthandler.cpp @@ -23,6 +23,7 @@ #include "actorspritemanager.h" #include "effectmanager.h" +#include "localplayer.h" #include "log.h" #include "gui/viewport.h" @@ -37,6 +38,7 @@ EffectHandler::EffectHandler() static const uint16_t _messages[] = { GPMSG_CREATE_EFFECT_POS, GPMSG_CREATE_EFFECT_BEING, + GPMSG_CREATE_TEXT_PARTICLE, GPMSG_SHAKE, 0 }; @@ -53,6 +55,9 @@ void EffectHandler::handleMessage(MessageIn &msg) case GPMSG_CREATE_EFFECT_BEING: handleCreateEffectBeing(msg); break; + case GPMSG_CREATE_TEXT_PARTICLE: + handleCreateTextParticle(msg); + break; case GPMSG_SHAKE: handleShake(msg); break; @@ -80,6 +85,13 @@ void EffectHandler::handleCreateEffectBeing(MessageIn &msg) logger->log("Warning: CreateEffect called for unknown being #%d", bid); } +void EffectHandler::handleCreateTextParticle(MessageIn &msg) +{ + const std::string &text = msg.readString(); + if (local_player) + local_player->addMessageToQueue(text); +} + void EffectHandler::handleShake(MessageIn &msg) { int16_t intensityX = 0; diff --git a/src/net/manaserv/effecthandler.h b/src/net/manaserv/effecthandler.h index de81fea9..f5f31b11 100644 --- a/src/net/manaserv/effecthandler.h +++ b/src/net/manaserv/effecthandler.h @@ -36,6 +36,7 @@ class EffectHandler : public MessageHandler private: void handleCreateEffectPos(MessageIn &msg); void handleCreateEffectBeing(MessageIn &msg); + void handleCreateTextParticle(MessageIn &msg); void handleShake(MessageIn &msg); }; diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h index bfa737d8..0cc4524c 100644 --- a/src/net/manaserv/manaserv_protocol.h +++ b/src/net/manaserv/manaserv_protocol.h @@ -181,6 +181,7 @@ enum { GPMSG_BEINGS_DAMAGE = 0x0310, // { W being id, W amount }* GPMSG_CREATE_EFFECT_POS = 0x0320, // W effect id, W*2 position GPMSG_CREATE_EFFECT_BEING = 0x0321, // W effect id, W BeingID + GPMSG_CREATE_TEXT_PARTICLE = 0x0322, // S text GPMSG_SHAKE = 0x0330, // W intensityX, W intensityY, [W decay_times_10000, [W duration]] // Guild |