diff options
author | Paul Gilbert | 2016-09-11 11:34:06 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-09-11 11:34:06 -0400 |
commit | 207afb6f462fadbe48d4ec298ce7c30ea5c874f0 (patch) | |
tree | cbb200af7f34a2fd6feebda5418328b58bc0dcf4 /engines | |
parent | df4dadb5a6354d5962597d27a117a9fe53b35891 (diff) | |
download | scummvm-rg350-207afb6f462fadbe48d4ec298ce7c30ea5c874f0.tar.gz scummvm-rg350-207afb6f462fadbe48d4ec298ce7c30ea5c874f0.tar.bz2 scummvm-rg350-207afb6f462fadbe48d4ec298ce7c30ea5c874f0.zip |
TITANIC: In progress work on German Translation view in PET
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/module.mk | 3 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 14 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_frame.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_show_translation.cpp | 128 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_show_translation.h | 57 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_text.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_text.h | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_translation.cpp | 23 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_translation.h | 19 | ||||
-rw-r--r-- | engines/titanic/support/strings.h | 51 |
13 files changed, 313 insertions, 24 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index d74f9a26ef..f84ca23c5f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -385,6 +385,8 @@ #include "titanic/pet_control/pet_pannel1.h" #include "titanic/pet_control/pet_pannel2.h" #include "titanic/pet_control/pet_pannel3.h" +#include "titanic/pet_control/pet_show_translation.h" +#include "titanic/pet_control/pet_translation.h" #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" @@ -738,6 +740,7 @@ DEFFN(CPetModePanel); DEFFN(CPetPannel1); DEFFN(CPetPannel2); DEFFN(CPetPannel3); +DEFFN(CPetShowTranslation); DEFFN(CSendToSucc); DEFFN(CSGTSelector); DEFFN(CSliderButton); @@ -1328,6 +1331,7 @@ void CSaveableObject::initClassList() { ADDFN(CPetPannel1, CPetGraphic); ADDFN(CPetPannel2, CPetGraphic); ADDFN(CPetPannel3, CPetGraphic); + ADDFN(CPetShowTranslation, CGameObject); ADDFN(CSendToSucc, CToggleSwitch); ADDFN(CSGTSelector, CPetGraphic); ADDFN(CSliderButton, CSTButton); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 798d81dbe5..377a22fbf8 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -372,7 +372,6 @@ MODULE_OBJS := \ pet_control/pet_gfx_element.o \ pet_control/pet_inventory.o \ pet_control/pet_inventory_glyphs.o \ - pet_control/pet_message.o \ pet_control/pet_starfield.o \ pet_control/pet_real_life.o \ pet_control/pet_remote.o \ @@ -380,6 +379,7 @@ MODULE_OBJS := \ pet_control/pet_rooms.o \ pet_control/pet_rooms_glyphs.o \ pet_control/pet_section.o \ + pet_control/pet_translation.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ @@ -395,6 +395,7 @@ MODULE_OBJS := \ pet_control/pet_pannel3.o \ pet_control/pet_quit.o \ pet_control/pet_save.o \ + pet_control/pet_show_translation.o \ pet_control/pet_slider.o \ pet_control/pet_sound.o \ pet_control/pet_text.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 2ab30af5de..95438ce81e 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -52,7 +52,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_ROOMS] = &_rooms; _sections[PET_REAL_LIFE] = &_realLife; _sections[PET_STARFIELD] = &_starfield; - _sections[PET_MESSAGE] = &_message; + _sections[PET_TRANSLATION] = &_translation; } void CPetControl::save(SimpleFile *file, int indent) { @@ -87,7 +87,7 @@ void CPetControl::setup() { _inventory.setup(this); _starfield.setup(this); _realLife.setup(this); - _message.setup(this); + _translation.setup(this); _frame.setup(this); } @@ -98,7 +98,7 @@ bool CPetControl::isValid() { _inventory.isValid(this) && _starfield.isValid(this) && _realLife.isValid(this) && - _message.isValid(this) && + _translation.isValid(this) && _frame.isValid(this); } @@ -109,7 +109,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _inventory.load(file, param); _starfield.load(file, param); _realLife.load(file, param); - _message.load(file, param); + _translation.load(file, param); _frame.load(file, param); } @@ -120,7 +120,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) { _inventory.save(file, indent); _starfield.save(file, indent); _realLife.save(file, indent); - _message.save(file, indent); + _translation.save(file, indent); _frame.save(file, indent); } @@ -165,7 +165,7 @@ void CPetControl::loaded() { _inventory.postLoad(); _starfield.postLoad(); _realLife.postLoad(); - _message.postLoad(); + _translation.postLoad(); _frame.postLoad(); } @@ -386,6 +386,15 @@ void CPetControl::displayMessage(const CString &str, int param) const { _sections[_currentArea]->displayMessage(msg); } +void CPetControl::addTranslation(StringId id1, StringId id2) { + setArea(PET_TRANSLATION); + _translation.addTranslation(_strings[id1], _strings[id2]); +} + +void CPetControl::clearTranslation() { + _translation.clearTranslation(); +} + CGameObject *CPetControl::getFirstObject() const { return dynamic_cast<CGameObject *>(getFirstChild()); } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index c4b65457e2..454fc0991b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -31,7 +31,7 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory.h" -#include "titanic/pet_control/pet_message.h" +#include "titanic/pet_control/pet_translation.h" #include "titanic/pet_control/pet_starfield.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" @@ -61,7 +61,7 @@ private: CPetRemote _remote; CPetRooms _rooms; CPetRealLife _realLife; - CPetMessage _message; + CPetTranslation _translation; CPetFrame _frame; CString _activeNPCName; CString _remoteTargetName; @@ -242,6 +242,16 @@ public: void displayMessage(const CString &str, int param = 0) const; /** + * Switches to the Translation display, and adds a line to it's content + */ + void addTranslation(StringId id1, StringId id2); + + /** + * Clears the translation display + */ + void clearTranslation(); + + /** * Get the first game object stored in the PET */ CGameObject *getFirstObject() const; diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index bc1a8e93b6..7375c69436 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -126,7 +126,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { void CPetFrame::setArea(PetArea newArea) { resetArea(); - if (newArea < PET_MESSAGE) + if (newArea < PET_TRANSLATION) _modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED); } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 8bc427e842..dc2f70b76f 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -30,7 +30,7 @@ namespace Titanic { enum PetArea { PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, - PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_STARFIELD = 5, PET_MESSAGE = 6 + PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_STARFIELD = 5, PET_TRANSLATION = 6 }; class CPetControl; diff --git a/engines/titanic/pet_control/pet_show_translation.cpp b/engines/titanic/pet_control/pet_show_translation.cpp new file mode 100644 index 0000000000..2a3b024324 --- /dev/null +++ b/engines/titanic/pet_control/pet_show_translation.cpp @@ -0,0 +1,128 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/pet_control/pet_show_translation.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +BEGIN_MESSAGE_MAP(CPetShowTranslation, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(ArboretumGateMsg) +END_MESSAGE_MAP() + + +void CPetShowTranslation::save(SimpleFile *file, int indent) { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetShowTranslation::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +bool CPetShowTranslation::EnterViewMsg(CEnterViewMsg *msg) { + CPetControl *pet = getPetControl(); + if (!pet) + return true; + + CString viewName = getFullViewName(); + CString nodeView = msg->_newView->getNodeViewName(); + + if (viewName == "Arboretum.Node 2.N" || viewName == "FrozenArboretum.Node 2.N") { + switch (stateGetSeason()) { + case SEASON_SUMMER: + pet->addTranslation(DE_SUMMER_ARBORETUM, DE_SUMMER); + break; + + case SEASON_AUTUMN: + pet->addTranslation(DE_AUTUMN_ARBORETUM, DE_AUTUMN); + break; + + case SEASON_WINTER: + pet->addTranslation(DE_WINTER_ARBORETUM, DE_WINTER); + break; + + case SEASON_SPRING: + pet->addTranslation(DE_SPRING_ARBORETUM, DE_SPRING); + break; + + default: + break; + } + + pet->addTranslation(DE_ARBORETUM_MSG1, DE_ARBORETUM_MSG2); + } else if (compareRoomNameTo("Bridge")) { + if (nodeView == "Node 3.N") { + pet->addTranslation(DE_BRIDGE_MSG1, DE_BRIDGE_MSG2); + pet->addTranslation(DE_BRIDGE_MSG3, DE_BRIDGE_MSG4); + pet->addTranslation(DE_BRIDGE_MSG5, DE_BRIDGE_MSG6); + pet->addTranslation(DE_BRIDGE_MSG7, DE_BRIDGE_MSG8); + } else if (nodeView == "Node 4.N") { + pet->addTranslation(DE_BRIDGE_MSG9, DE_BRIDGE_MSG10); + } + } else if (compareRoomNameTo("PromenadeDeck")) { + if (nodeView == "Node 2.S") { + pet->addTranslation(DE_PROMENADE_DECK_MSG1, DE_PROMENADE_DECK_MSG2); + pet->addTranslation(DE_PROMENADE_DECK_MSG3, DE_PROMENADE_DECK_MSG4); + pet->addTranslation(DE_PROMENADE_DECK_MSG5, DE_PROMENADE_DECK_MSG6); + pet->addTranslation(DE_PROMENADE_DECK_MSG7, DE_PROMENADE_DECK_MSG8); + pet->addTranslation(DE_PROMENADE_DECK_MSG9, DE_PROMENADE_DECK_MSG10); + } + } else if (compareRoomNameTo("SgtLobby")) { + if (nodeView == "Node 17.S") { + pet->addTranslation(DE_SGTLOBBY_MSG1, DE_SGTLOBBY_MSG2); + pet->addTranslation(DE_SGTLOBBY_MSG3, DE_SGTLOBBY_MSG4); + pet->addTranslation(DE_SGTLOBBY_MSG5, DE_SGTLOBBY_MSG6); + pet->addTranslation(DE_SGTLOBBY_MSG7, DE_SGTLOBBY_MSG8); + } + } else if (compareRoomNameTo("Titania")) { + if (nodeView == "Node 9.N") { + pet->addTranslation(DE_TITANIA_MSG1, DE_TITANIA_MSG2); + } else if (nodeView == "Node 10.N") { + pet->addTranslation(DE_TITANIA_MSG3, DE_TITANIA_MSG4); + } else if (nodeView == "Node 11.N") { + pet->addTranslation(DE_TITANIA_MSG5, DE_TITANIA_MSG6); + } else if (nodeView == "Node 13.N") { + pet->addTranslation(DE_TITANIA_MSG7, DE_TITANIA_MSG8); + } + } + + return true; +} + +bool CPetShowTranslation::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + +bool CPetShowTranslation::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + return true; +} + +bool CPetShowTranslation::ArboretumGateMsg(CArboretumGateMsg *msg) { + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_show_translation.h b/engines/titanic/pet_control/pet_show_translation.h new file mode 100644 index 0000000000..cef9708616 --- /dev/null +++ b/engines/titanic/pet_control/pet_show_translation.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_PET_SHOW_TRANSLATION_H +#define TITANIC_PET_SHOW_TRANSLATION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +/** + * Used by the German version to show contextual translation of + * English background text throughout the game + */ +class CPetShowTranslation: public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool ArboretumGateMsg(CArboretumGateMsg *msg); +public: + CLASSDEF; + CPetShowTranslation() : CGameObject() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SHOW_TRANSLATION_H */ diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 32a6a9af57..2c20396cd9 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -61,6 +61,11 @@ void CPetText::setLineColor(uint lineNum, uint col) { } void CPetText::setLineColor(uint lineNum, byte r, byte g, byte b) { + _array[lineNum]._rgb = getColorText(r, g, b); + _stringsMerged = false; +} + +CString CPetText::getColorText(byte r, byte g, byte b) { char buffer[6]; if (!r) r = 1; @@ -75,9 +80,8 @@ void CPetText::setLineColor(uint lineNum, byte r, byte g, byte b) { buffer[3] = b; buffer[4] = TEXTCMD_SET_COLOR; buffer[5] = '\0'; - _array[lineNum]._rgb = buffer; - _stringsMerged = false; + return CString(buffer); } void CPetText::load(SimpleFile *file, int param) { diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index ba199a3ae5..0a6bb2d03d 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -151,6 +151,11 @@ public: void setLineColor(uint lineNum, byte r, byte g, byte b); /** + * Gets the text string representing a color encoding + */ + static CString getColorText(byte r, byte g, byte b); + + /** * Set the color for a line */ void setLineColor(uint lineNum, uint col); diff --git a/engines/titanic/pet_control/pet_translation.cpp b/engines/titanic/pet_control/pet_translation.cpp index 783c9019e2..fe6c37c8ab 100644 --- a/engines/titanic/pet_control/pet_translation.cpp +++ b/engines/titanic/pet_control/pet_translation.cpp @@ -20,11 +20,12 @@ * */ -#include "titanic/pet_control/pet_message.h" +#include "titanic/pet_control/pet_translation.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { -CPetMessage::CPetMessage() { +CPetTranslation::CPetTranslation() { Rect rect1(0, 0, 580, 70); rect1.translate(32, 368); _message.setBounds(rect1); @@ -37,21 +38,33 @@ CPetMessage::CPetMessage() { _tooltip.setHasBorder(false); } -bool CPetMessage::setup(CPetControl *petControl) { +bool CPetTranslation::setup(CPetControl *petControl) { if (petControl && setupControl(petControl)) return reset(); return false; } -void CPetMessage::draw(CScreenManager *screenManager) { +void CPetTranslation::draw(CScreenManager *screenManager) { _message.draw(screenManager); _tooltip.draw(screenManager); } -bool CPetMessage::setupControl(CPetControl *petControl) { +bool CPetTranslation::setupControl(CPetControl *petControl) { if (petControl) _petControl = petControl; return true; } +void CPetTranslation::clearTranslation() { + _message.setup(); +} + +void CPetTranslation::addTranslation(const CString &str1, const CString &str2) { + CString msg = CString::format("%s%s - %s%s", + CPetText::getColorText(0, 0x80, 0).c_str(), str1.c_str(), + CPetText::getColorText(0, 0, 0).c_str(), str2.c_str()); + _message.addLine(msg); + _petControl->makeDirty(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_translation.h b/engines/titanic/pet_control/pet_translation.h index 499f274c54..2fcc758b44 100644 --- a/engines/titanic/pet_control/pet_translation.h +++ b/engines/titanic/pet_control/pet_translation.h @@ -20,15 +20,15 @@ * */ -#ifndef TITANIC_PET_MESSAGE_H -#define TITANIC_PET_MESSAGE_H +#ifndef TITANIC_PET_TRANSLATION_H +#define TITANIC_PET_TRANSLATION_H #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_text.h" namespace Titanic { -class CPetMessage : public CPetSection { +class CPetTranslation : public CPetSection { private: CPetText _message; CPetText _tooltip; @@ -38,7 +38,7 @@ private: */ bool setupControl(CPetControl *petControl); public: - CPetMessage(); + CPetTranslation(); /** * Sets up the section @@ -89,8 +89,17 @@ public: */ virtual CPetText *getText() { return &_tooltip; } + /** + * Clear any current translation text + */ + void clearTranslation(); + + /** + * Adds a line to the translation display + */ + void addTranslation(const CString &str1, const CString &str2); }; } // End of namespace Titanic -#endif /* TITANIC_PET_MESSAGE_H */ +#endif /* TITANIC_PET_TRANSLATION_H */ diff --git a/engines/titanic/support/strings.h b/engines/titanic/support/strings.h index 1f7187bdee..5164897522 100644 --- a/engines/titanic/support/strings.h +++ b/engines/titanic/support/strings.h @@ -85,7 +85,56 @@ enum StringId { GO_WHERE, NICE_IF_TAKE_BUT_CANT, BOWL_OF_NUTS, - NOT_A_BOWL_OF_NUTS + NOT_A_BOWL_OF_NUTS, + + // German version only + DE_SUMMER, + DE_AUTUMN, + DE_WINTER, + DE_SPRING, + DE_SUMMER_ARBORETUM, + DE_AUTUMN_ARBORETUM, + DE_WINTER_ARBORETUM, + DE_SPRING_ARBORETUM, + DE_ARBORETUM_MSG1, + DE_ARBORETUM_MSG2, + DE_BRIDGE_MSG1, + DE_BRIDGE_MSG2, + DE_BRIDGE_MSG3, + DE_BRIDGE_MSG4, + DE_BRIDGE_MSG5, + DE_BRIDGE_MSG6, + DE_BRIDGE_MSG7, + DE_BRIDGE_MSG8, + DE_BRIDGE_MSG9, + DE_BRIDGE_MSG10, + DE_PROMENADE_DECK_MSG1, + DE_PROMENADE_DECK_MSG2, + DE_PROMENADE_DECK_MSG3, + DE_PROMENADE_DECK_MSG4, + DE_PROMENADE_DECK_MSG5, + DE_PROMENADE_DECK_MSG6, + DE_PROMENADE_DECK_MSG7, + DE_PROMENADE_DECK_MSG8, + DE_PROMENADE_DECK_MSG9, + DE_PROMENADE_DECK_MSG10, + DE_SGTLOBBY_MSG1, + DE_SGTLOBBY_MSG2, + DE_SGTLOBBY_MSG3, + DE_SGTLOBBY_MSG4, + DE_SGTLOBBY_MSG5, + DE_SGTLOBBY_MSG6, + DE_SGTLOBBY_MSG7, + DE_SGTLOBBY_MSG8, + DE_TITANIA_MSG1, + DE_TITANIA_MSG2, + DE_TITANIA_MSG3, + DE_TITANIA_MSG4, + DE_TITANIA_MSG5, + DE_TITANIA_MSG6, + DE_TITANIA_MSG7, + DE_TITANIA_MSG8 + }; class Strings : public Common::StringArray { |