[Scummvm-git-logs] scummvm master -> 59243928e74196f2c896b654dfb20526249246d1
dreammaster
dreammaster at scummvm.org
Sun Jun 25 18:27:00 CEST 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:
59243928e7 TITANIC: Adding support for German PET's extra Translation area
Commit: 59243928e74196f2c896b654dfb20526249246d1
https://github.com/scummvm/scummvm/commit/59243928e74196f2c896b654dfb20526249246d1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-06-25T12:26:47-04:00
Commit Message:
TITANIC: Adding support for German PET's extra Translation area
Changed paths:
engines/titanic/pet_control/pet_control.cpp
engines/titanic/pet_control/pet_frame.cpp
engines/titanic/pet_control/pet_frame.h
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 402ed22..7ce2e98 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 e8244cf..de84668 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 720112c..9f28289 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;
More information about the Scummvm-git-logs
mailing list