From 995268b33ad305c68e340bdffd3b67322a659694 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Mon, 16 Jul 2012 19:53:39 +0200 Subject: Added handler to display text particles sent by server Change is tested. Reviewed-by: bjorn. --- src/net/manaserv/effecthandler.cpp | 12 ++++++++++++ src/net/manaserv/effecthandler.h | 1 + src/net/manaserv/manaserv_protocol.h | 1 + 3 files changed, 14 insertions(+) (limited to 'src/net') 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 -- cgit v1.2.3-70-g09d2