From 23af9d1a3cd3a991edb2417d215132c6bba773e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Nov 2016 15:24:53 -0500 Subject: TITANIC: Load more text strings from data file --- engines/titanic/pet_control/pet_control.cpp | 5 +- engines/titanic/pet_control/pet_control.h | 1 - engines/titanic/pet_control/pet_conversations.cpp | 31 ++++---- engines/titanic/pet_control/pet_remote_glyphs.cpp | 91 +++++++++++++++++++---- engines/titanic/pet_control/pet_remote_glyphs.h | 30 +++----- engines/titanic/pet_control/pet_text.cpp | 5 ++ engines/titanic/pet_control/pet_text.h | 5 ++ 7 files changed, 115 insertions(+), 53 deletions(-) (limited to 'engines/titanic/pet_control') diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 2d44885a3e..415d1e9821 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -27,6 +27,7 @@ #include "titanic/messages/pet_messages.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" +#include "titanic/titanic.h" namespace Titanic { @@ -387,7 +388,7 @@ bool CPetControl::checkDragEnd(CGameObject *item) const { } void CPetControl::displayMessage(StringId stringId, int param) const { - CString msg = CString::format(_strings[stringId].c_str(), param); + CString msg = CString::format(g_vm->_strings[stringId].c_str(), param); _sections[_currentArea]->displayMessage(msg); } @@ -398,7 +399,7 @@ void CPetControl::displayMessage(const CString &str, int param) const { void CPetControl::addTranslation(StringId id1, StringId id2) { setArea(PET_TRANSLATION); - _translation.addTranslation(_strings[id1], _strings[id2]); + _translation.addTranslation(g_vm->_strings[id1], g_vm->_strings[id2]); } void CPetControl::clearTranslation() { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index d6f426b507..34d1330b52 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -68,7 +68,6 @@ private: CRoomItem *_hiddenRoom; Rect _drawBounds; PetEventInfo _timers[2]; - Strings _strings; private: /** * Returns true if the control is in a valid state diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 9b7e08aaaf..c2cddd9598 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -23,6 +23,7 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_control.h" #include "titanic/game_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -164,7 +165,7 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (_doorBot.MouseButtonUpMsg(msg->_mousePos)) { switch (canSummonBot("DoorBot")) { case SUMMON_CANT: - _log.addLine("Sadly, it is not possible to summon the DoorBot from this location.", getColor(1)); + _log.addLine(g_vm->_strings[CANT_SUMMON_DOORBOT], getColor(1)); break; case SUMMON_CAN: summonBot("DoorBot"); @@ -181,7 +182,7 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (_bellBot.MouseButtonUpMsg(msg->_mousePos)) { switch (canSummonBot("BellBot")) { case SUMMON_CANT: - _log.addLine("Sadly, it is not possible to summon the BellBot from this location.", getColor(1)); + _log.addLine(g_vm->_strings[CANT_SUMMON_BELLBOT], getColor(1)); break; case SUMMON_CAN: summonBot("BellBot"); @@ -277,40 +278,42 @@ void CPetConversations::timerExpired(int val) { } void CPetConversations::displayNPCName(CGameObject *npc) { + const Strings &strings = g_vm->_strings; + if (npc) { displayMessage(CString()); - CString msg = "Talking to "; + CString msg = strings[TALKING_TO]; CString name = npc->getName(); int id = 1; if (name.contains("Doorbot")) { - msg += "the DoorBot"; + msg += strings[DOORBOT_NAME]; } else if (name.contains("Deskbot")) { id = 2; - msg += "the DeskBot"; + msg += strings[DESKBOT_NAME]; } else if (name.contains("LiftBot")) { id = 3; - msg += "a LiftBot"; + msg += strings[LIFTBOT_NAME]; } else if (name.contains("Parrot")) { id = 4; - msg += "the Parrot"; + msg += strings[PARROT_NAME]; } else if (name.contains("BarBot")) { id = 5; - msg += "the BarBot"; + msg += strings[BARBOT_NAME]; } else if (name.contains("ChatterBot")) { id = 6; - msg += "a ChatterBot"; + msg += strings[CHATTERBOT_NAME]; } else if (name.contains("BellBot")) { id = 7; - msg += "the BellBot"; + msg += strings[BELLBOT_NAME]; } else if (name.contains("Maitre")) { id = 8; - msg += "the Maitre d'Bot"; + msg += strings[MAITRED_NAME]; } else if (name.contains("Succubus") || name.contains("Sub")) { id = 9; - msg += "a Succ-U-Bus"; + msg += strings[SUCCUBUS_NAME]; } else { - msg += "Unknown"; + msg += strings[UNKNOWN_NAME]; } _log.setNPC(1, id); @@ -507,7 +510,7 @@ void CPetConversations::textLineEntered(const CString &textLine) { if (!inputMsg._response.empty()) _log.addLine(inputMsg._response); } else { - _log.addLine("There is no one here to talk to", getColor(1)); + _log.addLine(g_vm->_strings[NO_ONE_TO_TALK_TO], getColor(1)); } // Clear input line and scroll log down to end to show response diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index aa756bc941..a33f1163c2 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -24,6 +24,7 @@ #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_control.h" #include "titanic/messages/pet_messages.h" +#include "titanic/support/strings.h" #include "titanic/titanic.h" namespace Titanic { @@ -216,7 +217,7 @@ bool CTelevisionControlGlyph::MouseButtonUpMsg(const Point &pt) { } void CTelevisionControlGlyph::getTooltip(CPetText *text) { - text->setText("Television control"); + text->setText(TELEVISION_CONTROL); } /*------------------------------------------------------------------------*/ @@ -280,7 +281,7 @@ bool CEntertainmentDeviceGlyph::MouseButtonUpMsg(const Point &pt) { } void CEntertainmentDeviceGlyph::getTooltip(CPetText *text) { - text->setText("Operate visual entertainment device"); + text->setText(OPERATE_ENTERTAINMENT); } /*------------------------------------------------------------------------*/ @@ -334,7 +335,7 @@ bool COperateLightsGlyph::MouseButtonUpMsg(const Point &pt) { } void COperateLightsGlyph::getTooltip(CPetText *text) { - text->setText("Operate the lights"); + text->setText(OPERATE_LIGHTS); } /*------------------------------------------------------------------------*/ @@ -346,7 +347,7 @@ bool CDeployFloralGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { } void CDeployFloralGlyph::getTooltip(CPetText *text) { - text->setText("Deploy floral enhancement"); + text->setText(DEPLOY_FLORAL_ENHANCEMENT); } @@ -359,7 +360,7 @@ bool CDeployFullyRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *own } void CDeployFullyRelaxationGlyph::getTooltip(CPetText *text) { - text->setText("Deploy fully recumbent relaxation device"); + text->setText(DEPLOY_FULLY_RELAXATION); } /*------------------------------------------------------------------------*/ @@ -371,7 +372,7 @@ bool CDeployComfortGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { } void CDeployComfortGlyph::getTooltip(CPetText *text) { - text->setText("Deploy comfort workstation"); + text->setText(DEPLOY_COMFORT_WORKSTATION); } /*------------------------------------------------------------------------*/ @@ -383,7 +384,7 @@ bool CDeployMinorStorageGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) } void CDeployMinorStorageGlyph::getTooltip(CPetText *text) { - text->setText("Deploy minor horizontally mobile storage compartment"); + text->setText(DEPLOY_MINOR_STORAGE); } /*------------------------------------------------------------------------*/ @@ -395,7 +396,7 @@ bool CDeployMajorRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *own } void CDeployMajorRelaxationGlyph::getTooltip(CPetText *text) { - text->setText("Deploy major semi-recumbent relaxation device"); + text->setText(DEPLOY_MAJOR_RELAXATION); } /*------------------------------------------------------------------------*/ @@ -407,7 +408,7 @@ bool CInflateRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) } void CInflateRelaxationGlyph::getTooltip(CPetText *text) { - text->setText("Inflate fully recumbent relaxation device "); + text->setText(INFLATE_RELAXATION_DEVICE); } /*------------------------------------------------------------------------*/ @@ -419,7 +420,7 @@ bool CDeployMaintenanceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) } void CDeployMaintenanceGlyph::getTooltip(CPetText *text) { - text->setText("Deploy personal maintenance hub"); + text->setText(DEPLOY_MAINTENANCE_HUB); } /*------------------------------------------------------------------------*/ @@ -431,7 +432,7 @@ bool CDeployWorkSurfaceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) } void CDeployWorkSurfaceGlyph::getTooltip(CPetText *text) { - text->setText("Deploy executive horizontal worksurface"); + text->setText(DEPLOY_EXECUTIVE_SURFACE); } /*------------------------------------------------------------------------*/ @@ -443,7 +444,7 @@ bool CDeployMinorRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *own } void CDeployMinorRelaxationGlyph::getTooltip(CPetText *text) { - text->setText("Deploy minor semi-recumbent relaxation device"); + text->setText(DEPLOY_MINOR_RELAXATION); } /*------------------------------------------------------------------------*/ @@ -455,7 +456,7 @@ bool CDeploySinkGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { } void CDeploySinkGlyph::getTooltip(CPetText *text) { - text->setText("Deploy aqueous cleansing receptacle"); + text->setText(DEPLOY_SINK); } /*------------------------------------------------------------------------*/ @@ -467,7 +468,7 @@ bool CDeployMajorStorageGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) } void CDeployMajorStorageGlyph::getTooltip(CPetText *text) { - text->setText("Deploy major horizontally mobile storage compartment"); + text->setText(DEPLOY_MAJOR_STORAGE); } /*------------------------------------------------------------------------*/ @@ -515,7 +516,7 @@ bool CSuccubusDeliveryGlyph::MouseButtonUpMsg(const Point &pt) { } void CSuccubusDeliveryGlyph::getTooltip(CPetText *text) { - text->setText("Succ-U-Bus delivery system control"); + text->setText(SUCCUBUS_DELIVERY_SYSTEM); } /*------------------------------------------------------------------------*/ @@ -554,9 +555,67 @@ bool CNavigationControllerGlyph::MouseButtonUpMsg(const Point &pt) { } void CNavigationControllerGlyph::getTooltip(CPetText *text) { - text->setText("Navigation controller"); + text->setText(NAVIGATION_CONTROLLER); } /*------------------------------------------------------------------------*/ +CSummonElevatorGlyph::CSummonElevatorGlyph() : CBasicRemoteGlyph( + "3PetLift", g_vm->_strings[SUMMON_ELEVATOR], "Lift") { +} + +/*------------------------------------------------------------------------*/ + +CSummonPelleratorGlyph::CSummonPelleratorGlyph() : CBasicRemoteGlyph( + "3PetPellerator", g_vm->_strings[SUMMON_PELLERATOR], "Pellerator") { +} + +/*------------------------------------------------------------------------*/ + +CGotoBottomOfWellGlyph::CGotoBottomOfWellGlyph() : CRemoteGotoGlyph("3PetBotOfWell", + g_vm->_strings[GO_TO_BOTTOM_OF_WELL]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoTopOfWellGlyph::CGotoTopOfWellGlyph() : CRemoteGotoGlyph("3PetTopOfWell", + g_vm->_strings[GO_TO_TOP_OF_WELL]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoStateroomGlyph::CGotoStateroomGlyph() : CRemoteGotoGlyph("3PetRoom", + g_vm->_strings[GO_TO_STATEROOM]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoBarGlyph::CGotoBarGlyph() : CRemoteGotoGlyph("3PetBar", + g_vm->_strings[GO_TO_BAR]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoPromenadeDeckGlyph::CGotoPromenadeDeckGlyph() : CRemoteGotoGlyph("3PetPromDeck", + g_vm->_strings[GO_TO_PROMENADE_DECK]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoArboretumGlyph::CGotoArboretumGlyph() : CRemoteGotoGlyph("3PetArboretum", + g_vm->_strings[GO_TO_ARBORETUM]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoMusicRoomGlyph::CGotoMusicRoomGlyph() : CRemoteGotoGlyph("3PetMusicRoom", + g_vm->_strings[GO_TO_MUSIC_ROOM]) { +} + +/*------------------------------------------------------------------------*/ + +CGotoRestaurantGlyph::CGotoRestaurantGlyph() : CRemoteGotoGlyph("3Pet1stClassRest", + g_vm->_strings[GO_TO_1ST_CLASS_RESTAURANT]) { +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 6114c81a9f..341f13e035 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -186,14 +186,12 @@ public: class CSummonElevatorGlyph : public CBasicRemoteGlyph { public: - CSummonElevatorGlyph() : CBasicRemoteGlyph( - "3PetLift", "Summon Elevator", "Lift") {} + CSummonElevatorGlyph(); }; class CSummonPelleratorGlyph : public CBasicRemoteGlyph { public: - CSummonPelleratorGlyph() : CBasicRemoteGlyph( - "3PetPellerator", "Summon Pellerator", "Pellerator") {} + CSummonPelleratorGlyph(); }; class CTelevisionControlGlyph : public CPetRemoteGlyph { @@ -664,50 +662,42 @@ public: class CGotoBottomOfWellGlyph : public CRemoteGotoGlyph { public: - CGotoBottomOfWellGlyph() : CRemoteGotoGlyph("3PetBotOfWell", - "Go to the Bottom of the Well") {} + CGotoBottomOfWellGlyph(); }; class CGotoTopOfWellGlyph : public CRemoteGotoGlyph { public: - CGotoTopOfWellGlyph() : CRemoteGotoGlyph("3PetTopOfWell", - "Go to the Top of the Well") {} + CGotoTopOfWellGlyph(); }; class CGotoStateroomGlyph : public CRemoteGotoGlyph { public: - CGotoStateroomGlyph() : CRemoteGotoGlyph("3PetRoom", - "Go to your stateroom") {} + CGotoStateroomGlyph(); }; class CGotoBarGlyph : public CRemoteGotoGlyph { public: - CGotoBarGlyph() : CRemoteGotoGlyph("3PetBar", - "Go to the Bar") {} + CGotoBarGlyph(); }; class CGotoPromenadeDeckGlyph : public CRemoteGotoGlyph { public: - CGotoPromenadeDeckGlyph() : CRemoteGotoGlyph("3PetPromDeck", - "Go to the Promenade Deck") {} + CGotoPromenadeDeckGlyph(); }; class CGotoArboretumGlyph : public CRemoteGotoGlyph { public: - CGotoArboretumGlyph() : CRemoteGotoGlyph("3PetArboretum", - "Go to the Arboretum") {} + CGotoArboretumGlyph(); }; class CGotoMusicRoomGlyph : public CRemoteGotoGlyph { public: - CGotoMusicRoomGlyph() : CRemoteGotoGlyph("3PetMusicRoom", - "Go to the Music Room") {} + CGotoMusicRoomGlyph(); }; class CGotoRestaurantGlyph : public CRemoteGotoGlyph { public: - CGotoRestaurantGlyph() : CRemoteGotoGlyph("3Pet1stClassRest", - "Go to the First Class Restaurant") {} + CGotoRestaurantGlyph(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a7b794eeb8..7bb0bad16e 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_text.h" +#include "titanic/titanic.h" namespace Titanic { @@ -212,6 +213,10 @@ void CPetText::setText(const CString &str) { appendText(str); } +void CPetText::setText(StringId stringId) { + setText(g_vm->_strings[stringId]); +} + void CPetText::appendText(const CString &str) { int lineSize = _array[_lineCount]._line.size(); int strSize = str.size(); diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 671ab4b916..9b2f47274c 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -135,6 +135,11 @@ public: */ void setText(const CString &str); + /** + * Set the text + */ + void setText(StringId stringId); + /** * Set text color */ -- cgit v1.2.3