summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-07-25 20:11:51 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-07-25 20:11:51 +0200
commit368e8a2ba8546d2158c7089b9480aae25d93cf32 (patch)
tree3ab4abeacaab1e38fe7555a9ef6f33dcdc6aac0f
parentf8252679bb7aa1ffb8d06d64cccba6e91c6d327b (diff)
parent22c1914a49fb0defbc4acf93729f2ab213b6b9da (diff)
downloadmana-368e8a2ba8546d2158c7089b9480aae25d93cf32.tar.gz
mana-368e8a2ba8546d2158c7089b9480aae25d93cf32.tar.bz2
mana-368e8a2ba8546d2158c7089b9480aae25d93cf32.tar.xz
mana-368e8a2ba8546d2158c7089b9480aae25d93cf32.zip
Merge branch 'master' into lpc2012
-rw-r--r--src/net/manaserv/effecthandler.cpp12
-rw-r--r--src/net/manaserv/effecthandler.h1
-rw-r--r--src/net/manaserv/manaserv_protocol.h1
-rw-r--r--src/particleemitter.cpp12
4 files changed, 24 insertions, 2 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
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index c4599233..a8b22e97 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -22,6 +22,7 @@
#include "animationparticle.h"
#include "imageparticle.h"
#include "log.h"
+#include "map.h"
#include "particle.h"
#include "particleemitter.h"
#include "rotationalparticle.h"
@@ -30,7 +31,8 @@
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
-#include "map.h"
+
+#include "utils/stringutils.h"
#include <cmath>
@@ -267,12 +269,18 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
}
else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation"))
{
+ std::string imagesetPath =
+ XML::getProperty(propertyNode, "imageset", "");
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
- XML::getProperty(propertyNode, "imageset", ""),
+ imagesetPath,
XML::getProperty(propertyNode, "width", 0),
XML::getProperty(propertyNode, "height", 0)
);
+ if (!imageset)
+ logger->error(strprintf("Failed to load \"%s\"",
+ imagesetPath.c_str()));
+
// Get animation frames
for_each_xml_child_node(frameNode, propertyNode)
{