From 51975cd8624fff3b20aa3b7b1932555e32786561 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Apr 2011 20:10:33 +0300 Subject: Add spawn animation to mobs. Also impliment sound events: SOUND_EVENT_MOVE, SOUND_EVENT_SIT, SOUND_EVENT_SPAWN --- src/net/tmwa/beinghandler.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/net/tmwa/beinghandler.cpp') 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 -- cgit v1.2.3-70-g09d2