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 | |
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')
-rw-r--r-- | src/being/being.cpp | 27 | ||||
-rw-r--r-- | src/being/being.h | 3 |
2 files changed, 30 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; + } +} diff --git a/src/being/being.h b/src/being/being.h index 90c57a4ae..40658fa68 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1068,6 +1068,9 @@ class Being notfinal : public ActorSprite, const int range, const int waitTimeTicks); + void fixDirectionOffsets(int &offsetX, + int &offsetY) const; + protected: void drawPlayerSpriteAt(Graphics *restrict const graphics, const int x, |