diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-31 22:23:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-31 22:23:23 +0300 |
commit | fc5ba333f8832f3d8e054e7c74df1e3cd353645f (patch) | |
tree | 16aabceaaa2b197d006bd357d3176acac292cde7 /src/being.cpp | |
parent | 9875c00dc37b1d7b55e1154075a0cd2d997a490d (diff) | |
download | mv-fc5ba333f8832f3d8e054e7c74df1e3cd353645f.tar.gz mv-fc5ba333f8832f3d8e054e7c74df1e3cd353645f.tar.bz2 mv-fc5ba333f8832f3d8e054e7c74df1e3cd353645f.tar.xz mv-fc5ba333f8832f3d8e054e7c74df1e3cd353645f.zip |
Add sittop sprites support.
Add groundtop collision support (not collision but special selected tiles).
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
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) |