diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-18 20:34:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-18 20:41:06 +0300 |
commit | b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e (patch) | |
tree | b4b3be6ca5dec68b68cabf83dd21626b70707c08 /src/resources/sprite | |
parent | 5b293feb5367ccabd3edf49783511c895807876b (diff) | |
download | manaplus-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.gz manaplus-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.bz2 manaplus-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.xz manaplus-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.zip |
Add custom rand function implimentation, based on precreated random sequence.
Diffstat (limited to 'src/resources/sprite')
-rw-r--r-- | src/resources/sprite/animatedsprite.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp index 34aca4706..f0af74f08 100644 --- a/src/resources/sprite/animatedsprite.cpp +++ b/src/resources/sprite/animatedsprite.cpp @@ -36,6 +36,7 @@ #include "resources/sprite/animationdelayload.h" #include "utils/delete2.h" +#include "utils/mrand.h" #include "debug.h" @@ -240,7 +241,7 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) restrict2 !mFrame->nextAction.empty()) { if (mFrame->rand == 100 || - mFrame->rand >= rand() % 100) + mFrame->rand >= mrand() % 100) { for (size_t i = 0; i < mAnimation->getLength(); i ++) { @@ -272,7 +273,7 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) restrict2 !mFrame->nextAction.empty()) { if (mFrame->rand == 100 || - mFrame->rand >= rand() % 100) + mFrame->rand >= mrand() % 100) { play(mFrame->nextAction); return true; @@ -283,7 +284,7 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) restrict2 mFrame->type == Frame::ANIMATION) { if (mFrame->rand == 100 || - mFrame->rand >= rand() % 100) + mFrame->rand >= mrand() % 100) { mAnimation = nullptr; mFrame = nullptr; @@ -299,7 +300,7 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) restrict2 } else { - if (rand() % 100 <= mFrame->rand) + if (mrand() % 100 <= mFrame->rand) fail = false; } } |