diff options
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; + } +} |