summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-15 23:16:42 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-15 23:16:42 +0300
commit77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5 (patch)
tree7dd6e927cef6bcee83ceb897899cd87b863a6f87 /src/being/being.cpp
parentf2b5d38744860360b4b592920c4732aea839ab75 (diff)
downloadplus-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.gz
plus-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.bz2
plus-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.tar.xz
plus-77a4cf27e7ad0ccf4e2245828cbd5f49ecc102a5.zip
Cast skills with offsets.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp27
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;
+ }
+}