diff options
author | Eugene Sandulenko | 2016-09-23 09:58:00 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-23 18:28:01 +0200 |
commit | c9d01a0cfdd8c39d9e27ff29e6fc13adee296258 (patch) | |
tree | 61dc5b2613ec39b172853189dbe60eda4c0edfc4 /engines/fullpipe | |
parent | a46ac560150318b460a18181a02b627ee1e20a61 (diff) | |
download | scummvm-rg350-c9d01a0cfdd8c39d9e27ff29e6fc13adee296258.tar.gz scummvm-rg350-c9d01a0cfdd8c39d9e27ff29e6fc13adee296258.tar.bz2 scummvm-rg350-c9d01a0cfdd8c39d9e27ff29e6fc13adee296258.zip |
FULLPIPE: Made object sorting stable. This removes flicker in many scenes
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/scene.cpp | 12 | ||||
-rw-r--r-- | engines/fullpipe/utils.h | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 1d693fcebd..9e44449158 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -469,10 +469,18 @@ bool Scene::compareObjPriority(const void *p1, const void *p2) { if (((const GameObject *)p1)->_priority > ((const GameObject *)p2)->_priority) return true; + if (((const GameObject *)p1)->_priority == ((const GameObject *)p2)->_priority) + if (((const GameObject *)p1)->_cnum > ((const GameObject *)p2)->_cnum) + return true; + return false; } void Scene::objectList_sortByPriority(Common::Array<StaticANIObject *> &list, bool skipFirst) { + // Ensure the sort is stable + for (uint i = 0; i < list.size(); i++) + list[i]->_cnum = i; + if (skipFirst) { Common::Array<StaticANIObject *>::iterator s = list.begin(); @@ -485,6 +493,10 @@ void Scene::objectList_sortByPriority(Common::Array<StaticANIObject *> &list, bo } void Scene::objectList_sortByPriority(Common::Array<PictureObject *> &list, bool skipFirst) { + // Ensure the sort is stable + for (uint i = 0; i < list.size(); i++) + list[i]->_cnum = i; + if (skipFirst) { Common::Array<PictureObject *>::iterator s = list.begin(); diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 41a54f4ce7..2f9b75c07f 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -110,8 +110,9 @@ enum ObjType { class CObject { public: ObjType _objtype; + uint _cnum; - CObject() : _objtype(kObjTypeDefault) {} + CObject() : _objtype(kObjTypeDefault), _cnum(0) {} virtual bool load(MfcArchive &in) { return true; } virtual void save(MfcArchive &out) { error("Not implemented for obj type: %d", _objtype); } virtual ~CObject() {} |