diff options
author | Paul Gilbert | 2016-03-31 22:31:13 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-31 22:31:13 -0400 |
commit | 5923ee5001af91d1ca9294b1fead56ec04ece7df (patch) | |
tree | 1b8de45ef0c15ed0e12019f4add3e686a530ef74 | |
parent | 7d819f71f7d9fdd794b12ac55bd2177f12069c1b (diff) | |
download | scummvm-rg350-5923ee5001af91d1ca9294b1fead56ec04ece7df.tar.gz scummvm-rg350-5923ee5001af91d1ca9294b1fead56ec04ece7df.tar.bz2 scummvm-rg350-5923ee5001af91d1ca9294b1fead56ec04ece7df.zip |
TITANIC: Implement CPetFrame::setArea
-rw-r--r-- | engines/titanic/files_manager.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game_state.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/game_state.h | 2 | ||||
-rw-r--r-- | engines/titanic/input_handler.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_element.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.cpp | 27 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.h | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.cpp | 8 |
10 files changed, 38 insertions, 26 deletions
diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 5db75cd67c..617b71b06a 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -76,7 +76,7 @@ void CFilesManager::debug(CScreenManager *screenManager) { void CFilesManager::resetView() { if (_gameManager) { - _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->_gameState.setMode(GSMODE_SELECTED); _gameManager->initBounds(); } } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index d191d982b0..cef8ed9abb 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -45,7 +45,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _petActive(false), + _field8(0), _fieldC(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), _field1C(0), _field20(0), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } @@ -157,7 +157,7 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { void CGameState::checkForViewChange() { if (_mode == GSMODE_2 && _movieList.clear()) { - setMode(GSMODE_1); + setMode(GSMODE_SELECTED); if (_movieList._view) enterView(); } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 49180aa38c..ec6ef44422 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -33,7 +33,7 @@ namespace Titanic { class CGameManager; -enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; +enum GameStateMode { GSMODE_UNSELECTED = 0, GSMODE_SELECTED = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; PTR_LIST_ITEM(CMovie); class CGameStateMovieList : public List<CMovieListItem> { diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 2eb4427a46..8323531a1f 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -50,7 +50,7 @@ void CInputHandler::decLockCount() { void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { - if (_gameManager->_gameState._mode == GSMODE_1) { + if (_gameManager->_gameState._mode == GSMODE_SELECTED) { processMessage(&msg); } else if (!msg.isMouseMsg()) { g_vm->_filesManager.loadDrive(); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6abe83bd3f..5b8cba341a 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -68,7 +68,7 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); _inputAllowed = true; - _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->_gameState.setMode(GSMODE_SELECTED); // TODO: Cursor/image @@ -123,7 +123,7 @@ void CMainGameWindow::draw() { scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds); switch (_gameManager->_gameState._mode) { - case GSMODE_1: + case GSMODE_SELECTED: case GSMODE_2: if (_gameManager->_gameState._petActive) drawPet(scrManager); diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 39d8fea7d9..a4c5b271a0 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -26,7 +26,7 @@ namespace Titanic { -CPetElement::CPetElement() : _mode(MODE_0) {} +CPetElement::CPetElement() : _mode(MODE_UNSELECTED) {} void CPetElement::getBounds(Rect *rect) { if (rect) @@ -36,14 +36,14 @@ void CPetElement::getBounds(Rect *rect) { bool CPetElement::proc6(const Common::Point &pt) { bool result = _bounds.contains(pt); if (result) - setMode(MODE_1); + setMode(MODE_SELECTED); return result; } bool CPetElement::proc7(const Common::Point &pt) { bool result = _bounds.contains(pt); if (result) - setMode(MODE_0); + setMode(MODE_UNSELECTED); return result; } @@ -93,7 +93,7 @@ int CPetElement::proc15() { } void CPetElement::setMode(PetElementMode newMode) { - if (newMode >= MODE_0 && newMode <= MODE_2) + if (newMode >= MODE_UNSELECTED && newMode <= MODE_2) changeMode(newMode); } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index c6b0054ca6..fdb8ca5e56 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -29,7 +29,7 @@ namespace Titanic { -enum PetElementMode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2 }; +enum PetElementMode { MODE_UNSELECTED = 0, MODE_SELECTED = 1, MODE_2 = 2 }; class CGameObject; class CPetControl; diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 48a05cdd11..def6bca8e1 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -42,22 +42,22 @@ bool CPetFrame::setup(CPetControl *petControl) { bool CPetFrame::setup() { if (_petControl) { - _background.setup("PetBackground", _petControl, MODE_0); - _modeBackground.setup("PetModeBackground", _petControl, MODE_0); + _background.setup("PetBackground", _petControl, MODE_UNSELECTED); + _modeBackground.setup("PetModeBackground", _petControl, MODE_UNSELECTED); for (int idx = 0; idx < 5; ++idx) { CString resName = Common::String::format("PetMode%d", idx); - _modeButtons[idx].setup(resName, _petControl, MODE_0); + _modeButtons[idx].setup(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 6; ++idx) { CString resName = Common::String::format("3Pettitle%d", idx); - _titles[idx].setup(resName, _petControl, MODE_0); + _titles[idx].setup(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 7; ++idx) { CString resName = Common::String::format("PetIndent%d", idx); - _titles[idx].setup(resName, _petControl, MODE_0); + _indent[idx].setup(resName, _petControl, MODE_UNSELECTED); } } @@ -67,8 +67,8 @@ bool CPetFrame::setup() { bool CPetFrame::isValid(CPetControl *petControl) { bool result = setPetControl(petControl); if (result) { - _modeButtons[_indexes[0]].setMode(MODE_0); - _modeButtons[_indexes[4]].setMode(MODE_1); + _modeButtons[_indexes[0]].setMode(MODE_UNSELECTED); + _modeButtons[_indexes[4]].setMode(MODE_SELECTED); } return result; @@ -98,12 +98,12 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { _modeButtons[idx].setBounds(r); _modeButtons[idx].translate(0, YLIST[idx]); } - _modeButtons[_indexes[0]].setMode(MODE_1); + _modeButtons[_indexes[0]].setMode(MODE_SELECTED); const int XLIST[] = { 73, 54, 85, 109, 38, 71 }; for (int idx = 0; idx < 6; ++idx) { _titles[idx].setBounds(Rect(0, 0, 110, 11)); - _titles[idx].translate(XLIST[idx], 471); + _titles[idx].translate(600 - XLIST[idx], 471); } } @@ -111,7 +111,14 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { } void CPetFrame::setArea(PetArea newArea) { - warning("TODO: CPetFrame::setArea"); + resetArea(); + if (newArea < PET_6) + _modeButtons[_indexes[newArea]].setMode(MODE_SELECTED); +} + +void CPetFrame::resetArea() { + for (int idx = 0; idx < 6; ++idx) + _modeButtons[idx].setMode(MODE_UNSELECTED); } void CPetFrame::drawFrame(CScreenManager *screenManager) { diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 2bf9f2ace4..683f629db6 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -77,6 +77,11 @@ public: void setArea(PetArea newArea); /** + * Reset the currently selected area + */ + void resetArea(); + + /** * Draws the PET frame */ void drawFrame(CScreenManager *screenManager); diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 616db72377..7f249f0c2d 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -30,10 +30,10 @@ namespace Titanic { void CPetGfxElement::setup(PetElementMode mode, const CString &name, CPetControl *petControl) { switch (mode) { - case MODE_0: + case MODE_UNSELECTED: _object0 = petControl->getHiddenObject(name); break; - case MODE_1: + case MODE_SELECTED: _object1 = petControl->getHiddenObject(name); break; case MODE_2: @@ -91,9 +91,9 @@ void CPetGfxElement::getBounds(Rect *rect) { CGameObject *CPetGfxElement::getObject() const { switch (_mode) { - case MODE_0: + case MODE_UNSELECTED: return _object0; - case MODE_1: + case MODE_SELECTED: return _object1; case MODE_2: return _object2; |