diff options
author | Paul Gilbert | 2017-06-25 12:26:47 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-06-25 12:26:47 -0400 |
commit | 59243928e74196f2c896b654dfb20526249246d1 (patch) | |
tree | f1767709df680c0197cec09a30705b90cca735c9 /engines | |
parent | ffc707ff0566ec0fd7a4ef4b4b7da12d4cee4751 (diff) | |
download | scummvm-rg350-59243928e74196f2c896b654dfb20526249246d1.tar.gz scummvm-rg350-59243928e74196f2c896b654dfb20526249246d1.tar.bz2 scummvm-rg350-59243928e74196f2c896b654dfb20526249246d1.zip |
TITANIC: Adding support for German PET's extra Translation area
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.cpp | 48 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.h | 3 |
3 files changed, 41 insertions, 18 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 402ed22719..7ce2e988d2 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -357,10 +357,16 @@ bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { result = true; setArea(PET_ROOMS); break; - case Common::KEYCODE_F5: + case Common::KEYCODE_F6: result = true; setArea(PET_REAL_LIFE); break; + case Common::KEYCODE_F8: + if (g_vm->isGerman()) { + result = true; + setArea(PET_TRANSLATION); + } + break; default: break; } diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index e8244cf2d7..de8466858e 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -22,14 +22,21 @@ #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/titanic.h" namespace Titanic { -static const PetArea PET_AREAS[6] = { +static const PetArea PET_AREAS_EN[5] = { PET_CONVERSATION, PET_INVENTORY, PET_REMOTE, - PET_ROOMS, PET_REAL_LIFE, PET_STARFIELD + PET_ROOMS, PET_REAL_LIFE }; +static const PetArea PET_AREAS_DE[6] = { + PET_CONVERSATION, PET_TRANSLATION, PET_INVENTORY, PET_REMOTE, + PET_ROOMS, PET_REAL_LIFE +}; + + CPetFrame::CPetFrame() : CPetSection() { } @@ -44,12 +51,12 @@ bool CPetFrame::reset() { _background.reset("PetBackground", _petControl, MODE_UNSELECTED); _modeBackground.reset("PetModeBackground", _petControl, MODE_UNSELECTED); - for (int idx = 0; idx < 5; ++idx) { + for (uint idx = 0; idx < _petAreas.size(); ++idx) { CString resName = Common::String::format("PetMode%d", idx + 1); _modeButtons[idx].reset(resName, _petControl, MODE_SELECTED); } - for (int idx = 0; idx < 6; ++idx) { + for (uint idx = 0; idx < _petAreas.size(); ++idx) { CString resName = Common::String::format("3Pettitle%d", idx + 1); _titles[idx].reset(resName, _petControl, MODE_UNSELECTED); } @@ -64,9 +71,9 @@ bool CPetFrame::reset() { } bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - for (int idx = 0; idx < 5; ++idx) { + for (uint idx = 0; idx < _petAreas.size(); ++idx) { if (_modeButtons[idx].MouseButtonUpMsg(msg->_mousePos)) { - _petControl->setArea(PET_AREAS[idx]); + _petControl->setArea(_petAreas[idx]); resetArea(); _modeButtons[idx].setMode(MODE_SELECTED); return true; @@ -79,8 +86,8 @@ bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CPetFrame::isValid(CPetControl *petControl) { bool result = setPetControl(petControl); if (result) { - _modeButtons[PET_AREAS[0]].setMode(MODE_UNSELECTED); - _modeButtons[PET_AREAS[4]].setMode(MODE_SELECTED); + _modeButtons[PET_CONVERSATION].setMode(MODE_UNSELECTED); + _modeButtons[PET_REAL_LIFE].setMode(MODE_SELECTED); } return result; @@ -94,6 +101,13 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; + // Set up the PET areas we'll have buttons for + _petAreas.clear(); + if (g_vm->isGerman()) + _petAreas.assign(&PET_AREAS_DE[0], &PET_AREAS_DE[0] + 6); + else + _petAreas.assign(&PET_AREAS_EN[0], &PET_AREAS_EN[0] + 5); + // Set the bounds of the individual elements _background.setBounds(Rect(20, 350, 620, 480)); _modeBackground.setBounds(Rect(590, 365, 611, 467)); @@ -107,12 +121,14 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { // Draw the mode buttons vertically on the right edge of the PET r = Rect(590, 365, 606, 381); - const int YLIST[] = { 7, 27, 45, 66, 84 }; - for (int idx = 0; idx < 5; ++idx) { + const int YLIST_EN[] = { 7, 27, 45, 66, 84 }; + const int YLIST_DE[] = { 0, 18, 36, 51, 67, 84 }; + _modeButtons.resize(_petAreas.size()); + for (uint idx = 0; idx < _modeButtons.size(); ++idx) { _modeButtons[idx].setBounds(r); - _modeButtons[idx].translate(4, YLIST[idx]); + _modeButtons[idx].translate(4, g_vm->isGerman() ? YLIST_DE[idx] : YLIST_EN[idx]); } - _modeButtons[PET_AREAS[0]].setMode(MODE_SELECTED); + _modeButtons[PET_CONVERSATION].setMode(MODE_SELECTED); const int XLIST[] = { 73, 54, 85, 109, 38, 71 }; for (int idx = 0; idx < 6; ++idx) { @@ -126,12 +142,12 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { void CPetFrame::setArea(PetArea newArea) { resetArea(); - if (newArea < PET_TRANSLATION) - _modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED); + if ((uint)newArea < (_petAreas.size() - 1)) + _modeButtons[_petAreas[newArea]].setMode(MODE_SELECTED); } void CPetFrame::resetArea() { - for (int idx = 0; idx < 6; ++idx) + for (uint idx = 0; idx < _modeButtons.size(); ++idx) _modeButtons[idx].setMode(MODE_UNSELECTED); } @@ -139,7 +155,7 @@ void CPetFrame::drawFrame(CScreenManager *screenManager) { _background.draw(screenManager); _modeBackground.draw(screenManager); - for (int idx = 0; idx < 5; ++idx) + for (uint idx = 0; idx < _modeButtons.size(); ++idx) _modeButtons[idx].draw(screenManager); _titles[_petControl->_currentArea].draw(screenManager); diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 720112c1c0..9f28289964 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -34,7 +34,8 @@ namespace Titanic { */ class CPetFrame : public CPetSection { private: - CPetGfxElement _modeButtons[6]; + Common::Array<PetArea> _petAreas; + Common::Array<CPetGfxElement> _modeButtons; CPetGfxElement _titles[6]; CPetGfxElement _modeBackground; CPetGfxElement _val2; |