summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-21 19:09:31 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-21 22:43:11 +0300
commit5a392e77e1d77becd1ada0bdf3984c7260b8e287 (patch)
tree39d242518822dfa88f4a01508fada81d9bec26e2 /src
parentaa68511ad3d339be8c8f42fc6c083b696d8e687b (diff)
downloadmanaplus-5a392e77e1d77becd1ada0bdf3984c7260b8e287.tar.gz
manaplus-5a392e77e1d77becd1ada0bdf3984c7260b8e287.tar.bz2
manaplus-5a392e77e1d77becd1ada0bdf3984c7260b8e287.tar.xz
manaplus-5a392e77e1d77becd1ada0bdf3984c7260b8e287.zip
Add software mode compoundsprite update delay.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp7
-rw-r--r--src/client.h2
-rw-r--r--src/compoundsprite.cpp8
-rw-r--r--src/compoundsprite.h1
4 files changed, 17 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index f9398281f..bdb43d0b9 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -225,6 +225,13 @@ int get_elapsed_time(int startTime)
}
}
+int get_elapsed_time1(int startTime)
+{
+ if (startTime <= tick_time)
+ return tick_time - startTime;
+ else
+ return tick_time + (MAX_TICK_VALUE - startTime);
+}
// This anonymous namespace hides whatever is inside from other modules.
namespace
diff --git a/src/client.h b/src/client.h
index c6780dfd6..32197da8f 100644
--- a/src/client.h
+++ b/src/client.h
@@ -76,6 +76,8 @@ extern LoginData loginData;
*/
int get_elapsed_time(int startTime);
+int get_elapsed_time1(int startTime);
+
/**
* All client states.
*/
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index fe6e6ba2a..09ac4b390 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -30,6 +30,7 @@
#include "opengl1graphics.h"
#endif
+#include "client.h"
#include "map.h"
#include "resources/image.h"
@@ -57,7 +58,8 @@ CompoundSprite::CompoundSprite() :
mNeedsRedraw(false),
mEnableAlphaFix(config.getBoolValue("enableAlphaFix")),
mDisableAdvBeingCaching(config.getBoolValue("disableAdvBeingCaching")),
- mDisableBeingCaching(config.getBoolValue("disableBeingCaching"))
+ mDisableBeingCaching(config.getBoolValue("disableBeingCaching")),
+ mNextRedrawTime(0)
{
mAlpha = 1.0f;
}
@@ -440,6 +442,10 @@ void CompoundSprite::updateImages() const
return;
#endif
+ if (get_elapsed_time1(mNextRedrawTime) < 10)
+ return;
+
+ mNextRedrawTime = tick_time;
mNeedsRedraw = false;
if (!mDisableBeingCaching)
diff --git a/src/compoundsprite.h b/src/compoundsprite.h
index 1b9eeca34..aa90816c5 100644
--- a/src/compoundsprite.h
+++ b/src/compoundsprite.h
@@ -145,6 +145,7 @@ private:
bool mDisableAdvBeingCaching;
bool mDisableBeingCaching;
std::vector<Sprite*> mSprites;
+ mutable int mNextRedrawTime;
};
#endif // COMPOUNDSPRITE_H