diff options
Diffstat (limited to 'engines/titanic/pet_control')
-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 |
5 files changed, 31 insertions, 19 deletions
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; |