From e99b6aaeb119feabfa2f7c3c49908625981e9708 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 20 Feb 2007 20:55:37 +0000 Subject: Now different sounds can play when a monster misses the player. --- src/net/beinghandler.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src/net/beinghandler.cpp') diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 46c44664..4734a710 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -187,35 +187,32 @@ void BeingHandler::handleMessage(MessageIn *msg) switch (type) { case 0: // Damage - if (dstBeing == NULL) break; - - dstBeing->setDamage(param1, SPEECH_TIME); - - if (srcBeing != NULL && - srcBeing != player_node) - { - srcBeing->setAction(Being::ATTACK); - srcBeing->mFrame = 0; - srcBeing->mWalkTime = tick_time; + if (dstBeing) { + dstBeing->takeDamage(param1); + } + if (srcBeing) { + srcBeing->handleAttack(dstBeing, param1); } break; case 2: // Sit - if (srcBeing == NULL) break; - srcBeing->mFrame = 0; - srcBeing->setAction(Being::SIT); + if (srcBeing) { + srcBeing->mFrame = 0; + srcBeing->setAction(Being::SIT); + } break; case 3: // Stand up - if (srcBeing == NULL) break; - srcBeing->mFrame = 0; - srcBeing->setAction(Being::STAND); + if (srcBeing) { + srcBeing->mFrame = 0; + srcBeing->setAction(Being::STAND); + } break; } break; case SMSG_BEING_LEVELUP: - if ((Uint32)msg->readInt32() == player_node->getId()) { + if ((Uint32) msg->readInt32() == player_node->getId()) { logger->log("Level up"); sound.playSfx("sfx/levelup.ogg"); } else { -- cgit v1.2.3-70-g09d2