diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-06-08 21:55:16 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-06-09 00:00:53 -0600 |
commit | ec980b3c586fc64d02ad02f31497013908056d52 (patch) | |
tree | c8a5c573bf8fc5ed2151f32cb7f8468bba31d72a /src/compoundsprite.cpp | |
parent | 891d14807cd042aa90aed94558c2c8eda66d6859 (diff) | |
download | mana-client-ec980b3c586fc64d02ad02f31497013908056d52.tar.gz mana-client-ec980b3c586fc64d02ad02f31497013908056d52.tar.bz2 mana-client-ec980b3c586fc64d02ad02f31497013908056d52.tar.xz mana-client-ec980b3c586fc64d02ad02f31497013908056d52.zip |
Remove hard-coded frame counts from Being class
Also removes the Monster/Player difference in tmwAthena's Being::logic
and moves the particle code from Being::setAttack to Being::Logic for
tmwAthena.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/compoundsprite.cpp')
-rw-r--r-- | src/compoundsprite.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index d6731e5d..d1c6cd57 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -187,6 +187,26 @@ int CompoundSprite::getNumberOfLayers() const } } +size_t CompoundSprite::getCurrentFrame() const +{ + SpriteConstIterator it, it_end; + for (it = begin(), it_end = end(); it != it_end; it++) + if (*it) + return (*it)->getCurrentFrame(); + + return 0; +} + +size_t CompoundSprite::getFrameCount() const +{ + SpriteConstIterator it, it_end; + for (it = begin(), it_end = end(); it != it_end; it++) + if (*it) + return (*it)->getFrameCount(); + + return 0; +} + void CompoundSprite::addSprite(Sprite* sprite) { push_back(sprite); @@ -236,6 +256,36 @@ void CompoundSprite::ensureSize(size_t layerCount) mNeedsRedraw = true; } +/** + * Returns the curent frame in the current animation of the given layer. + */ +size_t CompoundSprite::getCurrentFrame(size_t layer) +{ + if (layer >= size()) + return 0; + + Sprite *s = getSprite(layer); + if (s) + return s->getCurrentFrame(); + + return 0; +} + +/** + * Returns the frame count in the current animation of the given layer. + */ +size_t CompoundSprite::getFrameCount(size_t layer) +{ + if (layer >= size()) + return 0; + + Sprite *s = getSprite(layer); + if (s) + return s->getFrameCount(); + + return 0; +} + void CompoundSprite::redraw() const { // TODO OpenGL support |