From 5a392e77e1d77becd1ada0bdf3984c7260b8e287 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 21 Jun 2012 19:09:31 +0300 Subject: Add software mode compoundsprite update delay. --- src/client.cpp | 7 +++++++ src/client.h | 2 ++ src/compoundsprite.cpp | 8 +++++++- src/compoundsprite.h | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') 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 mSprites; + mutable int mNextRedrawTime; }; #endif // COMPOUNDSPRITE_H -- cgit v1.2.3-60-g2f50