From fc5ba333f8832f3d8e054e7c74df1e3cd353645f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 31 May 2012 22:23:23 +0300 Subject: Add sittop sprites support. Add groundtop collision support (not collision but special selected tiles). --- src/being.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index f1a3e0169..a9aade448 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1004,6 +1004,20 @@ void Being::fireMissile(Being *victim, const std::string &particle) } +std::string Being::getSitAction() const +{ + if (serverVersion < 0) + { + return SpriteAction::SIT; + } + else + { + if (mMap && !mMap->getWalk(mX, mY, Map::BLOCKMASK_GROUNDTOP)) + return SpriteAction::SITTOP; + return SpriteAction::SIT; + } +} + void Being::setAction(Action action, int attackType A_UNUSED) { std::string currentAction = SpriteAction::INVALID; @@ -1019,9 +1033,16 @@ void Being::setAction(Action action, int attackType A_UNUSED) // while using only the ACTION_MOVE. break; case SIT: - currentAction = SpriteAction::SIT; + currentAction = getSitAction(); if (mInfo) - sound.playSfx(mInfo->getSound(SOUND_EVENT_SIT), mX, mY); + { + SoundEvent event; + if (currentAction == SpriteAction::SITTOP) + event = SOUND_EVENT_SITTOP; + else + event = SOUND_EVENT_SIT; + sound.playSfx(mInfo->getSound(event), mX, mY); + } break; case ATTACK: if (mEquippedWeapon) -- cgit v1.2.3-60-g2f50