summaryrefslogtreecommitdiff
path: root/src/resources/animation.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-13 03:36:00 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-13 03:36:00 +0300
commitc978b7f0d9de1bb6bd84cd299ed80c27c5147927 (patch)
tree8f1edc2be0816693761ba58aa7c7c554040a7db6 /src/resources/animation.cpp
parentda1b2d8311ca78eccd3e9875598562ce6bf05cab (diff)
downloadmanaverse-c978b7f0d9de1bb6bd84cd299ed80c27c5147927.tar.gz
manaverse-c978b7f0d9de1bb6bd84cd299ed80c27c5147927.tar.bz2
manaverse-c978b7f0d9de1bb6bd84cd299ed80c27c5147927.tar.xz
manaverse-c978b7f0d9de1bb6bd84cd299ed80c27c5147927.zip
Impliment new tags in sprites animations and random condition.
Tags: <label>, <goto>
Diffstat (limited to 'src/resources/animation.cpp')
-rw-r--r--src/resources/animation.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 98ea19f2a..1154d9c9d 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -29,25 +29,38 @@ Animation::Animation():
{
}
-void Animation::addFrame(Image *image, int delay, int offsetX, int offsetY)
+void Animation::addFrame(Image *image, int delay, int offsetX, int offsetY,
+ int rand)
{
- Frame frame = { image, delay, offsetX, offsetY, Frame::ANIMATION, "" };
+ Frame frame = { image, delay, offsetX, offsetY, rand, Frame::ANIMATION, "" };
mFrames.push_back(frame);
mDuration += delay;
}
-void Animation::addTerminator()
+void Animation::addTerminator(int rand)
{
- addFrame(NULL, 0, 0, 0);
+ addFrame(NULL, 0, 0, 0, rand);
}
bool Animation::isTerminator(const Frame &candidate)
{
- return (candidate.image == NULL);
+ return (candidate.image == NULL && candidate.type == Frame::ANIMATION);
}
-void Animation::addJump(std::string name)
+void Animation::addJump(std::string name, int rand)
{
- Frame frame = { 0, 0, 0, 0, Frame::JUMP, name };
+ Frame frame = { 0, 0, 0, 0, rand, Frame::JUMP, name };
+ mFrames.push_back(frame);
+}
+
+void Animation::addLabel(std::string name)
+{
+ Frame frame = { 0, 0, 0, 0, 100, Frame::LABEL, name };
+ mFrames.push_back(frame);
+}
+
+void Animation::addGoto(std::string name, int rand)
+{
+ Frame frame = { 0, 0, 0, 0, rand, Frame::GOTO, name };
mFrames.push_back(frame);
}