diff options
| -rw-r--r-- | engines/tsage/core.cpp | 75 | 
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; +				}  			}  		}  	} | 
