summaryrefslogtreecommitdiff
path: root/src/net/tmwa/beinghandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-03 20:10:33 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-03 20:10:33 +0300
commit51975cd8624fff3b20aa3b7b1932555e32786561 (patch)
tree55ff8d9c5a459bada8038807a1eaf0dfe98945e2 /src/net/tmwa/beinghandler.cpp
parentfd16292e758ab6fc910ed07441e6e477d616201c (diff)
downloadmanaverse-51975cd8624fff3b20aa3b7b1932555e32786561.tar.gz
manaverse-51975cd8624fff3b20aa3b7b1932555e32786561.tar.bz2
manaverse-51975cd8624fff3b20aa3b7b1932555e32786561.tar.xz
manaverse-51975cd8624fff3b20aa3b7b1932555e32786561.zip
Add spawn animation to mobs.
Also impliment sound events: SOUND_EVENT_MOVE, SOUND_EVENT_SIT, SOUND_EVENT_SPAWN
Diffstat (limited to 'src/net/tmwa/beinghandler.cpp')
-rw-r--r--src/net/tmwa/beinghandler.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 05f10854a..9e3cdefb8 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -61,7 +61,8 @@ const int EMOTION_TIME = 500; /**< Duration of emotion icon */
Being *createBeing(int id, short job);
BeingHandler::BeingHandler(bool enableSync):
- mSync(enableSync)
+ mSync(enableSync),
+ mSpawnId(0)
{
static const Uint16 _messages[] =
{
@@ -169,6 +170,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
int hp, maxHP, oldHP;
unsigned char colors[9];
Uint8 dir;
+ int spawnId;
switch (msg.getId())
{
@@ -176,6 +178,11 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
case SMSG_BEING_MOVE:
// Information about a being in range
id = msg.readInt32();
+ if (id == mSpawnId)
+ spawnId = mSpawnId;
+ else
+ spawnId = 0;
+ mSpawnId = 0;
speed = msg.readInt16();
stunMode = msg.readInt16(); // opt1
statusEffects = msg.readInt16(); // opt2
@@ -208,6 +215,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (!dstBeing)
break;
+
if (job == 1022 && killStats)
killStats->jackoAlive(dstBeing->getId());
}
@@ -223,14 +231,17 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
if (dstBeing->getType() == Being::PLAYER)
dstBeing->setMoveTime();
- if (msg.getId() == SMSG_BEING_VISIBLE)
+ if (spawnId)
+ {
+ dstBeing->setAction(Being::SPAWN);
+ }
+ else if (msg.getId() == SMSG_BEING_VISIBLE)
{
dstBeing->clearPath();
dstBeing->setActionTime(tick_time);
dstBeing->setAction(Being::STAND);
}
-
// Prevent division by 0 when calculating frame
if (speed == 0)
speed = 150;
@@ -401,7 +412,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
case SMSG_BEING_SPAWN:
// skipping this packet
- msg.readInt32(); // id
+ mSpawnId = msg.readInt32(); // id
msg.readInt16(); // speed
msg.readInt16(); // opt1
msg.readInt16(); // opt2