diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-15 23:16:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-15 23:16:42 +0300 |
commit | 77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5 (patch) | |
tree | 7dd6e927cef6bcee83ceb897899cd87b863a6f87 /src/being/being.cpp | |
parent | f2b5d38744860360b4b592920c4732aea839ab75 (diff) | |
download | ManaVerse-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.gz ManaVerse-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.bz2 ManaVerse-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.xz ManaVerse-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.zip |
Cast skills with offsets.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index c146ecb00..2737f2b8a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -5422,3 +5422,30 @@ void Being::stopCast(const bool b) if (b && mAction == BeingAction::CAST) setAction(BeingAction::STAND, 0); } + +void Being::fixDirectionOffsets(int &offsetX, + int &offsetY) const +{ + const uint8_t dir = mDirection; + if (dir & BeingDirection::DOWN) + { + // do nothing + } + else if (dir & BeingDirection::UP) + { + offsetX = -offsetX; + offsetY = -offsetY; + } + else if (dir & BeingDirection::LEFT) + { + const int tmp = offsetY; + offsetY = offsetX; + offsetX = -tmp; + } + else if (dir & BeingDirection::RIGHT) + { + const int tmp = offsetY; + offsetY = -offsetX; + offsetX = tmp; + } +} |