[Scummvm-git-logs] scummvm master -> 61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8

dreammaster dreammaster at scummvm.org
Sun Jan 15 00:19:24 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
61db7190a3 TITANIC: Clarify dirty rect methods in CGameManager


Commit: 61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8
    https://github.com/scummvm/scummvm/commit/61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-14T18:19:12-05:00

Commit Message:
TITANIC: Clarify dirty rect methods in CGameManager

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/debugger.cpp
    engines/titanic/game_manager.cpp
    engines/titanic/game_manager.h
    engines/titanic/game_view.cpp
    engines/titanic/main_game_window.cpp
    engines/titanic/support/files_manager.cpp


diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 3e1cb08..2b32796 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -425,7 +425,7 @@ void CGameObject::processMoveRangeInfo() {
 void CGameObject::makeDirty(const Rect &r) {
 	CGameManager *gameManager = getGameManager();
 	if (gameManager)
-		gameManager->extendBounds(r);
+		gameManager->addDirtyRect(r);
 }
 
 void CGameObject::makeDirty() {
@@ -581,7 +581,7 @@ void CGameObject::petShow() {
 	if (gameManager) {
 		gameManager->_gameState._petActive = true;
 		gameManager->_gameState.setMode(GSMODE_INTERACTIVE);
-		gameManager->initBounds();
+		gameManager->markAllDirty();
 	}
 }
 
@@ -590,7 +590,7 @@ void CGameObject::petHide() {
 	if (gameManager) {
 		gameManager->_gameState._petActive = false;
 		gameManager->_gameState.setMode(GSMODE_INTERACTIVE);
-		gameManager->initBounds();
+		gameManager->markAllDirty();
 	}
 }
 
diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp
index 5d95ef5..e0c0207 100644
--- a/engines/titanic/debugger.cpp
+++ b/engines/titanic/debugger.cpp
@@ -197,7 +197,7 @@ bool Debugger::cmdPET(int argc, const char **argv) {
 
 		if (s == "on") {
 			gameState._petActive = true;
-			gameManager.initBounds();
+			gameManager.markAllDirty();
 			debugPrintf("PET is now on\n");
 			return true;
 		} else if (s == "off") {
@@ -251,7 +251,7 @@ bool Debugger::cmdItem(int argc, const char **argv) {
 		} else if (CString(argv[2]) == "add") {
 			// Ensure the PET is active and add the item to the inventory
 			gameState._petActive = true;
-			gameManager.initBounds();
+			gameManager.markAllDirty();
 			item->petAddToInventory();
 
 			return false;
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index fb05705..96aeda1 100644
--- a/engines/titanic/game_manager.cpp
+++ b/engines/titanic/game_manager.cpp
@@ -126,10 +126,6 @@ void CGameManager::postSave() {
 	_sound.postSave();
 }
 
-void CGameManager::initBounds() {
-	_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
-}
-
 void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) {
 	delete _movie;
 	_movie = nullptr;
@@ -271,7 +267,7 @@ void CGameManager::viewChange() {
 	for (CTreeItem *treeItem = _project; treeItem; treeItem = treeItem->scan(_project))
 		treeItem->viewChange();
 
-	initBounds();
+	markAllDirty();
 }
 
 void CGameManager::frameMessage(CRoomItem *room) {
@@ -292,13 +288,17 @@ void CGameManager::frameMessage(CRoomItem *room) {
 	}
 }
 
-void CGameManager::extendBounds(const Rect &r) {
+void CGameManager::addDirtyRect(const Rect &r) {
 	if (_bounds.isEmpty())
 		_bounds = r;
 	else
 		_bounds.combine(r);
 }
 
+void CGameManager::markAllDirty() {
+	_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+}
+
 CScreenManager *CGameManager::setScreenManager() const {
 	return CScreenManager::setCurrent();
 }
diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h
index 47c2cc8..9c533cf 100644
--- a/engines/titanic/game_manager.h
+++ b/engines/titanic/game_manager.h
@@ -147,11 +147,6 @@ public:
 	void unlockInputHandler() { _inputHandler.decLockCount(); }
 
 	/**
-	 * Set default screen bounds
-	 */
-	void initBounds();
-
-	/**
 	 * Plays a movie clip
 	 */
 	void playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom);
@@ -182,10 +177,15 @@ public:
 	void decTransitions() { --_transitionCtr; }
 
 	/**
-	 * Extends the bounds of the currently affected game display area
-	 * to include the passed rect
+	 * Extends the bounds of the currently dirty area of the
+	 * game screen to include the specified area
+	 */
+	void addDirtyRect(const Rect &r);
+
+	/**
+	 * Marks the entire screen as dirty, requiring redraw
 	 */
-	void extendBounds(const Rect &r);
+	void markAllDirty();
 
 	/**
 	 * Set and return the current screen manager
diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp
index d155812..550d665 100644
--- a/engines/titanic/game_view.cpp
+++ b/engines/titanic/game_view.cpp
@@ -55,7 +55,7 @@ void CGameView::deleteView(int roomNumber, int nodeNumber, int viewNumber) {
 
 void CGameView::createSurface(const CResourceKey &key) {
 	// Reset any current view surface
-	_gameManager->initBounds();
+	_gameManager->markAllDirty();
 	delete _surface;
 	_surface = nullptr;
 
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 1024589..9d3defb 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -96,7 +96,7 @@ void CMainGameWindow::applicationStarting() {
 	CEnterRoomMsg enterRoomMsg(nullptr, room);
 	enterRoomMsg.execute(room, nullptr, MSGFLAG_SCAN);
 
-	_gameManager->initBounds();
+	_gameManager->markAllDirty();
 }
 
 int CMainGameWindow::getSavegameSlot() {
diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp
index 2882b8d..fc09c57 100644
--- a/engines/titanic/support/files_manager.cpp
+++ b/engines/titanic/support/files_manager.cpp
@@ -113,7 +113,7 @@ void CFilesManager::insertCD(CScreenManager *screenManager) {
 void CFilesManager::resetView() {
 	if (_gameManager) {
 		_gameManager->_gameState.setMode(GSMODE_INTERACTIVE);
-		_gameManager->initBounds();
+		_gameManager->markAllDirty();
 	}
 }
 





More information about the Scummvm-git-logs mailing list