summaryrefslogtreecommitdiff
path: root/src/animatedsprite.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-28 19:05:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-28 19:05:52 +0300
commitb6eb53b9abdf48b88cb1978b9af97f2a879d2717 (patch)
tree5aad5623d352ec0b4aa245856958c61a384861c7 /src/animatedsprite.cpp
parent4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80 (diff)
parent71fe51d38a406012e166589b7b720d83c1ab3ade (diff)
downloadplus-stripped1.1.11.27.tar.gz
plus-stripped1.1.11.27.tar.bz2
plus-stripped1.1.11.27.tar.xz
plus-stripped1.1.11.27.zip
Merge commit 'v1.1.11.27' into strippedstripped1.1.11.27
Conflicts: data/Makefile.am
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r--src/animatedsprite.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index c1f1cac85..5277ddf33 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -42,7 +42,9 @@ AnimatedSprite::AnimatedSprite(SpriteDef *sprite):
mSprite(sprite),
mAction(nullptr),
mAnimation(nullptr),
- mFrame(nullptr)
+ mFrame(nullptr),
+ mNumber(100),
+ mNumber1(100)
{
mAlpha = 1.0f;
@@ -90,7 +92,7 @@ bool AnimatedSprite::play(std::string spriteAction)
if (!mSprite)
return false;
- Action *action = mSprite->getAction(spriteAction);
+ Action *action = mSprite->getAction(spriteAction, mNumber);
if (!action)
return false;
@@ -313,3 +315,19 @@ void *AnimatedSprite::getHash()
// return mAnimation;
return this;
}
+
+bool AnimatedSprite::updateNumber(unsigned num)
+{
+ if (mNumber1 != num)
+ {
+ mNumber1 = num;
+ mNumber = mSprite->findNumber(num);
+ if (!mNumber)
+ {
+ mNumber = 100;
+ return false;
+ }
+ return true;
+ }
+ return false;
+}