aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-14 18:19:12 -0500
committerPaul Gilbert2017-01-14 18:19:12 -0500
commit61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8 (patch)
treef6fbe099ad359b98330bc1e1297697ed7559192e /engines/titanic
parent4510c3ec270ccbaff0a29437ba8c211839f76e57 (diff)
downloadscummvm-rg350-61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8.tar.gz
scummvm-rg350-61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8.tar.bz2
scummvm-rg350-61db7190a36ca531a5d5cd0d7d085f7cb47b4dd8.zip
TITANIC: Clarify dirty rect methods in CGameManager
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp6
-rw-r--r--engines/titanic/debugger.cpp4
-rw-r--r--engines/titanic/game_manager.cpp12
-rw-r--r--engines/titanic/game_manager.h16
-rw-r--r--engines/titanic/game_view.cpp2
-rw-r--r--engines/titanic/main_game_window.cpp2
-rw-r--r--engines/titanic/support/files_manager.cpp2
7 files changed, 22 insertions, 22 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 3e1cb0858c..2b327960fe 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 5d95ef5186..e0c0207ee4 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 fb05705347..96aeda1b83 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 47c2cc8445..9c533cf6ac 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 d155812390..550d66555c 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 102458969e..9d3defbac9 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 2882b8da85..fc09c5702c 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();
}
}