aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/scene.cpp
diff options
context:
space:
mode:
authorRetro-Junk2016-09-27 23:37:33 +0300
committerEugene Sandulenko2016-09-27 22:55:00 +0200
commit5de239e3c631943c37f3de959116e9749efa6098 (patch)
tree69997616fe625052147ca661a0e2070270fc0500 /engines/fullpipe/scene.cpp
parenta687ae3daf3210c9fb66a1981288caa387ff995a (diff)
downloadscummvm-rg350-5de239e3c631943c37f3de959116e9749efa6098.tar.gz
scummvm-rg350-5de239e3c631943c37f3de959116e9749efa6098.tar.bz2
scummvm-rg350-5de239e3c631943c37f3de959116e9749efa6098.zip
FULLPIPE: Revert to original bubble sort algorithm for scene objects
Diffstat (limited to 'engines/fullpipe/scene.cpp')
-rw-r--r--engines/fullpipe/scene.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index cba688a123..b03540a5ee 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -469,6 +469,7 @@ void Scene::initObjectCursors(const char *varname) {
}
}
+#if 0
bool Scene::compareObjPriority(const void *p1, const void *p2) {
if (((const GameObject *)p1)->_priority > ((const GameObject *)p2)->_priority)
return true;
@@ -503,6 +504,31 @@ void Scene::objectList_sortByPriority(Common::Array<PictureObject *> &list, bool
Common::sort(list.begin(), list.end(), Scene::compareObjPriority);
}
}
+#else
+template<typename T>
+void Scene::objectList_sortByPriority(Common::Array<T *> &list, int startIndex) {
+ if (list.size() > startIndex) {
+ int lastIndex = list.size() - 1;
+ int count = lastIndex - startIndex;
+ bool changed;
+ do {
+ changed = false;
+ T *refElement = list[startIndex];
+ for (int i = startIndex; i < lastIndex; i++) {
+ T *curElement = list[i + 1];
+ if (curElement->_priority > refElement->_priority) {
+ // Push refElement down the list
+ list.remove_at(i);
+ list.insert_at(i + 1, refElement);
+ changed = true;
+ } else
+ refElement = curElement;
+ }
+ count--;
+ } while (changed);
+ }
+}
+#endif
void Scene::draw() {
debugC(6, kDebugDrawing, ">>>>> Scene::draw()");
@@ -669,9 +695,13 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
debugC(1, kDebugDrawing, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg);
+#if 0
if (_picObjList.size() > 2) { // We need to z-sort them
objectList_sortByPriority(_picObjList, true);
}
+#else
+ objectList_sortByPriority(_picObjList, 1);
+#endif
if (minPri == -1 && _picObjList.size())
minPri = ((PictureObject *)_picObjList.back())->_priority - 1;