summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-18 20:34:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-18 20:41:06 +0300
commitb5fead8f53a555b62c9de2dc23b0f2ce9a136e8e (patch)
treeb4b3be6ca5dec68b68cabf83dd21626b70707c08 /src/resources
parent5b293feb5367ccabd3edf49783511c895807876b (diff)
downloadmv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.gz
mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.bz2
mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.tar.xz
mv-b5fead8f53a555b62c9de2dc23b0f2ce9a136e8e.zip
Add custom rand function implimentation, based on precreated random sequence.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/sprite/animatedsprite.cpp9
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;
}
}