diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-23 16:02:00 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-23 16:02:00 +0000 |
commit | 05a12d5568111fa13759026442ed358605bf9a28 (patch) | |
tree | 9948a2351c846dee1b36f25a90d1429aa78dda23 /src/being.cpp | |
parent | 3737fb9fd3ff6072f83bdc514f88ad0fdbf4da6c (diff) | |
download | mana-05a12d5568111fa13759026442ed358605bf9a28.tar.gz mana-05a12d5568111fa13759026442ed358605bf9a28.tar.bz2 mana-05a12d5568111fa13759026442ed358605bf9a28.tar.xz mana-05a12d5568111fa13759026442ed358605bf9a28.zip |
A bunch of mostly cosmetic cleanups.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/being.cpp b/src/being.cpp index 2fb13607..253c2d24 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -314,11 +314,10 @@ void Being::setWeaponById(Uint16 weapon) } } -int -Being::getXOffset() const +int Being::getOffset(char pos, char neg) const { - // Only beings walking to the left or the right have an x offset - if (action != WALK || !(direction & (LEFT | RIGHT))) { + // Check whether we're walking in the requested direction + if (action != WALK || !(direction & (pos | neg))) { return 0; } @@ -330,32 +329,8 @@ Being::getXOffset() const offset = 0; } - // Going to the left? Invert the offset. - if (direction & LEFT) { - offset = -offset; - } - - return offset; -} - -int -Being::getYOffset() const -{ - // Only beings walking up or down have an y offset - if (action != WALK || !(direction & (UP | DOWN))) { - return 0; - } - - int offset = (get_elapsed_time(walk_time) * 32) / mWalkSpeed; - - // We calculate the offset _from_ the _target_ location - offset -= 32; - if (offset > 0) { - offset = 0; - } - - // Going up? Invert the offset. - if (direction & UP) { + // Going into negative direction? Invert the offset. + if (direction & pos) { offset = -offset; } |