[Scummvm-git-logs] scummvm master -> bceeee08d0c8a0d83ad432bbc00e6ddc72438fff
sev-
sev at scummvm.org
Tue Sep 27 22:55:28 CEST 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5de239e3c6 FULLPIPE: Revert to original bubble sort algorithm for scene objects
bceeee08d0 FULLPIPE: Fix counter in Scene::objectList_sortByPriority
Commit: 5de239e3c631943c37f3de959116e9749efa6098
https://github.com/scummvm/scummvm/commit/5de239e3c631943c37f3de959116e9749efa6098
Author: Retro-Junk (bambarbee at yandex.ru)
Date: 2016-09-27T22:55:00+02:00
Commit Message:
FULLPIPE: Revert to original bubble sort algorithm for scene objects
Changed paths:
engines/fullpipe/scene.cpp
engines/fullpipe/scene.h
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index cba688a..b03540a 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;
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index 1e2dae8..5ff2407 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -81,9 +81,14 @@ class Scene : public Background {
void stopAllSounds();
private:
+#if 0
static bool compareObjPriority(const void *p1, const void *p2);
void objectList_sortByPriority(Common::Array<StaticANIObject *> &list, bool skipFirst = false);
void objectList_sortByPriority(Common::Array<PictureObject *> &list, bool skipFirst = false);
+#else
+ template<typename T>
+ void objectList_sortByPriority(Common::Array<T*> &list, int startIndex = 0);
+#endif
};
class SceneTag : public CObject {
Commit: bceeee08d0c8a0d83ad432bbc00e6ddc72438fff
https://github.com/scummvm/scummvm/commit/bceeee08d0c8a0d83ad432bbc00e6ddc72438fff
Author: Retro-Junk (bambarbee at yandex.ru)
Date: 2016-09-27T22:55:12+02:00
Commit Message:
FULLPIPE: Fix counter in Scene::objectList_sortByPriority
Changed paths:
engines/fullpipe/scene.cpp
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index b03540a..abbb90d 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -509,7 +509,6 @@ 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;
@@ -524,7 +523,7 @@ void Scene::objectList_sortByPriority(Common::Array<T *> &list, int startIndex)
} else
refElement = curElement;
}
- count--;
+ lastIndex--;
} while (changed);
}
}
More information about the Scummvm-git-logs
mailing list