aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-12-09 10:13:06 +1100
committerPaul Gilbert2011-12-09 10:13:06 +1100
commita2da8e6b397a76e2efef41b4d07b1baef78a6abc (patch)
tree29270a24ce19a6f46b160f9ba566a11462a7dde3
parenta668c33cd3349886f486e148b91d7fe05309e084 (diff)
downloadscummvm-rg350-a2da8e6b397a76e2efef41b4d07b1baef78a6abc.tar.gz
scummvm-rg350-a2da8e6b397a76e2efef41b4d07b1baef78a6abc.tar.bz2
scummvm-rg350-a2da8e6b397a76e2efef41b4d07b1baef78a6abc.zip
TSAGE: Got rid of goto in TsAGE engine.
-rw-r--r--engines/tsage/core.cpp75
1 files changed, 40 insertions, 35 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index eb7c734074..88121c4d16 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2661,43 +2661,48 @@ void SceneObjectList::draw() {
}
g_globals->_paneRegions[paneNum].setRect(0, 0, 0, 0);
-redraw:
- // Main draw loop
- for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
- SceneObject *obj = objList[objIndex];
-
- if ((obj->_flags & flagMask) && !(obj->_flags & OBJFLAG_HIDE)) {
- obj->_paneRects[paneNum] = obj->_bounds;
- obj->draw();
+
+ // FIXME: Currently, removing objects causes screen flickers when the removed object intersects
+ // another drawn object, since the background is briefly redrawn over the object. For now, I'm
+ // using a forced jump back to redraw objects. In the long term, I should figure out how the
+ // original game does this properly
+ bool redrawFlag = true;
+ while (redrawFlag) {
+ redrawFlag = false;
+
+ // Main draw loop
+ for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
+ SceneObject *obj = objList[objIndex];
+
+ if ((obj->_flags & flagMask) && !(obj->_flags & OBJFLAG_HIDE)) {
+ obj->_paneRects[paneNum] = obj->_bounds;
+ obj->draw();
+ }
}
- }
- // Update the palette
- g_globals->_sceneManager.fadeInIfNecessary();
- g_globals->_sceneManager._loadMode = 0;
- g_globals->_paneRefreshFlag[paneNum] = 0;
-
- // Loop through the object list, removing any objects and refreshing the screen as necessary
- for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
- SceneObject *obj = objList[objIndex];
-
- if (obj->_flags & OBJFLAG_HIDE)
- obj->_flags |= OBJFLAG_HIDING;
- obj->_flags &= ~flagMask;
- if (obj->_flags & OBJFLAG_REMOVE) {
- obj->_flags |= OBJFLAG_PANES;
-
- checkIntersection(objList, objIndex, CURRENT_PANENUM);
-
- obj->updateScreen();
- obj->removeObject();
-
- // FIXME: Currently, removing objects causes screen flickers when the removed object intersects
- // another drawn object, since the background is briefly redrawn over the object. For now, I'm
- // using a forced jump back to redraw objects. In the long term, I should figure out how the
- // original game does this properly
- objList.remove_at(objIndex);
- goto redraw;
+ // Update the palette
+ g_globals->_sceneManager.fadeInIfNecessary();
+ g_globals->_sceneManager._loadMode = 0;
+ g_globals->_paneRefreshFlag[paneNum] = 0;
+
+ // Loop through the object list, removing any objects and refreshing the screen as necessary
+ for (uint objIndex = 0; objIndex < objList.size() && !redrawFlag; ++objIndex) {
+ SceneObject *obj = objList[objIndex];
+
+ if (obj->_flags & OBJFLAG_HIDE)
+ obj->_flags |= OBJFLAG_HIDING;
+ obj->_flags &= ~flagMask;
+ if (obj->_flags & OBJFLAG_REMOVE) {
+ obj->_flags |= OBJFLAG_PANES;
+
+ checkIntersection(objList, objIndex, CURRENT_PANENUM);
+
+ obj->updateScreen();
+ obj->removeObject();
+
+ objList.remove_at(objIndex);
+ redrawFlag = true;
+ }
}
}
}