diff options
Diffstat (limited to 'engines/titanic')
177 files changed, 2391 insertions, 1179 deletions
diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index 23b0710c30..0d31296818 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -22,6 +22,7 @@ #include "titanic/carry/arm.h" #include "titanic/messages/messages.h" +#include "titanic/translation.h" namespace Titanic { @@ -150,7 +151,7 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { CGameObject *petItem; if (find(getName(), &petItem, FIND_PET)) { if (!_armUnlocked) - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); if (_heldItemName == "Key" || _heldItemName == "AuditoryCentre") { CGameObject *heldItem = dynamic_cast<CGameObject *>(getFirstChild()); if (heldItem) { diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index 73970c404c..b5fe1dfffa 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -22,6 +22,7 @@ #include "titanic/carry/brain.h" #include "titanic/game/brain_slot.h" +#include "titanic/translation.h" namespace Titanic { @@ -70,7 +71,7 @@ bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) { petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(getName()); headpieceMsg.execute(msg->_other); - playSound("z#116.wav"); + playSound(TRANSLATE("z#116.wav", "z#647.wav")); setPosition(Point(0, 0)); setVisible(false); _pieceAdded = true; diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index f90f7cbd4d..12f6688fec 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -22,6 +22,7 @@ #include "titanic/carry/bridge_piece.h" #include "titanic/game/ship_setting.h" +#include "titanic/translation.h" namespace Titanic { @@ -60,7 +61,7 @@ bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { return true; } else { setVisible(false); - playSound("z#54.wav"); + playSound(TRANSLATE("z#54.wav", "z#585.wav")); setPosition(shipSetting->_pos1); shipSetting->_itemName = getName(); petMoveToHiddenRoom(); diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index c8747262b5..11e2880a17 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -27,6 +27,7 @@ #include "titanic/npcs/parrot.h" #include "titanic/npcs/succubus.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -121,7 +122,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { setVisible(false); _canTake = false; CParrot::_state = PARROT_ESCAPED; - playSound("z#475.wav"); + playSound(TRANSLATE("z#475.wav", "z#212.wav")); stopSoundChannel(true); moveUnder(findRoom()); @@ -136,7 +137,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { } else { setVisible(false); _canTake = false; - playSound("z#475.wav"); + playSound(TRANSLATE("z#475.wav", "z#212.wav")); stopSoundChannel(true); moveUnder(findRoom()); } @@ -170,7 +171,7 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { _canTake = false; CProximity prox(Audio::Mixer::kSpeechSoundType); - playSound("z#475.wav", prox); + playSound(TRANSLATE("z#475.wav", "z#212.wav"), prox); moveUnder(findRoom()); CParrot::_state = PARROT_ESCAPED; @@ -205,7 +206,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { _canTake = false; if (CParrot::_state == PARROT_4) { - playSound("z#475.wav"); + playSound(TRANSLATE("z#475.wav", "z#212.wav")); if (!_feathersFlag) { CCarry *feathers = dynamic_cast<CCarry *>(getRoot()->findByName("Feathers")); diff --git a/engines/titanic/carry/eye.cpp b/engines/titanic/carry/eye.cpp index 9bad0e480c..3a61cd5ab1 100644 --- a/engines/titanic/carry/eye.cpp +++ b/engines/titanic/carry/eye.cpp @@ -26,7 +26,7 @@ #include "titanic/game/television.h" #include "titanic/game/transport/lift.h" #include "titanic/pet_control/pet_control.h" - +#include "titanic/translation.h" namespace Titanic { @@ -108,7 +108,7 @@ bool CEye::ActMsg(CActMsg *msg) { if (msg->_action == "BellbotGetLight") { setVisible(true); petAddToInventory(); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); CActMsg actMsg("Eye Removed"); actMsg.execute("1stClassState", CLight::_type, diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index cdf46488f0..a1af91e127 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -23,6 +23,7 @@ #include "titanic/carry/photograph.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -63,7 +64,7 @@ bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (target && target->isEquals("NavigationComputer")) { moveUnder(getDontSave()); makeDirty(); - playSound("a#46.wav"); + playSound(TRANSLATE("a#46.wav", "a#39.wav")); starFn(STAR_SET_REFERENCE); showMouse(); return true; diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 3b447135bd..6de267e9fe 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -78,6 +78,9 @@ int CContinueSaveDialog::show() { // Event loop waiting for selection while (!g_vm->shouldQuit() && _selectedSlot == -999) { g_vm->_events->pollEventsAndWait(); + + if (g_vm->_loadSaveSlot != -1) + _selectedSlot = g_vm->_loadSaveSlot; } if (g_vm->shouldQuit()) _selectedSlot = -2; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 55dbbad7f0..d52fa27669 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -97,6 +97,7 @@ void CGameObject::save(SimpleFile *file, int indent) { i != rangeList->end(); ++i) { CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); rangeInfo->_initialFrame = (i == rangeList->begin()) ? getMovieFrame() : -1; + _movieRangeInfoList.push_back(rangeInfo); } } } @@ -867,7 +868,7 @@ void CGameObject::stopAnimTimer(int id) { void CGameObject::gotoView(const CString &viewName, const CString &clipName) { CViewItem *newView = parseView(viewName); CGameManager *gameManager = getGameManager(); - CViewItem *oldView = gameManager ? gameManager->getView() : newView; + CViewItem *oldView = gameManager->getView(); if (!oldView || !newView) return; @@ -1357,14 +1358,14 @@ void CGameObject::setToggleColor(byte r, byte g, byte b) { _toggleB = b; } -void CGameObject::movieSetAudioTiming(bool flag) { +void CGameObject::movieSetPlaying(bool flag) { if (!_surface && !_resource.empty()) { loadResource(_resource); _resource.clear(); } if (_surface && _surface->_movie) - _surface->_movie->_hasAudioTiming = flag; + _surface->_movie->setPlaying(flag); } void CGameObject::movieEvent(int frameNumber) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index f79c9e1d1e..b592806977 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -653,9 +653,9 @@ public: void stopMovie(); /** - * Overrides whether the object's movie has audio timing + * Overrides whether the object's movie is playing or paused */ - void movieSetAudioTiming(bool flag); + void movieSetPlaying(bool flag); /** * Get the current movie frame diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 92faebcaeb..b2bd5cd92b 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -173,6 +173,7 @@ void CProjectItem::loadGame(int slotId) { // Clear any existing project contents and call preload code preLoad(); clear(); + g_vm->_loadSaveSlot = -1; // Open either an existing savegame slot or the new game template if (slotId >= 0) { @@ -189,7 +190,11 @@ void CProjectItem::loadGame(int slotId) { // Load the savegame header in TitanicSavegameHeader header; readSavegameHeader(&file, header); - delete header._thumbnail; + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + g_vm->_events->setTotalPlayTicks(header._totalFrames); // Load the contents in diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index a42c51cbd9..7438a0053b 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -321,7 +321,7 @@ bool Debugger::cmdMovie(int argc, const char **argv) { tester->playMovie(MOVIE_STOP_PREVIOUS); } else { uint startFrame = strToInt(argv[2]); - uint endFrame = strToInt(argv[2]); + uint endFrame = (argc == 3) ? startFrame : strToInt(argv[3]); tester->playMovie(startFrame, endFrame, MOVIE_STOP_PREVIOUS); } diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp index 6e43b9c22f..19a5477dcb 100644 --- a/engines/titanic/game/announce.cpp +++ b/engines/titanic/game/announce.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/announce.h" +#include "titanic/translation.h" namespace Titanic { @@ -59,13 +60,13 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) { if (msg->_actionVal == 1) { CString numStr = "0"; - CString waveNames1[18] = { + const char *const WAVE_NAMES1_EN[18] = { "z#181.wav", "z#211.wav", "z#203.wav", "z#202.wav", "z#201.wav", "z#200.wav", "z#199.wav", "z#198.wav", "z#197.wav", "z#196.wav", "z#210.wav", "z#209.wav", "z#208.wav", "z#207.wav", "z#206.wav", "z#205.wav", "z#204.wav", "z#145.wav" }; - CString waveNames2[30] = { + const char *const WAVE_NAMES2_EN[30] = { "z#154.wav", "z#153.wav", "z#152.wav", "z#151.wav", "z#150.wav", "z#149.wav", "z#148.wav", "z#169.wav", "z#171.wav", "z#178.wav", "z#176.wav", "z#177.wav", "z#165.wav", "z#170.wav", "z#180.wav", @@ -73,6 +74,21 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) { "z#161.wav", "z#179.wav", "z#163.wav", "z#164.wav", "z#162.wav", "z#159.wav", "z#175.wav", "z#166.wav", "z#174.wav", "z#157.wav" }; + const char *const WAVE_NAMES1_DE[18] = { + "z#712.wav", "z#741.wav", "z#733.wav", "z#732.wav", "z#731.wav", + "z#730.wav", "z#729.wav", "z#728.wav", "z#727.wav", "z#726.wav", + "z#740.wav", "z#739.wav", "z#738.wav", "z#737.wav", "z#736.wav", + "z#735.wav", "z#734.wav", "z#701.wav" + }; + const char *const WAVE_NAMES2_DE[31] = { + "z#711.wav", "z#710.wav", "z#709.wav", "z#708.wav", "z#707.wav", + "z#706.wav", "z#705.wav", "z#704.wav", "z#688.wav", "z#690.wav", + "z#697.wav", "z#695.wav", "z#696.wav", "z#684.wav", "z#689.wav", + "z#699.wav", "z#675.wav", "z#691.wav", "z#692.wav", "z#679.wav", + "z#677.wav", "z#680.wav", "z#698.wav", "z#682.wav", "z#683.wav", + "z#681.wav", "z#678.wav", "z#694.wav", "z#685.wav", "z#693.wav", + "z#676.wav" + }; CProximity prox; prox._soundType = Audio::Mixer::kSpeechSoundType; @@ -81,21 +97,21 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) { switch (randVal) { case 0: case 1: - _soundHandle = playSound("z#189.wav", prox); + _soundHandle = playSound(TRANSLATE("z#189.wav", "z#719.wav"), prox); if (_nameIndex < 18) { - queueSound(waveNames1[_nameIndex], _soundHandle, 100, 0, false, - Audio::Mixer::kSpeechSoundType); + queueSound(TRANSLATE(WAVE_NAMES1_EN[_nameIndex], WAVE_NAMES1_DE[_nameIndex]), + _soundHandle, 100, 0, false, Audio::Mixer::kSpeechSoundType); ++_nameIndex; } else { - queueSound(waveNames1[getRandomNumber(17)], _soundHandle, - 100, 0, false, Audio::Mixer::kSpeechSoundType); + queueSound(TRANSLATE(WAVE_NAMES1_EN[getRandomNumber(17)], WAVE_NAMES1_DE[getRandomNumber(17)]), + _soundHandle, 100, 0, false, Audio::Mixer::kSpeechSoundType); } break; case 2: - _soundHandle = playSound("z#189.wav", prox); - queueSound(waveNames2[getRandomNumber(29)], _soundHandle, - 100, 0, false, Audio::Mixer::kSpeechSoundType); + _soundHandle = playSound(TRANSLATE("z#189.wav", "z#719.wav"), prox); + queueSound(TRANSLATE(WAVE_NAMES2_EN[getRandomNumber(29)], WAVE_NAMES2_DE[getRandomNumber(30)]), + _soundHandle, 100, 0, false, Audio::Mixer::kSpeechSoundType); break; default: diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 5f17dffda1..448a7d2919 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/bar_bell.h" +#include "titanic/translation.h" namespace Titanic { @@ -68,23 +69,23 @@ bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { case 0: case 1: case 5: - playSound("c#54.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#54.wav", "c#38.wav"), _volume, _soundVal3); break; case 2: - playSound("c#52.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#52.wav", "c#36.wav"), _volume, _soundVal3); break; case 3: - playSound("c#53.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#53.wav", "c#37.wav"), _volume, _soundVal3); break; case 4: - playSound("c#55.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#55.wav", "c#39.wav"), _volume, _soundVal3); break; default: - playSound("c#51.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#51.wav", "c#35.wav"), _volume, _soundVal3); break; } } else if (_fieldBC >= 5) { @@ -93,7 +94,7 @@ bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { actMsg.execute("Barbot"); } - playSound("c#51.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#51.wav", "c#35.wav"), _volume, _soundVal3); } else { if (_fieldBC == 3) { CActMsg actMsg("BellRing1"); @@ -103,7 +104,7 @@ bool CBarBell::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { actMsg.execute("Barbot"); } - playSound("c#54.wav", _volume, _soundVal3); + playSound(TRANSLATE("c#54.wav", "c#38.wav"), _volume, _soundVal3); } return true; diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index a443327218..ddb0b6d625 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -22,6 +22,7 @@ #include "titanic/game/bomb.h" #include "titanic/game/code_wheel.h" +#include "titanic/translation.h" namespace Titanic { @@ -39,17 +40,17 @@ END_MESSAGE_MAP() const int CORRECT_WHEELS = 23; -static const char *const HUNDREDS_WAVS[] = { +static const char *const HUNDREDS_WAVS_EN[] = { "", "z#353.wav", "z#339.wav", "z#325.wav", "z#311.wav", "z#297.wav", "z#283.wav", "z#269.wav", "z#255.wav", "z#241.wav" }; -static const char *const HUNDREDS_AND_WAVS[] = { +static const char *const HUNDREDS_AND_WAVS_EN[] = { "", "z#352.wav", "z#338.wav", "z#324.wav", "z#310.wav", "z#296.wav", "z#281.wav", "z#268.wav", "z#254.wav", "z#240.wav" }; -static const char *const COUNTDOWN_WAVS[100] = { +static const char *const COUNTDOWN_WAVS_EN[100] = { "bombcountdown_c0.wav", "z#355.wav", "z#341.wav", "z#327.wav", "z#313.wav", "z#299.wav", "z#285.wav", "z#271.wav", "z#257.wav", "z#243.wav", "z#354.wav", "z#350.wav", "z#349.wav", "z#348.wav", "z#347.wav", @@ -72,6 +73,37 @@ static const char *const COUNTDOWN_WAVS[100] = { "z#234.wav", "z#233.wav", "z#232.wav", "z#231.wav", "z#230.wav", }; +const char *const HUNDREDS_WAVS_DE[10] = { + "z#56.wav", "z#54.wav", "z#53.wav", "z#52.wav", "z#51.wav", + "z#50.wav", "z#49.wav", "z#48.wav", "z#47.wav", "z#55.wav" +}; + +const char *const ONE_TO_NINETEEN_WAVS_DE[19] = { + "z#15.wav", "z#97.wav", "z#95.wav", "z#86.wav", "z#84.wav", + "z#82.wav", "z#80.wav", "z#78.wav", "z#76.wav", "z#74.wav", + "z#73.wav", "z#72.wav", "z#71.wav", "z#70.wav", "z#69.wav", + "z#68.wav", "z#67.wav", "z#66.wav", "z#65.wav" +}; + +const char *const TENS_WAVS_DE[9] = { + "z#98.wav", "z#96.wav", "z#92.wav", "z#85.wav", "z#83.wav", + "z#81.wav", "z#79.wav", "z#77.wav", "z#75.wav" +}; + +const char *const DIGITS_WAVS_DE[9] = { + "z#74.wav", "z#64.wav", "z#63.wav", "z#62.wav", "z#61.wav", + "z#60.wav", "z#59.wav", "z#58.wav", "z#57.wav" +}; + +const char *const WAVES_970_DE[30] = { + "z#46.wav", "z#45.wav", "z#44.wav", "z#43.wav", "z#42.wav", + "z#41.wav", "z#40.wav", "z#39.wav", "z#38.wav", "z#37.wav", + "z#36.wav", "z#35.wav", "z#34.wav", "z#33.wav", "z#32.wav", + "z#31.wav", "z#30.wav", "z#29.wav", "z#28.wav", "z#27.wav", + "z#26.wav", "z#25.wav", "z#24.wav", "z#23.wav", "z#22.wav", + "z#21.wav", "z#20.wav", "z#19.wav", "z#18.wav", "z#17.wav" +}; + CBomb::CBomb() : CBackground() { _active = false; _numCorrectWheels = 0; @@ -139,22 +171,22 @@ bool CBomb::StatusChangeMsg(CStatusChangeMsg *msg) { CString name; switch (val) { case 25: - name = "z#372.wav"; + name = TRANSLATE("z#372.wav", "z#115.wav"); break; case 26: - name = "z#371.wav"; + name = TRANSLATE("z#371.wav", "z#114.wav"); break; case 27: - name = "z#370.wav"; + name = TRANSLATE("z#370.wav", "z#113.wav"); break; case 28: - name = "z#369.wav"; + name = TRANSLATE("z#369.wav", "z#112.wav"); break; case 29: - name = "z#368.wav"; + name = TRANSLATE("z#368.wav", "z#111.wav"); break; default: - name = "z#366.wav"; + name = TRANSLATE("z#366.wav", "z#109.wav"); break; } @@ -170,7 +202,7 @@ bool CBomb::EnterViewMsg(CEnterViewMsg *msg) { } bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - playSound("z#62.wav"); + playSound(TRANSLATE("z#62.wav", "z#593.wav")); if (_active) { stopSound(_soundHandle); @@ -181,22 +213,22 @@ bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { CString name; switch (_tappedCtr) { case 18: - name = "z#380.wav"; + name = TRANSLATE("z#380.wav", "z#122.wav"); break; case 19: - name = "z#379.wav"; + name = TRANSLATE("z#379.wav", "z#121.wav"); break; case 20: - name = "z#377.wav"; + name = TRANSLATE("z#377.wav", "z#119.wav"); break; case 21: - name = "z#376.wav"; + name = TRANSLATE("z#376.wav", "z#118.wav"); break; case 22: - name = "z#375.wav"; + name = TRANSLATE("z#375.wav", "z#117.wav"); break; default: - name = "z#374.wav"; + name = TRANSLATE("z#374.wav", "z#.wav"); break; } @@ -204,7 +236,7 @@ bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { _countdown = 999; } } else { - _soundHandle = playSound("z#389.wav", _volume); + _soundHandle = playSound(TRANSLATE("z#389.wav", "z#131.wav"), _volume); _active = true; CActMsg actMsg("Arm Bomb"); actMsg.execute("EndExplodeShip"); @@ -223,7 +255,7 @@ bool CBomb::EnterRoomMsg(CEnterRoomMsg *msg) { bool CBomb::ActMsg(CActMsg *msg) { if (msg->_action == "Hit") { - playSound("z#63.wav"); + playSound(TRANSLATE("z#63.wav", "z#594.wav")); stopSound(_soundHandle); if (_hammerCtr < 17) @@ -232,28 +264,28 @@ bool CBomb::ActMsg(CActMsg *msg) { CString name; switch (_hammerCtr) { case 10: - name = "z#388.wav"; + name = TRANSLATE("z#388.wav", "z#130.wav"); break; case 11: - name = "z#387.wav"; + name = TRANSLATE("z#387.wav", "z#129.wav"); break; case 12: - name = "z#386.wav"; + name = TRANSLATE("z#386.wav", "z#128.wav"); break; case 13: - name = "z#385.wav"; + name = TRANSLATE("z#385.wav", "z#127.wav"); break; case 14: - name = "z#384.wav"; + name = TRANSLATE("z#384.wav", "z#126.wav"); break; case 15: - name = "z#383.wav"; + name = TRANSLATE("z#383.wav", "z#125.wav"); break; case 16: - name = "z#382.wav"; + name = TRANSLATE("z#382.wav", "z#124.wav"); break; default: - name = "z#381.wav"; + name = TRANSLATE("z#381.wav", "z#123.wav"); break; } @@ -267,7 +299,7 @@ bool CBomb::ActMsg(CActMsg *msg) { bool CBomb::TurnOn(CTurnOn *msg) { if (!_active) { CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); - _soundHandle = playSound("z#389.wav", prox); + _soundHandle = playSound(TRANSLATE("z#389.wav", "z#131.wav"), prox); _active = true; // WORKAROUND: Only reset the code wheels back to 'O' value @@ -297,7 +329,7 @@ bool CBomb::TimerMsg(CTimerMsg *msg) { if (msg->_action == "Disarmed") { CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); stopSound(_soundHandle); - playSound("z#364.wav", prox); + playSound(TRANSLATE("z#364.wav", "z#107.wav"), prox); CActMsg actMsg1("Disarm Bomb"); actMsg1.execute("EndExplodeShip"); @@ -311,66 +343,123 @@ bool CBomb::TimerMsg(CTimerMsg *msg) { unlockMouse(); } - if (compareRoomNameTo("Titania")) { - if (msg->_actionVal == 1 && getRandomNumber(9) == 0) { - if (!_active) - return true; + if (!compareRoomNameTo("Titania")) { + // In rooms other than the bomb room + if (_active) { + --_countdown; + addTimer(6000); - CParrotSpeakMsg speakMsg("Bomb", "BombCountdown"); - speakMsg.execute("PerchedParrot"); + if (_countdown < 11) + _countdown = getRandomNumber(900) + 50; } - if (_active) { - if (!isSoundActive(_soundHandle)) { - if (msg->_actionVal == 0) { - addTimer(1, 1000, 0); - } else { - _soundHandle = 0; - int hundreds = _countdown / 100; - int remainder = _countdown % 100; + return true; + } - if (_countdown >= 100) { - // Play "x hundred and" or just "x hundred" - CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); - CString hName = remainder ? HUNDREDS_AND_WAVS[hundreds] : HUNDREDS_WAVS[hundreds]; - _soundHandle = playSound(hName, prox); - } + if (msg->_actionVal == 1 && getRandomNumber(9) == 0) { + if (!_active) + return true; - CString ctrName = COUNTDOWN_WAVS[remainder]; - if (_countdown == 10) { - ctrName = "z#229.wav"; - _countdown = 998; - } + CParrotSpeakMsg speakMsg("Bomb", "BombCountdown"); + speakMsg.execute("PerchedParrot"); + } + + // Don't execute if the bomb isn't actually active + if (!_active) + return true; - // Play the sub-hundred portion of the countdown amount - if (_soundHandle > 0) { - _soundHandle = queueSound(ctrName, _soundHandle, _volume, 0, false, Audio::Mixer::kSpeechSoundType); - } else { + if (isSoundActive(_soundHandle)) { + // Bomb speech currently active, so schedule the method + // to re-trigger after 100ms to check if speech is finished + addTimer(0, 100, 0); + return true; + } + + if (msg->_actionVal == 0) { + addTimer(1, 1000, 0); + } else { + _soundHandle = 0; + int hundreds = _countdown / 100; + int remainder = _countdown % 100; + + if (g_language == Common::DE_DEU) { + if (_countdown <= 10) { + // Reset countdown back to 1000 + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound("z#14.wav", prox); + _countdown = 999; + } else { + if (_countdown >= 970) { + // Sounds for numbers 970 to 999 + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound(WAVES_970_DE[_countdown - 970], prox); + } else { + if (hundreds >= 1) { CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); - _soundHandle = playSound(ctrName, prox); + _soundHandle = playSound(HUNDREDS_WAVS_DE[hundreds - 1], prox); } - // Reduce countdown and schedule another timer - --_countdown; - addTimer(0, 1000, 0); + if (remainder >= 20) { + int tens = remainder / 10; + int digit = remainder % 10; + + // Tens + const char *tensStr = TENS_WAVS_DE[tens - 1]; + if (_soundHandle) { + _soundHandle = queueSound(tensStr, _soundHandle, + _volume, 0, false, Audio::Mixer::kSpeechSoundType); + } else { + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound(tensStr, prox); + } + + // Digit + if (digit != 0) { + const char *digitStr = DIGITS_WAVS_DE[digit - 1]; + _soundHandle = queueSound(digitStr, _soundHandle, + _volume, 0, false, Audio::Mixer::kSpeechSoundType); + } + } else if (remainder != 0) { + // One to nineteen + const char *name = ONE_TO_NINETEEN_WAVS_DE[remainder - 1]; + if (_soundHandle) { + _soundHandle = queueSound(name, _soundHandle, + _volume, 0, false, Audio::Mixer::kSpeechSoundType); + } else { + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound(name, prox); + } + } } + } + } else { + if (_countdown >= 100) { + // Play "x hundred and" or just "x hundred" + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + CString hName = remainder ? HUNDREDS_AND_WAVS_EN[hundreds] : HUNDREDS_WAVS_EN[hundreds]; + _soundHandle = playSound(hName, prox); + } + + CString ctrName = COUNTDOWN_WAVS_EN[remainder]; + if (_countdown == 10) { + ctrName = "z#229.wav"; + _countdown = 998; + } + + // Play the sub-hundred portion of the countdown amount + if (_soundHandle > 0) { + _soundHandle = queueSound(ctrName, _soundHandle, _volume, 0, false, Audio::Mixer::kSpeechSoundType); } else { - // Bomb speech currently active, so schedule the method - // to re-trigger after 100ms to check if speech is finished - addTimer(0, 100, 0); + CProximity prox(Audio::Mixer::kSpeechSoundType, _volume); + _soundHandle = playSound(ctrName, prox); } } - } else { - // In rooms other than the bomb room - if (_active) { - --_countdown; - addTimer(6000); - if (_countdown < 11) - _countdown = getRandomNumber(900) + 50; - } + // Reduce countdown and schedule another timer + --_countdown; + addTimer(0, 1000, 0); } - + return true; } diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp index 06d70256c5..43e5d8a12d 100644 --- a/engines/titanic/game/bowl_unlocker.cpp +++ b/engines/titanic/game/bowl_unlocker.cpp @@ -22,6 +22,7 @@ #include "titanic/game/bowl_unlocker.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -60,7 +61,7 @@ bool CBowlUnlocker::MovieEndMsg(CMovieEndMsg *msg) { CNutPuzzleMsg puzzleMsg("BowlUnlocked"); puzzleMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); return true; } diff --git a/engines/titanic/game/bridge_view.cpp b/engines/titanic/game/bridge_view.cpp index 14361b4e8c..608724c16c 100644 --- a/engines/titanic/game/bridge_view.cpp +++ b/engines/titanic/game/bridge_view.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/bridge_view.h" +#include "titanic/translation.h" namespace Titanic { @@ -78,7 +79,7 @@ bool CBridgeView::ActMsg(CActMsg *msg) { CChangeMusicMsg musicMsg; musicMsg._flags = 1; musicMsg.execute("BridgeAutoMusicPlayer"); - playSound("a#42.wav"); + playSound(TRANSLATE("a#42.wav", "a#35.wav")); playMovie(MOVIE_NOTIFY_OBJECT); } } diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp index 5de728481b..809cfb309e 100644 --- a/engines/titanic/game/broken_pellerator.cpp +++ b/engines/titanic/game/broken_pellerator.cpp @@ -142,9 +142,11 @@ bool CBrokenPellerator::MovieEndMsg(CMovieEndMsg *msg) { switch (_closeAction) { case 1: changeView(_exitLeftView); + _closeAction = CLOSE_NONE; break; case 2: changeView(_exitRightView); + _closeAction = CLOSE_NONE; break; default: break; diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp index eafb478d0e..7beb29c072 100644 --- a/engines/titanic/game/captains_wheel.cpp +++ b/engines/titanic/game/captains_wheel.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/captains_wheel.h" +#include "titanic/translation.h" namespace Titanic { @@ -99,6 +100,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { } } else if (msg->_action == "Go") { if (_stopEnabled) { + _goEnabled = false; incTransitions(); _stopEnabled = false; _actionNum = 1; @@ -118,7 +120,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "SetDestin") { - playSound("a#44.wav"); + playSound(TRANSLATE("a#44.wav", "a#37.wav")); CSetVolumeMsg volumeMsg; volumeMsg._volume = 25; volumeMsg.execute("EngineSounds"); diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index d6aa32c702..f9daf17d00 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -23,6 +23,7 @@ #include "titanic/core/room_item.h" #include "titanic/game/cdrom_tray.h" #include "titanic/messages/messages.h" +#include "titanic/translation.h" namespace Titanic { @@ -59,7 +60,7 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { if (_insertedCD == "None") { // No CD in tray playMovie(55, 65, 0); - playSound("a#35.wav", 50, 0, 0); + playSound(TRANSLATE("a#35.wav", "a#30.wav"), 50, 0, 0); _isOpened = false; } else { // Ejecting tray with CD @@ -75,29 +76,29 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { } else if (_insertedCD == "None") { // Opening tray with no CD playMovie(44, 54, 0); - playSound("a#34.wav", 50, 0, 0); + playSound(TRANSLATE("a#34.wav", "a#29.wav"), 50, 0, 0); _isOpened = true; } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { // Opening tray with standard CD playMovie(22, 32, 0); - playSound("a#34.wav", 50, 0, 0); + playSound(TRANSLATE("a#34.wav", "a#29.wav"), 50, 0, 0); _isOpened = true; } else if (_insertedCD == "newSTCD") { // Opening tray with Starship Titanic CD playMovie(0, 10, 0); - playSound("a#34.wav", 50, 0, 0); + playSound(TRANSLATE("a#34.wav", "a#29.wav"), 50, 0, 0); _isOpened = true; } } else if (_isOpened) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { // Standard CD dropped on CDROM Tray playMovie(33, 43, MOVIE_NOTIFY_OBJECT); - playSound("a#35.wav", 50, 0, 0); + playSound(TRANSLATE("a#35.wav", "a#30.wav"), 50, 0, 0); } else if (msg->_action == "newSTCD") { // Starship Titanic CD dropped on CDROM Tray disableMouse(); playMovie(11, 21, MOVIE_NOTIFY_OBJECT); - playSound("a#35.wav", 50, 0, 0); + playSound(TRANSLATE("a#35.wav", "a#30.wav"), 50, 0, 0); } else { return true; } diff --git a/engines/titanic/game/cell_point_button.cpp b/engines/titanic/game/cell_point_button.cpp index 2afcf39f48..75b8772d19 100644 --- a/engines/titanic/game/cell_point_button.cpp +++ b/engines/titanic/game/cell_point_button.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/cell_point_button.h" +#include "titanic/translation.h" namespace Titanic { @@ -89,7 +90,7 @@ bool CCellPointButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { playMovie(0); _regionNum = _regionNum ? 0 : 1; - playSound("z#425.wav"); + playSound(TRANSLATE("z#425.wav", "z#170.wav")); talkSetDialRegion(_npcName, _dialNum, _regionNum); return true; diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp index 119d82efc0..6c27b1fd83 100644 --- a/engines/titanic/game/chev_code.cpp +++ b/engines/titanic/game/chev_code.cpp @@ -132,7 +132,7 @@ bool CChevCode::GetChevFloorNum(CGetChevFloorNum *msg) { break; } - msg->_floorNum = (val1 >= 10) ? 0 : val1 * 10; + msg->_floorNum = (val1 >= 10) ? 0 : val2 * 10 + val1; return true; } diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp index 692c364918..8d16289647 100644 --- a/engines/titanic/game/chicken_dispensor.cpp +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -24,6 +24,7 @@ #include "titanic/carry/chicken.h" #include "titanic/core/project_item.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -90,7 +91,7 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { if (_disabled) { playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("z#400.wav"); + playSound(TRANSLATE("z#400.wav", "z#145.wav")); } else { playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } @@ -109,7 +110,7 @@ bool CChickenDispensor::MovieEndMsg(CMovieEndMsg *msg) { if (movieFrame == 16) { // Dispensed a chicken _cursorId = CURSOR_HAND; - playSound("b#50.wav", 50); + playSound(TRANSLATE("b#50.wav", "b#30.wav"), 50); CActMsg actMsg("Dispense Chicken"); actMsg.execute("Chicken"); @@ -156,7 +157,7 @@ bool CChickenDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { } bool CChickenDispensor::EnterViewMsg(CEnterViewMsg *msg) { - playSound("b#51.wav"); + playSound(TRANSLATE("b#51.wav", "b#31.wav")); _dispensed = false; _cursorId = CURSOR_ARROW; return true; diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp index 1df99ae749..441c481dfe 100644 --- a/engines/titanic/game/code_wheel.cpp +++ b/engines/titanic/game/code_wheel.cpp @@ -22,6 +22,8 @@ #include "titanic/game/code_wheel.h" #include "titanic/titanic.h" +#include "titanic/translation.h" +#include "titanic/translation.h" namespace Titanic { @@ -91,7 +93,7 @@ bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { _value = (_value <= 0) ? 14 : _value - 1; } - playSound("z#59.wav"); + playSound(TRANSLATE("z#59.wav", "z#590.wav")); return true; } diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index 9aa5db252c..a9ff1ce9c0 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/computer.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,7 +47,7 @@ void CComputer::load(SimpleFile *file) { bool CComputer::ActMsg(CActMsg *msg) { if (_state) { - playSound("a#35.wav"); + playSound(TRANSLATE("a#35.wav", "a#30.wav")); playMovie(32, 42, 0); if (msg->_action == "CD1") @@ -66,11 +67,11 @@ bool CComputer::ActMsg(CActMsg *msg) { bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_currentCD == "None") { if (_state) { - playSound("a#35.wav"); + playSound(TRANSLATE("a#35.wav", "a#30.wav")); playMovie(11, 21, 0); _state = 0; } else { - playSound("a#34.wav"); + playSound(TRANSLATE("a#34.wav", "a#29.wav")); playMovie(0, 10, 0); _state = 1; } @@ -81,7 +82,7 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { actMsg.execute(_currentCD); _currentCD = "None"; } else { - playSound("a#34.wav"); + playSound(TRANSLATE("a#34.wav", "a#29.wav")); playMovie(21, 31, 0); _state = 1; } @@ -92,10 +93,10 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CComputer::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == 90) { - playSound("a#32.wav"); - playSound("a#33.wav"); - playSound("a#31.wav"); - playSound("a#0.wav"); + playSound(TRANSLATE("a#32.wav", "a#27.wav")); + playSound(TRANSLATE("a#33.wav", "a#28.wav")); + playSound(TRANSLATE("a#31.wav", "a#26.wav")); + playSound(TRANSLATE("a#0.wav", "a#52.wav")); gotoView("Home.Node 4.E", "_TRACK,3,e-cu,4,E"); } diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 179063d1b0..dee469af1c 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -22,7 +22,7 @@ #include "titanic/game/computer_screen.h" #include "titanic/messages/messages.h" -#include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -59,7 +59,7 @@ bool CComputerScreen::ActMsg(CActMsg *msg) { } bool CComputerScreen::MovieEndMsg(CMovieEndMsg *msg) { - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); addTimer(0, 3000, 0); for (int idx = 0; idx < 10; ++idx) @@ -90,57 +90,57 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) { switch (msg->_actionVal) { case 0: - if (!g_vm->isGerman()) { - loadSound("a#32.wav"); - loadSound("a#31.wav"); - loadSound("a#33.wav"); - loadSound("a#30.wav"); - loadSound("a#29.wav"); - playSound("a#25.wav"); - } else { + if (g_language == Common::DE_DEU) { loadSound("a#27.wav"); loadSound("a#26.wav"); loadSound("a#28.wav"); loadSound("a#25.wav"); loadSound("a#24.wav"); playSound("a#20.wav"); + } else { + loadSound("a#32.wav"); + loadSound("a#31.wav"); + loadSound("a#33.wav"); + loadSound("a#30.wav"); + loadSound("a#29.wav"); + playSound("a#25.wav"); } addTimer(1, 2000, 0); break; case 1: playMovie(23, 26, MOVIE_STOP_PREVIOUS); - playSound(SOUND("a#32.wav", "a#27.wav")); - playSound(SOUND("a#31.wav", "a#26.wav")); + playSound(TRANSLATE("a#32.wav", "a#27.wav")); + playSound(TRANSLATE("a#31.wav", "a#26.wav")); addTimer(2, 2000, 0); break; case 2: { CChangeMusicMsg musicMsg(CString(), 1); musicMsg.execute("HomeMusicPlayer"); - playSound(SOUND("a#33.wav", "a#28.wav")); - playSound(SOUND("a#31.wav", "a#26.wav")); + playSound(TRANSLATE("a#33.wav", "a#28.wav")); + playSound(TRANSLATE("a#31.wav", "a#26.wav")); changeView("Home.Node 4.E", ""); playClip(51, 150); - playSound(SOUND("a#31.wav", "a#26.wav")); + playSound(TRANSLATE("a#31.wav", "a#26.wav")); playClip(151, 200); - handle = playSound(SOUND("a#27.wav", "a#22.wav")); + handle = playSound(TRANSLATE("a#27.wav", "a#22.wav")); playClip(200, 306); - playSound(SOUND("a#30.wav", "a#25.wav")); + playSound(TRANSLATE("a#30.wav", "a#25.wav")); stopSound(handle, 0); playClip(306, 338); - handle = playSound(SOUND("a#28.wav", "a#23.wav")); + handle = playSound(TRANSLATE("a#28.wav", "a#23.wav")); playClip(338, 392); - playSound(SOUND("a#29.wav", "a#24.wav")); + playSound(TRANSLATE("a#29.wav", "a#24.wav")); stopSound(handle); - handle = playSound(SOUND("y#662.wav", "y#0.wav")); + handle = playSound(TRANSLATE("y#662.wav", "y#0.wav")); setSoundVolume(handle, 10, 2); playClip(392, 450); startTalking("Doorbot", 0x3611A); - sleep(8000); + sleep(TRANSLATE(8000, 7000)); playClip(450, 492); startTalking("Doorbot", 0x36121); diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp index 8333343cde..ddb44f127c 100644 --- a/engines/titanic/game/credits.cpp +++ b/engines/titanic/game/credits.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/credits.h" +#include "titanic/translation.h" namespace Titanic { @@ -58,13 +59,13 @@ bool CCredits::SignalObject(CSignalObject *msg) { bool CCredits::TimerMsg(CTimerMsg *msg) { stopGlobalSound(true, -1); setVisible(true); - loadSound("a#16.wav"); - loadSound("a#24.wav"); + loadSound(TRANSLATE("a#16.wav", "a#11.wav")); + loadSound(TRANSLATE("a#24.wav", "a#19.wav")); if (playCutscene(0, 18)) { - playGlobalSound("a#16.wav", VOL_NORMAL, false, false, 0); + playGlobalSound(TRANSLATE("a#16.wav", "a#11.wav"), VOL_NORMAL, false, false, 0); if (playCutscene(19, 642)) { - playSound("a#24.wav"); + playSound(TRANSLATE("a#24.wav", "a#19.wav")); playCutscene(643, 750); } } diff --git a/engines/titanic/game/credits_button.cpp b/engines/titanic/game/credits_button.cpp index ee8f7bb329..2296a4e1e8 100644 --- a/engines/titanic/game/credits_button.cpp +++ b/engines/titanic/game/credits_button.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/credits_button.h" +#include "titanic/translation.h" namespace Titanic { @@ -50,7 +51,7 @@ bool CCreditsButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { bool CCreditsButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_fieldE0) { - playSound("a#20.wav"); + playSound(TRANSLATE("a#20.wav", "a#15.wav")); CSignalObject signalMsg; signalMsg._numValue = 1; signalMsg.execute("CreditsPlayer"); diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index 0650b3a1f5..efdf13fa92 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/desk_click_responder.h" +#include "titanic/translation.h" namespace Titanic { @@ -52,7 +53,7 @@ bool CDeskClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { uint ticks = getTicksCount(); if (!_ticks || ticks > (_ticks + 4000)) { - playSound("a#22.wav"); + playSound(TRANSLATE("a#22.wav", "a#17.wav")); _ticks = ticks; } diff --git a/engines/titanic/game/end_credit_text.cpp b/engines/titanic/game/end_credit_text.cpp index 9af13133d6..8809799a27 100644 --- a/engines/titanic/game/end_credit_text.cpp +++ b/engines/titanic/game/end_credit_text.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/end_credit_text.h" +#include "titanic/translation.h" namespace Titanic { @@ -43,7 +44,7 @@ void CEndCreditText::load(SimpleFile *file) { } bool CEndCreditText::ActMsg(CActMsg *msg) { - playGlobalSound("z#41.wav", VOL_NORMAL, false, false, 0); + playGlobalSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0); createCredits(); _flag = true; return true; diff --git a/engines/titanic/game/end_credits.cpp b/engines/titanic/game/end_credits.cpp index 77abfb006e..4ea54a3b76 100644 --- a/engines/titanic/game/end_credits.cpp +++ b/engines/titanic/game/end_credits.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/end_credits.h" +#include "titanic/translation.h" namespace Titanic { @@ -47,8 +48,8 @@ bool CEndCredits::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { stopGlobalSound(true, -1); _flag = false; } else { - loadSound("z#41.wav"); - playGlobalSound("z#41.wav", VOL_NORMAL, false, false, 0); + loadSound(TRANSLATE("z#41.wav", "z#573.wav")); + playGlobalSound(TRANSLATE("z#41.wav", "z#573.wav"), VOL_NORMAL, false, false, 0); _flag = true; } diff --git a/engines/titanic/game/end_explode_ship.cpp b/engines/titanic/game/end_explode_ship.cpp index 2de9192319..5f90604fd7 100644 --- a/engines/titanic/game/end_explode_ship.cpp +++ b/engines/titanic/game/end_explode_ship.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/end_explode_ship.h" +#include "titanic/translation.h" namespace Titanic { @@ -53,9 +54,9 @@ bool CEndExplodeShip::ActMsg(CActMsg *msg) { } else if (msg->_action == "Disarm Bomb") { _isExploding = false; } else if (msg->_action == "TakeOff") { - loadSound("a#31.wav"); - loadSound("a#14.wav"); - playGlobalSound("a#13.wav", VOL_NORMAL, true, true, 0); + loadSound(TRANSLATE("a#31.wav", "a#26.wav")); + loadSound(TRANSLATE("a#14.wav", "a#7.wav")); + playGlobalSound(TRANSLATE("a#13.wav", "a#6.wav"), VOL_NORMAL, true, true, 0); addTimer(1, 10212, 0); } @@ -86,7 +87,7 @@ bool CEndExplodeShip::TimerMsg(CTimerMsg *msg) { bool CEndExplodeShip::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == 550) { - playSound("z#399.wav"); + playSound(TRANSLATE("z#399.wav", "a#10.wav")); startAnimTimer("Boom", 4200, 0); } else { addTimer(3, 8000, 0); @@ -97,9 +98,9 @@ bool CEndExplodeShip::MovieEndMsg(CMovieEndMsg *msg) { bool CEndExplodeShip::MovieFrameMsg(CMovieFrameMsg *msg) { if (msg->_frameNumber == 58) - playSound("a#31.wav", 70); + playSound(TRANSLATE("a#31.wav", "a#26.wav"), 70); else if (msg->_frameNumber == 551) - playSound("a#14.wav"); + playSound(TRANSLATE("a#14.wav", "a#7.wav")); return true; } diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 52151f353e..e8bc04aa85 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/end_sequence_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -71,13 +72,13 @@ bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) { petHide(); disableMouse(); addTimer(1, 1000, 0); - playGlobalSound("a#15.wav", VOL_NORMAL, true, true, 0, Audio::Mixer::kSpeechSoundType); + playGlobalSound(TRANSLATE("a#15.wav", "a#8.wav"), VOL_NORMAL, true, true, 0, Audio::Mixer::kSpeechSoundType); return true; } bool CEndSequenceControl::EnterViewMsg(CEnterViewMsg *msg) { - movieSetAudioTiming(true); playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + movieSetPlaying(true); return true; } diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp index fc99bd8b36..689f66e3d6 100644 --- a/engines/titanic/game/fan_control.cpp +++ b/engines/titanic/game/fan_control.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/fan_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -74,7 +75,7 @@ bool CFanControl::ActMsg(CActMsg *msg) { bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { if (!_starlingsDying) { - playSound("z#42.wav"); + playSound(TRANSLATE("z#42.wav", "z#743.wav")); if (_enabled) { switch (msg->_newStatus) { case 1: diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index 7ddf919eca..1a5a46ac02 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -22,6 +22,7 @@ #include "titanic/game/fan_noises.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -75,12 +76,12 @@ bool CFanNoises::EnterRoomMsg(CEnterRoomMsg *msg) { switch (_state) { case 1: - _soundHandle = playSound("b#60.wav", 0, _soundBalance, true); + _soundHandle = playSound(TRANSLATE("b#60.wav", "b#40.wav"), 0, _soundBalance, true); setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); _startFlag = true; break; case 2: - _soundHandle = playSound("b#58.wav", 0, _soundBalance, true); + _soundHandle = playSound(TRANSLATE("b#58.wav", "b#38.wav"), 0, _soundBalance, true); setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); _startFlag = true; break; @@ -122,7 +123,7 @@ bool CFanNoises::StatusChangeMsg(CStatusChangeMsg *msg) { switch (oldState) { case 1: case 2: - playSound("b#59.wav", _soundPercent, _soundBalance); + playSound(TRANSLATE("b#59.wav", "b#39.wav"), _soundPercent, _soundBalance); break; default: break; @@ -140,7 +141,7 @@ bool CFanNoises::StatusChangeMsg(CStatusChangeMsg *msg) { switch (oldState) { case 0: case 2: - _soundHandle = playSound("b#60.wav", _soundPercent, _soundBalance, true); + _soundHandle = playSound(TRANSLATE("b#60.wav", "b#40.wav"), _soundPercent, _soundBalance, true); _startFlag = true; break; default: @@ -157,7 +158,7 @@ bool CFanNoises::StatusChangeMsg(CStatusChangeMsg *msg) { } if (oldState == 1) { - _soundHandle = playSound("b#58.wav", _soundPercent, _soundBalance, true); + _soundHandle = playSound(TRANSLATE("b#58.wav", "b#38.wav"), _soundPercent, _soundBalance, true); _startFlag = true; } break; @@ -186,13 +187,13 @@ bool CFanNoises::LoadSuccessMsg(CLoadSuccessMsg *msg) { switch (_state) { case 1: - playSound("b#60.wav", 0, _soundBalance, true); + playSound(TRANSLATE("b#60.wav", "b#40.wav"), 0, _soundBalance, true); setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); _startFlag = true; break; case 2: - playSound("b#58.wav", 0, _soundBalance, true); + playSound(TRANSLATE("b#58.wav", "b#38.wav"), 0, _soundBalance, true); setSoundVolume(_soundHandle, _soundPercent, _soundSeconds); _startFlag = true; break; diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp index 7de034c2ee..240c9cd9f2 100644 --- a/engines/titanic/game/glass_smasher.cpp +++ b/engines/titanic/game/glass_smasher.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/glass_smasher.h" +#include "titanic/translation.h" namespace Titanic { @@ -41,7 +42,7 @@ void CGlassSmasher::load(SimpleFile *file) { bool CGlassSmasher::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); - playSound("b#40.wav"); + playSound(TRANSLATE("b#40.wav", "b#19.wav")); playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); return true; } diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index e71562f9d4..da0e7223b1 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -22,6 +22,7 @@ #include "titanic/game/gondolier/gondolier_mixer.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -173,7 +174,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { CVisibleMsg visibleMsg; visibleMsg.execute("Mouth"); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); } else { CSetVolumeMsg volumeMsg(_volume1, 2); volumeMsg.execute(this); diff --git a/engines/titanic/game/hammer_dispensor_button.cpp b/engines/titanic/game/hammer_dispensor_button.cpp index 661a92eb17..275ef204b2 100644 --- a/engines/titanic/game/hammer_dispensor_button.cpp +++ b/engines/titanic/game/hammer_dispensor_button.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/translation.h" namespace Titanic { @@ -68,7 +69,7 @@ bool CHammerDispensorButton::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { } bool CHammerDispensorButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - playSound("z#93.wav"); + playSound(TRANSLATE("z#93.wav", "z#624.wav")); petDisplayMessage(1, POKE_WITH_LONG_STICK); return true; } @@ -97,7 +98,7 @@ bool CHammerDispensorButton::FrameMsg(CFrameMsg *msg) { if (!_open) { if (flag) { - playSound("z#93.wav"); + playSound(TRANSLATE("z#93.wav", "z#624.wav")); if (++_hitCounter == 5) { if (!_hammerTaken) { CActMsg actMsg(_msgAction); diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp index dabed26478..87f48c5d6c 100644 --- a/engines/titanic/game/head_smash_lever.cpp +++ b/engines/titanic/game/head_smash_lever.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/head_smash_lever.h" +#include "titanic/translation.h" namespace Titanic { @@ -55,14 +56,14 @@ void CHeadSmashLever::load(SimpleFile *file) { bool CHeadSmashLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_enabled) { playMovie(0, 14, 0); - playSound("z#54.wav"); - int soundHandle = playSound("z#45.wav"); - queueSound("z#49.wav", soundHandle); + playSound(TRANSLATE("z#54.wav", "z#585.wav")); + int soundHandle = playSound(TRANSLATE("z#45.wav", "z#576.wav")); + queueSound(TRANSLATE("z#49.wav", "z#580.wav"), soundHandle); _ticks = getTicksCount(); _fieldE4 = true; } else { playMovie(0); - playSound("z#56.wav"); + playSound(TRANSLATE("z#56.wav", "z#587.wav")); } return true; @@ -84,7 +85,7 @@ bool CHeadSmashLever::FrameMsg(CFrameMsg *msg) { CActMsg actMsg2("PlayToEnd"); actMsg2.execute("SmashingStatue"); - playSound("b#16.wav"); + playSound(TRANSLATE("b#16.wav", "b#100.wav")); _fieldE4 = false; } diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 30fc53463f..cd2d9f3f39 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -23,6 +23,7 @@ #include "titanic/game/light.h" #include "titanic/game/television.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -109,10 +110,10 @@ bool CLight::StatusChangeMsg(CStatusChangeMsg *msg) { if (_eyePresent && isYourStateroom) { petDisplayMessage(1, LIGHT_IS_LOOSE); - playSound("z#144.wav", 70); + playSound(TRANSLATE("z#144.wav", "z#700.wav"), 70); } else { petDisplayMessage(1, LUMI_GLOW_LIGHTS); - playSound("z#62.wav", 70); + playSound(TRANSLATE("z#62.wav", "z#593.wav"), 70); } return true; @@ -124,10 +125,10 @@ bool CLight::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_eyePresent && isYourStateroom) { petDisplayMessage(1, LIGHT_IS_LOOSE); - playSound("z#144.wav", 70); + playSound(TRANSLATE("z#144.wav", "z#700.wav"), 70); } else { petDisplayMessage(1, LUMI_GLOW_LIGHTS); - playSound("z#62.wav", 70); + playSound(TRANSLATE("z#62.wav", "z#593.wav"), 70); } return true; diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index c340cae75b..50d46e4ae0 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -23,6 +23,7 @@ #include "titanic/game/long_stick_dispenser.h" #include "titanic/core/project_item.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -62,7 +63,7 @@ bool CLongStickDispenser::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { _fieldC0 = 1; loadFrame(19); } else if (_fieldC0 != 1) { - playSound(g_vm->isGerman() ? "z#594.wav" : "z#63.wav"); + playSound(TRANSLATE("z#63.wav", "z#594.wav")); petDisplayMessage(1, GLASS_IS_UNBREAKABLE); } @@ -89,7 +90,7 @@ bool CLongStickDispenser::EnterRoomMsg(CEnterRoomMsg *msg) { bool CLongStickDispenser::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (!_fieldC0) { - playSound("z#62.wav"); + playSound(TRANSLATE("z#62.wav", "z#593.wav")); switch (_fieldBC) { case 0: diff --git a/engines/titanic/game/maitred/maitred_body.cpp b/engines/titanic/game/maitred/maitred_body.cpp index 4cb12aac8f..4f8ca301c0 100644 --- a/engines/titanic/game/maitred/maitred_body.cpp +++ b/engines/titanic/game/maitred/maitred_body.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/maitred/maitred_body.h" +#include "titanic/translation.h" namespace Titanic { @@ -66,7 +67,7 @@ bool CMaitreDBody::ActMsg(CActMsg *msg) { if (msg->_action == "LoseArm") { _armed = false; loadFrame(262); - playSound("c#75.wav"); + playSound(TRANSLATE("c#75.wav", "c#57.wav")); } return true; diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp index c2f181d529..e60f695e88 100644 --- a/engines/titanic/game/missiveomat.cpp +++ b/engines/titanic/game/missiveomat.cpp @@ -24,6 +24,7 @@ #include "titanic/core/room_item.h" #include "titanic/support/files_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -90,7 +91,7 @@ bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) { if (!msg->_key) return true; - playSound("z#228.wav"); + playSound(TRANSLATE("z#228.wav", "z#134.wav")); editMsg._mode = EDIT_KEYPRESS; editMsg._param = msg->_key; editMsg.execute(loginControl); @@ -120,7 +121,7 @@ bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) { if (!msg->_key) return true; - playSound("z#228.wav"); + playSound(TRANSLATE("z#228.wav", "z#134.wav")); editMsg._mode = EDIT_KEYPRESS; editMsg._param = msg->_key; editMsg.execute(loginControl); diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp index 8002eebcb5..ba3be2b644 100644 --- a/engines/titanic/game/nav_helmet.cpp +++ b/engines/titanic/game/nav_helmet.cpp @@ -22,6 +22,8 @@ #include "titanic/game/nav_helmet.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/star_control/star_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -37,26 +39,26 @@ END_MESSAGE_MAP() void CNavHelmet::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_flag, indent); + file->writeNumberLine(_helmetOn, indent); CGameObject::save(file, indent); } void CNavHelmet::load(SimpleFile *file) { file->readNumber(); - _flag = file->readNumber(); + _helmetOn = file->readNumber(); CGameObject::load(file); } bool CNavHelmet::MovieEndMsg(CMovieEndMsg *msg) { - if (_flag) { + CPetControl *pet = getPetControl(); + assert(pet); + + if (_helmetOn && pet->isAreaUnlocked()) { setVisible(false); - CPetControl *pet = getPetControl(); - if (pet) { - pet->setArea(PET_STARFIELD); - petDisplayMessage(1, ADJUST_VIEWING_APPARATUS); - pet->incAreaLocks(); - } + pet->setArea(PET_STARFIELD); + petDisplayMessage(1, ADJUST_VIEWING_APPARATUS); + pet->incAreaLocks(); starFn(STAR_SHOW); starFn(STAR_12); @@ -67,6 +69,7 @@ bool CNavHelmet::MovieEndMsg(CMovieEndMsg *msg) { bool CNavHelmet::EnterViewMsg(CEnterViewMsg *msg) { petSetRemoteTarget(); + loadFrame(120); return true; } @@ -78,13 +81,13 @@ bool CNavHelmet::LeaveViewMsg(CLeaveViewMsg *msg) { bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) { CPetControl *pet = getPetControl(); - if (_flag) { - _flag = false; + if (_helmetOn) { + _helmetOn = false; setVisible(true); starFn(STAR_HIDE); playMovie(61, 120, MOVIE_NOTIFY_OBJECT); - playSound("a#47.wav"); - playSound("a#48.wav"); + playSound(TRANSLATE("a#47.wav", "a#40.wav")); + playSound(TRANSLATE("a#48.wav", "a#41.wav")); if (pet) { pet->decAreaLocks(); @@ -94,31 +97,47 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) { decTransitions(); } else { incTransitions(); - _flag = true; + _helmetOn = true; setVisible(true); playMovie(0, 60, MOVIE_NOTIFY_OBJECT); - playSound("a#48.wav"); - playSound("a#47.wav"); + playSound(TRANSLATE("a#48.wav", "a#41.wav")); + playSound(TRANSLATE("a#47.wav", "a#40.wav")); } return true; } bool CNavHelmet::PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg) { - if (_flag) + if (_helmetOn) starFn(STAR_TOGGLE_MODE); return true; } bool CNavHelmet::PETStarFieldLockMsg(CPETStarFieldLockMsg *msg) { - if (_flag) { - if (msg->_value) { - playSound("a#6.wav"); - starFn(LOCK_STAR); - } else { - playSound("a#5.wav"); - starFn(UNLOCK_STAR); + if (_helmetOn) { + CPetControl *pet = getPetControl(); + CStarControl *starControl = nullptr; + bool isStarFieldMode = false; + + if (pet) + starControl = pet->getStarControl(); + + if (starControl) + isStarFieldMode = starControl->isStarFieldMode(); + + if (isStarFieldMode) { + // locking and unlocking only in starfield + // It already does this without the conditional + // but now it will also not play the sounds in + // photoview + if (msg->_value) { + playSound(TRANSLATE("a#6.wav", "a#58.wav")); + starFn(LOCK_STAR); + } else { + playSound(TRANSLATE("a#5.wav", "a#57.wav")); + starFn(UNLOCK_STAR); + } } } diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h index c408d05c97..6e30c4b9c1 100644 --- a/engines/titanic/game/nav_helmet.h +++ b/engines/titanic/game/nav_helmet.h @@ -38,10 +38,10 @@ class CNavHelmet : public CGameObject { bool PETStarFieldLockMsg(CPETStarFieldLockMsg *msg); bool PETSetStarDestinationMsg(CPETSetStarDestinationMsg *msg); private: - bool _flag; + bool _helmetOn; public: CLASSDEF; - CNavHelmet() : CGameObject(), _flag(false) {} + CNavHelmet() : CGameObject(), _helmetOn(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/nose_holder.cpp b/engines/titanic/game/nose_holder.cpp index d00c7b372e..be17d536b0 100644 --- a/engines/titanic/game/nose_holder.cpp +++ b/engines/titanic/game/nose_holder.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/nose_holder.h" +#include "titanic/translation.h" namespace Titanic { @@ -54,7 +55,7 @@ bool CNoseHolder::ActMsg(CActMsg *msg) { if (msg->_action == "Sneeze" && !_itemName.empty() && _dropEnabled) { CProximity prox; prox._positioningMode = POSMODE_VECTOR; - playSound("z#35.wav", prox); + playSound(TRANSLATE("z#35.wav", "z#567.wav"), prox); if (getView() == findView()) { setVisible(true); diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp index 56c096eec1..440c874536 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -22,6 +22,7 @@ #include "titanic/game/parrot/parrot_nut_bowl_actor.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -70,7 +71,7 @@ bool CParrotNutBowlActor::BowlStateChangeMsg(CBowlStateChangeMsg *msg) { if (!_puzzleDone) { CReplaceBowlAndNutsMsg replaceMsg; replaceMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); } _puzzleDone = true; diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp index c8d944632f..4e0476d77a 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.cpp +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -22,6 +22,7 @@ #include "titanic/game/parrot/parrot_nut_eater.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -55,7 +56,7 @@ bool CParrotNutEater::MovieEndMsg(CMovieEndMsg *msg) { CNutPuzzleMsg nutMsg("NutsGone"); nutMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); return true; } @@ -70,7 +71,7 @@ bool CParrotNutEater::NutPuzzleMsg(CNutPuzzleMsg *msg) { playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(68); movieEvent(132); - playSound("z#215.wav"); + playSound(TRANSLATE("z#215.wav", "z#6.wav")); CTrueTalkTriggerActionMsg triggerMsg; triggerMsg._param1 = triggerMsg._param2 = 0; @@ -85,10 +86,10 @@ bool CParrotNutEater::MovieFrameMsg(CMovieFrameMsg *msg) { switch (msg->_frameNumber) { case 68: - playSound("z#214.wav", prox); + playSound(TRANSLATE("z#214.wav", "z#5.wav"), prox); break; case 132: - playSound("z#216.wav", prox); + playSound(TRANSLATE("z#216.wav", "z#7.wav"), prox); break; default: break; diff --git a/engines/titanic/game/pet/pet_sounds.cpp b/engines/titanic/game/pet/pet_sounds.cpp index b2c9902cc8..74aaedafbe 100644 --- a/engines/titanic/game/pet/pet_sounds.cpp +++ b/engines/titanic/game/pet/pet_sounds.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/pet/pet_sounds.h" +#include "titanic/translation.h" namespace Titanic { @@ -43,11 +44,11 @@ void CPETSounds::load(SimpleFile *file) { bool CPETSounds::PETPlaySoundMsg(CPETPlaySoundMsg *msg) { if (msg->_soundNum == 1) { - playSound("z#65.wav"); + playSound(TRANSLATE("z#65.wav", "z#596.wav")); } else if (msg->_soundNum == 2 && stateGetParrotMet()) { uint ticks = getTicksCount(); if (!_ticks || ticks > (_ticks + 12000)) { - playSound("z#36.wav"); + playSound(TRANSLATE("z#36.wav", "z#568.wav")); _ticks = ticks; } } diff --git a/engines/titanic/game/record_phonograph_button.cpp b/engines/titanic/game/record_phonograph_button.cpp index 1bd2060193..a52183906b 100644 --- a/engines/titanic/game/record_phonograph_button.cpp +++ b/engines/titanic/game/record_phonograph_button.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/record_phonograph_button.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,7 +47,7 @@ bool CRecordPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { recordMsg.execute(getParent()); if (recordMsg._canRecord) { - playSound("z#58.wav"); + playSound(TRANSLATE("z#58.wav", "z#589.wav")); loadFrame(1); _active = true; } @@ -56,7 +57,7 @@ bool CRecordPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CRecordPhonographButton::PhonographStopMsg(CPhonographStopMsg *msg) { if (_active) { - playSound("z#57.wav"); + playSound(TRANSLATE("z#57.wav", "z#588.wav")); loadFrame(0); _active = false; } diff --git a/engines/titanic/game/replacement_ear.cpp b/engines/titanic/game/replacement_ear.cpp index d1274e92db..fff209202b 100644 --- a/engines/titanic/game/replacement_ear.cpp +++ b/engines/titanic/game/replacement_ear.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/replacement_ear.h" +#include "titanic/translation.h" namespace Titanic { @@ -41,7 +42,7 @@ void CReplacementEar::load(SimpleFile *file) { bool CReplacementEar::VisibleMsg(CVisibleMsg *msg) { setVisible(true); playMovie(MOVIE_WAIT_FOR_FINISH); - playSound("z#64.wav"); + playSound(TRANSLATE("z#64.wav", "z#595.wav")); return true; } diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index 7b395e5b11..993a577fd7 100644 --- a/engines/titanic/game/sauce_dispensor.cpp +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -23,6 +23,7 @@ #include "titanic/game/sauce_dispensor.h" #include "titanic/carry/chicken.h" #include "titanic/carry/glass.h" +#include "titanic/translation.h" namespace Titanic { @@ -73,7 +74,7 @@ bool CSauceDispensor::Use(CUse *msg) { CChicken *chicken = static_cast<CChicken *>(msg->_item); _field104 = true; if (_starlingsDead) { - playSound("b#15.wav", 50); + playSound(TRANSLATE("b#15.wav", "z#562.wav"), 50); if (chicken->_condiment != "None") { petDisplayMessage(1, FOODSTUFF_ALREADY_GARNISHED); @@ -96,7 +97,7 @@ bool CSauceDispensor::Use(CUse *msg) { CMovieEndMsg endMsg(0, 0); endMsg.execute(this); - playSound("z#120.wav"); + playSound(TRANSLATE("z#120.wav", "z#651.wav")); petDisplayMessage(1, DISPENSOR_IS_EMPTY); } else if (msg->_item->isEquals("BeerGlass")) { diff --git a/engines/titanic/game/search_point.cpp b/engines/titanic/game/search_point.cpp index bbe923267a..da5c4e5d55 100644 --- a/engines/titanic/game/search_point.cpp +++ b/engines/titanic/game/search_point.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/search_point.h" +#include "titanic/translation.h" namespace Titanic { @@ -47,7 +48,7 @@ bool CSearchPoint::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { child->petAddToInventory(); CVisibleMsg visibleMsg(true); visibleMsg.execute(child->getName()); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); } if (--_value == 0) diff --git a/engines/titanic/game/seasonal_adjustment.cpp b/engines/titanic/game/seasonal_adjustment.cpp index 7a729c9d90..f9f834eed4 100644 --- a/engines/titanic/game/seasonal_adjustment.cpp +++ b/engines/titanic/game/seasonal_adjustment.cpp @@ -22,6 +22,7 @@ #include "titanic/game/seasonal_adjustment.h" #include "titanic/core/project_item.h" +#include "titanic/translation.h" namespace Titanic { @@ -79,7 +80,7 @@ bool CSeasonalAdjustment::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CSeasonalAdjustment::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - playSound("z#42.wav"); + playSound(TRANSLATE("z#42.wav", "z#743.wav")); if (!_enabled) { petDisplayMessage(1, SEASONAL_SWITCH_NOT_WORKING); } else if (!_switching) { diff --git a/engines/titanic/game/sgt/armchair.cpp b/engines/titanic/game/sgt/armchair.cpp index 6c0e7fe0ca..e9348f4484 100644 --- a/engines/titanic/game/sgt/armchair.cpp +++ b/engines/titanic/game/sgt/armchair.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/armchair.h" +#include "titanic/translation.h" namespace Titanic { @@ -56,7 +57,7 @@ bool CArmchair::TurnOn(CTurnOn *msg) { } playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); - playSound("b#0.wav"); + playSound(TRANSLATE("b#0.wav", "b#85.wav")); _statics->_armchair = "Open"; _isClosed = false; } @@ -71,7 +72,7 @@ bool CArmchair::TurnOff(CTurnOff *msg) { _endFrame = 21; _isClosed = true; playMovie(11, 21, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound("b#0.wav"); + playSound(TRANSLATE("b#0.wav", "b#85.wav")); } return true; diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp index fe3216e002..2aef5bdc9d 100644 --- a/engines/titanic/game/sgt/basin.cpp +++ b/engines/titanic/game/sgt/basin.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/basin.h" +#include "titanic/translation.h" namespace Titanic { @@ -49,7 +50,7 @@ bool CBasin::TurnOn(CTurnOn *msg) { _startFrame = 0; _endFrame = 6; playMovie(0, 6, MOVIE_WAIT_FOR_FINISH); - playSound("b#13.wav"); + playSound(TRANSLATE("b#13.wav", "b#98.wav")); } return true; @@ -62,7 +63,7 @@ bool CBasin::TurnOff(CTurnOff *msg) { _startFrame = 8; _endFrame = 14; playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#13.wav"); + playSound(TRANSLATE("b#13.wav", "b#98.wav")); } return true; diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp index 8f90e0f100..0cd4eec4a3 100644 --- a/engines/titanic/game/sgt/bedfoot.cpp +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/bedfoot.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,11 +47,11 @@ bool CBedfoot::TurnOn(CTurnOn *msg) { if (_statics->_washstand == "Open") { _endFrame = 13; _statics->_bedfoot = "Open"; - playSound("b#7.wav"); + playSound(TRANSLATE("b#7.wav", "b#92.wav")); } else { _endFrame = 17; _statics->_bedfoot = "NotOnWashstand"; - playSound("b#4.wav"); + playSound(TRANSLATE("b#4.wav", "b#89.wav")); } playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); @@ -95,7 +96,7 @@ bool CBedfoot::TurnOff(CTurnOff *msg) { } playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); - playSound("b#7.wav"); + playSound(TRANSLATE("b#7.wav", "b#92.wav")); } else if (_statics->_bedfoot == "NotOnWashstand" && _statics->_bedhead == "ClosedWrong") { _isClosed = true; @@ -110,14 +111,14 @@ bool CBedfoot::TurnOff(CTurnOff *msg) { } playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); - playSound("b#7.wav"); + playSound(TRANSLATE("b#7.wav", "b#92.wav")); } else if (_statics->_bedfoot == "RestingUTV" && _statics->_tv == "Closed") { _statics->_bedfoot = "Closed"; _startFrame = 25; _endFrame = 30; playMovie(25, 30, MOVIE_WAIT_FOR_FINISH); - playSound("b#7.wav"); + playSound(TRANSLATE("b#7.wav", "b#92.wav")); } if (_statics->_bedfoot == "Closed") diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index 7775ad38dc..b94c2cc46b 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -23,6 +23,7 @@ #include "titanic/game/sgt/bedhead.h" #include "titanic/support/files_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -112,7 +113,7 @@ bool CBedhead::TurnOn(CTurnOn *msg) { _statics->_bedhead = entry._name4; playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#6.wav"); + playSound(TRANSLATE("b#6.wav", "b#91.wav")); _isClosed = false; } } diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp index 648308fc8f..c9664d21ea 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.cpp +++ b/engines/titanic/game/sgt/chest_of_drawers.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/chest_of_drawers.h" +#include "titanic/translation.h" namespace Titanic { @@ -47,7 +48,7 @@ bool CChestOfDrawers::TurnOn(CTurnOn *msg) { _startFrame = 1; _endFrame = 14; playMovie(1, 14, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#11.wav"); + playSound(TRANSLATE("b#11.wav", "b#96.wav")); } return true; @@ -55,7 +56,7 @@ bool CChestOfDrawers::TurnOn(CTurnOn *msg) { bool CChestOfDrawers::TurnOff(CTurnOff *msg) { if (_statics->_chestOfDrawers == "Open" && _statics->_drawer == "Closed") { - CVisibleMsg visibleMsg; + CVisibleMsg visibleMsg(false); visibleMsg.execute("Drawer"); _statics->_chestOfDrawers = "Closed"; _isClosed = true; @@ -63,7 +64,7 @@ bool CChestOfDrawers::TurnOff(CTurnOff *msg) { _startFrame = 14; _endFrame = 27; playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#11.wav"); + playSound(TRANSLATE("b#11.wav", "b#96.wav")); } return true; diff --git a/engines/titanic/game/sgt/desk.cpp b/engines/titanic/game/sgt/desk.cpp index 1aea9a8ab3..3bc76e703c 100644 --- a/engines/titanic/game/sgt/desk.cpp +++ b/engines/titanic/game/sgt/desk.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/desk.h" +#include "titanic/translation.h" namespace Titanic { @@ -48,7 +49,7 @@ bool CDesk::TurnOn(CTurnOn *msg) { _startFrame = 1; _endFrame = 26; playMovie(1, 26, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#12.wav"); + playSound(TRANSLATE("b#12.wav", "b#97.wav")); } return true; @@ -65,7 +66,7 @@ bool CDesk::TurnOff(CTurnOff *msg) { _startFrame = 26; _endFrame = 51; playMovie(26, 51, MOVIE_WAIT_FOR_FINISH); - playSound("b#9.wav"); + playSound(TRANSLATE("b#9.wav", "b#94.wav")); } return true; diff --git a/engines/titanic/game/sgt/deskchair.cpp b/engines/titanic/game/sgt/deskchair.cpp index 23b6ad64d7..c1363a4e03 100644 --- a/engines/titanic/game/sgt/deskchair.cpp +++ b/engines/titanic/game/sgt/deskchair.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/deskchair.h" +#include "titanic/translation.h" namespace Titanic { @@ -49,7 +50,7 @@ bool CDeskchair::TurnOn(CTurnOn *msg) { _startFrame = 0; _endFrame = 16; playMovie(0, 16, MOVIE_WAIT_FOR_FINISH); - playSound("b#8.wav"); + playSound(TRANSLATE("b#8.wav", "b#93.wav")); } return true; @@ -62,7 +63,7 @@ bool CDeskchair::TurnOff(CTurnOff *msg) { _startFrame = 16; _endFrame = 32; playMovie(16, 32, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#2.wav"); + playSound(TRANSLATE("b#2.wav", "b#87.wav")); } return true; diff --git a/engines/titanic/game/sgt/drawer.cpp b/engines/titanic/game/sgt/drawer.cpp index 7288bbdc61..9c7736a72f 100644 --- a/engines/titanic/game/sgt/drawer.cpp +++ b/engines/titanic/game/sgt/drawer.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/drawer.h" +#include "titanic/translation.h" namespace Titanic { @@ -54,7 +55,7 @@ bool CDrawer::TurnOn(CTurnOn *msg) { setVisible(true); _statics->_drawer = "Open"; playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#10.wav"); + playSound(TRANSLATE("b#10.wav", "b#95.wav")); } return true; @@ -67,7 +68,7 @@ bool CDrawer::TurnOff(CTurnOff *msg) { _endFrame = 100; _isClosed = true; playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); - playSound("b#10.wav"); + playSound(TRANSLATE("b#10.wav", "b#95.wav")); } return true; diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index 3ddfcfef5f..ca6acaef16 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -22,6 +22,7 @@ #include "titanic/game/sgt/sgt_state_room.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -141,7 +142,7 @@ bool CSGTStateRoom::EnterRoomMsg(CEnterRoomMsg *msg) { if (roomFlags == assignedRoom && getPassengerClass() == 3 && _statics->_announcementFlag) { // Congratulations, you may have won an upgrade - playSound("b#21.wav"); + playSound(TRANSLATE("b#21.wav", "b#2.wav")); _statics->_announcementFlag = false; } diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp index 0f796c2b9d..a4541bf377 100644 --- a/engines/titanic/game/sgt/toilet.cpp +++ b/engines/titanic/game/sgt/toilet.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/toilet.h" +#include "titanic/translation.h" namespace Titanic { @@ -51,7 +52,7 @@ bool CToilet::TurnOn(CTurnOn *msg) { _startFrame = 0; _endFrame = 11; playMovie(0, 11, MOVIE_WAIT_FOR_FINISH); - playSound("b#1.wav"); + playSound(TRANSLATE("b#1.wav", "b#86.wav")); } return true; @@ -64,8 +65,8 @@ bool CToilet::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 11; _endFrame = 18; - playMovie(11, 18, MOVIE_WAIT_FOR_FINISH); - playSound("b#1.wav"); + playMovie(11, 18, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playSound(TRANSLATE("b#1.wav", "b#86.wav")); } return true; diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp index 217e36c1e9..a087969dba 100644 --- a/engines/titanic/game/sgt/washstand.cpp +++ b/engines/titanic/game/sgt/washstand.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/washstand.h" +#include "titanic/translation.h" namespace Titanic { @@ -48,7 +49,7 @@ bool CWashstand::TurnOn(CTurnOn *msg) { _startFrame = 0; _endFrame = 14; playMovie(0, 14, MOVIE_WAIT_FOR_FINISH); - playSound("b#14.wav"); + playSound(TRANSLATE("b#14.wav", "b#99.wav")); } return true; @@ -62,7 +63,7 @@ bool CWashstand::TurnOff(CTurnOff *msg) { _startFrame = 14; _endFrame = 28; playMovie(14, 28, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound("b#14.wav"); + playSound(TRANSLATE("b#14.wav", "b#99.wav")); } return true; diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp index 7f5580abb5..460cf0fdc1 100644 --- a/engines/titanic/game/speech_dispensor.cpp +++ b/engines/titanic/game/speech_dispensor.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/speech_dispensor.h" +#include "titanic/translation.h" namespace Titanic { @@ -85,7 +86,7 @@ bool CSpeechDispensor::FrameMsg(CFrameMsg *msg) { switch (_state) { case 0: - playSound("z#93.wav"); + playSound(TRANSLATE("z#93.wav", "z#624.wav")); if (_seasonNum == SEASON_WINTER) { petDisplayMessage(1, FROZEN_TO_BRANCH); _hitCounter = 0; @@ -120,7 +121,7 @@ bool CSpeechDispensor::FrameMsg(CFrameMsg *msg) { bool CSpeechDispensor::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (!_speechFallen) { - playSound("z#93.wav"); + playSound(TRANSLATE("z#93.wav", "z#624.wav")); if (_failureType) { petDisplayMessage(1, OUT_OF_REACH); } else { diff --git a/engines/titanic/game/stop_phonograph_button.cpp b/engines/titanic/game/stop_phonograph_button.cpp index 75e0ca9337..fb3451238c 100644 --- a/engines/titanic/game/stop_phonograph_button.cpp +++ b/engines/titanic/game/stop_phonograph_button.cpp @@ -26,6 +26,7 @@ namespace Titanic { BEGIN_MESSAGE_MAP(CStopPhonographButton, CBackground) ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(TimerMsg) END_MESSAGE_MAP() void CStopPhonographButton::save(SimpleFile *file, int indent) { @@ -44,7 +45,7 @@ bool CStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (!queryMsg._value) { playMovie(0, 1, 0); - playMovie(1, 0, 0); + addTimer(200); CPhonographStopMsg stopMsg; stopMsg.execute(getParent()); @@ -53,4 +54,9 @@ bool CStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } +bool CStopPhonographButton::TimerMsg(CTimerMsg *msg) { + playMovie(1, 0, 0); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h index d416c4f8fe..07a19cc103 100644 --- a/engines/titanic/game/stop_phonograph_button.h +++ b/engines/titanic/game/stop_phonograph_button.h @@ -30,6 +30,7 @@ namespace Titanic { class CStopPhonographButton : public CBackground { DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool TimerMsg(CTimerMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp index 48cc84815a..ced6f662e9 100644 --- a/engines/titanic/game/sub_glass.cpp +++ b/engines/titanic/game/sub_glass.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sub_glass.h" +#include "titanic/translation.h" namespace Titanic { @@ -67,7 +68,7 @@ bool CSUBGlass::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (!_fieldBC && _startFrame >= 0) { _fieldBC = true; playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT); - playSound("z#30.wav"); + playSound(TRANSLATE("z#30.wav", "z#561.wav")); } return true; @@ -89,7 +90,7 @@ bool CSUBGlass::SignalObject(CSignalObject *msg) { if (_signalStartFrame >= 0) { playMovie(_signalStartFrame, _signalEndFrame, MOVIE_WAIT_FOR_FINISH); - playSound("z#30.wav"); + playSound(TRANSLATE("z#30.wav", "z#561.wav")); _fieldBC = false; } } diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp index a1d0dc2b01..81d93939d5 100644 --- a/engines/titanic/game/sweet_bowl.cpp +++ b/engines/titanic/game/sweet_bowl.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sweet_bowl.h" +#include "titanic/translation.h" namespace Titanic { @@ -47,8 +48,8 @@ bool CSweetBowl::MovieEndMsg(CMovieEndMsg *msg) { bool CSweetBowl::EnterViewMsg(CEnterViewMsg *msg) { setVisible(false); - loadSound("b#43.wav"); - loadSound("b#42.wav"); + loadSound(TRANSLATE("b#43.wav", "b#26.wav")); + loadSound(TRANSLATE("b#42.wav", "b#25.wav")); return true; } @@ -56,7 +57,9 @@ bool CSweetBowl::ActMsg(CActMsg *msg) { if (msg->_action == "Jiggle") { setVisible(true); playMovie(MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound(getRandomNumber(1) == 1 ? "b#42.wav" : "b#43.wav"); + playSound(getRandomNumber(1) == 1 ? + TRANSLATE("b#42.wav", "b#25.wav") : + TRANSLATE("b#43.wav", "b#26.wav")); } petDisplayMessage(isEquals("BowlNutsRustler") ? diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 7c1e33cce4..be5d1ae40e 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -26,6 +26,7 @@ #include "titanic/debugger.h" #include "titanic/game/get_lift_eye2.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -245,8 +246,8 @@ bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { // You may be a winner CProximity prox1, prox2; prox1._soundType = prox2._soundType = Audio::Mixer::kSpeechSoundType; - playSound("z#47.wav", prox1); - _soundHandle = playSound("b#20.wav", prox2); + playSound(TRANSLATE("z#47.wav", "z#578.wav"), prox1); + _soundHandle = playSound(TRANSLATE("b#20.wav", "b#1.wav"), prox2); // Get the room flags for the SGT floor we're on CPetControl *pet = getPetControl(); diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp index 680fc7e29f..ba01b32620 100644 --- a/engines/titanic/game/throw_tv_down_well.cpp +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/throw_tv_down_well.h" +#include "titanic/translation.h" namespace Titanic { @@ -68,7 +69,7 @@ bool CThrowTVDownWell::EnterViewMsg(CEnterViewMsg *msg) { bool CThrowTVDownWell::MovieEndMsg(CMovieEndMsg *msg) { sleep(2000); changeView("ParrotLobby.Node 11.N"); - playSound("z#471.wav"); + playSound(TRANSLATE("z#471.wav", "z#208.wav")); addTimer(2, 7000, 0); return true; } @@ -77,19 +78,19 @@ bool CThrowTVDownWell::TimerMsg(CTimerMsg *msg) { if (msg->_actionVal == 1) { changeView("ParrotLobby.Node 10.N"); } else if (msg->_actionVal == 2) { - playSound("z#468.wav", 50); + playSound(TRANSLATE("z#468.wav", "z#205.wav"), 50); sleep(1500); changeView(_viewName); _viewName = "NULL"; unlockMouse(); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); } return true; } bool CThrowTVDownWell::MovieFrameMsg(CMovieFrameMsg *msg) { - playSound("z#470.wav"); + playSound(TRANSLATE("z#470.wav", "z#207.wav")); return true; } diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index 2dfede3d63..568e5becaf 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -24,6 +24,7 @@ #include "titanic/debugger.h" #include "titanic/moves/multi_move.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -100,8 +101,7 @@ bool CLift::StatusChangeMsg(CStatusChangeMsg *msg) { 354, 349, 344, 339, 334, 329, 324, 319, 299 }; - if (pet) - pet->setRoomsFloorNum(floorNum); + pet->setRoomsFloorNum(floorNum); if (pet->getRoomsElevatorNum() == 2 || pet->getRoomsElevatorNum() == 4) { if (floorNum > 27) floorNum = 27; @@ -242,9 +242,9 @@ bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) { CPetControl *pet = getPetControl(); int floorNum = pet->getRoomsFloorNum(); int elevNum = pet->getRoomsElevatorNum(); - loadSound("z#520.wav"); - loadSound("z#519.wav"); - loadSound("z#518.wav"); + loadSound(TRANSLATE("z#520.wav", "z#259.wav")); + loadSound(TRANSLATE("z#519.wav", "z#258.wav")); + loadSound(TRANSLATE("z#518.wav", "z#257.wav")); if (elevNum == 4 && _hasHead && !_hasCorrectHead) { CVisibleMsg visibleMsg; @@ -252,17 +252,17 @@ bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) { } if (floorNum < 20) { - playGlobalSound("z#520.wav", VOL_QUIET, true, true, 0); - playGlobalSound("z#519.wav", VOL_MUTE, false, true, 1); - playGlobalSound("z#518.wav", VOL_MUTE, false, true, 2); + playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_QUIET, true, true, 0); + playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1); + playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2); } else if (floorNum < 28) { - playGlobalSound("z#520.wav", VOL_MUTE, false, true, 0); - playGlobalSound("z#519.wav", VOL_QUIET, true, true, 1); - playGlobalSound("z#518.wav", VOL_MUTE, false, true, 2); + playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0); + playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_QUIET, true, true, 1); + playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_MUTE, false, true, 2); } else { - playGlobalSound("z#520.wav", VOL_MUTE, false, true, 0); - playGlobalSound("z#519.wav", VOL_MUTE, false, true, 1); - playGlobalSound("z#518.wav", VOL_QUIET, true, true, 2); + playGlobalSound(TRANSLATE("z#520.wav", "z#259.wav"), VOL_MUTE, false, true, 0); + playGlobalSound(TRANSLATE("z#519.wav", "z#258.wav"), VOL_MUTE, false, true, 1); + playGlobalSound(TRANSLATE("z#518.wav", "z#257.wav"), VOL_QUIET, true, true, 2); } } diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 4ef5314592..9958226c6b 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -22,15 +22,22 @@ #include "titanic/game/transport/pellerator.h" #include "titanic/core/room_item.h" +#include "titanic/translation.h" namespace Titanic { -static const char *const WAVE_NAMES[10] = { +static const char *const WAVE_NAMES_EN[10] = { "z#465.wav", "z#456.wav", "z#455.wav", "z#453.wav", "z#452.wav", "NoStandingInFunnyWays", "z#450.wav", "z#449.wav", "z#435.wav", "z#434.wav" }; +static const char *const WAVE_NAMES_DE[10] = { + "z#202.wav", "z#193.wav", "z#192.wav", "z#190.wav", + "z#189.wav", "NoStandingInFunnyWays", "z#187.wav", + "z#186.wav", "z#180.wav", "z#179.wav" +}; + BEGIN_MESSAGE_MAP(CPellerator, CTransport) ON_MESSAGE(StatusChangeMsg) ON_MESSAGE(EnterRoomMsg) @@ -62,7 +69,7 @@ void CPellerator::load(SimpleFile *file) { bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); - playGlobalSound("z#74.wav", VOL_QUIET, true, true, 0); + playGlobalSound(TRANSLATE("z#74.wav", "z#605.wav"), VOL_QUIET, true, true, 0); int classNum = getPassengerClass(); int newDest = msg->_newStatus; @@ -288,8 +295,11 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) { if (isEquals("PelleratorObject")) { + if (g_language == Common::DE_DEU) + _soundHandle = queueSound("z#200.wav", _soundHandle); + for (int idx = 0; idx < 10; ++idx) - loadSound(WAVE_NAMES[idx]); + loadSound(TRANSLATE(WAVE_NAMES_EN[idx], WAVE_NAMES_DE[idx])); addTimer(10000); } @@ -332,22 +342,22 @@ bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) { switch (_destination) { case 0: - _soundHandle = queueSound("z#429.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#429.wav", "z#174.wav"), _soundHandle); break; case 1: - _soundHandle = queueSound("z#430.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#430.wav", "z#175.wav"), _soundHandle); break; case 2: - _soundHandle = queueSound("z#431.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#431.wav", "z#176.wav"), _soundHandle); break; case 4: - _soundHandle = queueSound("z#428.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#428.wav", "z#173.wav"), _soundHandle); break; case 5: - _soundHandle = queueSound("z#433.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#433.wav", "z#178.wav"), _soundHandle); break; case 6: - _soundHandle = queueSound("z#432.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("z#432.wav", "z#177.wav"), _soundHandle); break; default: break; @@ -358,7 +368,8 @@ bool CPellerator::MovieEndMsg(CMovieEndMsg *msg) { bool CPellerator::TimerMsg(CTimerMsg *msg) { if (compareRoomNameTo("Pellerator")) { - _soundHandle = queueSound(WAVE_NAMES[getRandomNumber(9)], _soundHandle); + _soundHandle = queueSound(TRANSLATE(WAVE_NAMES_EN[getRandomNumber(9)], + WAVE_NAMES_DE[getRandomNumber(9)]), _soundHandle); addTimer(20000 + getRandomNumber(10000)); } diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp index dbd4e5d74f..1e76c63e01 100644 --- a/engines/titanic/game/transport/service_elevator.cpp +++ b/engines/titanic/game/transport/service_elevator.cpp @@ -23,6 +23,7 @@ #include "titanic/game/transport/service_elevator.h" #include "titanic/core/room_item.h" #include "titanic/npcs/doorbot.h" +#include "titanic/translation.h" namespace Titanic { @@ -107,7 +108,7 @@ bool CServiceElevator::ServiceElevatorMsg(CServiceElevatorMsg *msg) { if (!_string1.empty()) { if (_string1 == "DeepSpace") { disableMouse(); - _soundHandle1 = playSound("z#413.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#413.wav", "z#157.wav"), 50); _timerId = addTimer(1, 1000, 500); } else { changeView(_string1); @@ -119,9 +120,9 @@ bool CServiceElevator::ServiceElevatorMsg(CServiceElevatorMsg *msg) { // Reaching destination floor _fieldF8 = false; _fieldDC = _v3; - loadSound("z#423.wav"); + loadSound(TRANSLATE("z#423.wav", "z#168.wav")); stopSound(_soundHandle2); - _soundHandle2 = playSound("z#423.wav", 80); + _soundHandle2 = playSound(TRANSLATE("z#423.wav", "z#168.wav"), 80); switch (_fieldDC) { case 0: @@ -132,12 +133,12 @@ bool CServiceElevator::ServiceElevatorMsg(CServiceElevatorMsg *msg) { case 1: _string1 = _v2 ? "BilgeRoomWith.Node 2.N" : "BilgeRoom.Node 1.N"; - queueSound("z#421.wav", _soundHandle2, 50); + queueSound(TRANSLATE("z#421.wav", "z#165.wav"), _soundHandle2, 50); break; case 2: _string1 = _v1 ? "MoonEmbLobby.Node 1.NE" : "EmbLobby.Node 1.NE"; - queueSound("z#411.wav", _soundHandle2, 50); + queueSound(TRANSLATE("z#411.wav", "z#155.wav"), _soundHandle2, 50); break; default: @@ -169,7 +170,7 @@ bool CServiceElevator::TimerMsg(CTimerMsg *msg) { _fieldF8 = true; CServiceElevatorFloorChangeMsg changeMsg(_fieldDC, _v3); changeMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); - _soundHandle2 = playSound("z#424.wav"); + _soundHandle2 = playSound(TRANSLATE("z#424.wav", "z#169.wav")); if (doorbot) { CActMsg actMsg("DoorbotPlayerPressedTopButton"); @@ -209,21 +210,21 @@ bool CServiceElevator::ServiceElevatorFloorRequestMsg(CServiceElevatorFloorReque CDoorbot *doorbot = dynamic_cast<CDoorbot *>(findRoom()->findByName("Doorbot")); if (doorbot && _v3 == 0) { - _soundHandle1 = playSound("z#415.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#415.wav", "z#159.wav"), 50); _timerId = addTimer(1, 1000, 500); } else if (doorbot && _v3 == 1) { - _soundHandle1 = playSound("z#417.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#417.wav", "z#161.wav"), 50); _timerId = addTimer(1, 1000, 500); } else if (_fieldDC == _v3) { switch (_v3) { case 0: - _soundHandle1 = playSound("z#415.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#415.wav", "z#159.wav"), 50); break; case 1: - _soundHandle1 = playSound("z#420.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#420.wav", "z#164.wav"), 50); break; case 2: - _soundHandle1 = playSound("z#410.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#410.wav", "z#154.wav"), 50); break; default: break; @@ -233,13 +234,14 @@ bool CServiceElevator::ServiceElevatorFloorRequestMsg(CServiceElevatorFloorReque } else { switch (_v3) { case 0: - _soundHandle1 = playSound("z#414.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#414.wav", "z#158.wav"), 50); break; case 1: - _soundHandle1 = playSound(_fieldDC ? "z#419.wav" : "z#418.wav", 50); + _soundHandle1 = playSound(_fieldDC ? TRANSLATE("z#419.wav", "z#163.wav") + : TRANSLATE("z#418.wav", "z#162.wav"), 50); break; case 2: - _soundHandle1 = playSound("z#409.wav", 50); + _soundHandle1 = playSound(TRANSLATE("z#409.wav", "z#153.wav"), 50); break; default: break; diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index b19d899603..115cd097f6 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -23,6 +23,7 @@ #include "titanic/game/up_lighter.h" #include "titanic/core/project_item.h" #include "titanic/npcs/parrot.h" +#include "titanic/translation.h" namespace Titanic { @@ -62,7 +63,7 @@ void CUpLighter::load(SimpleFile *file) { bool CUpLighter::MovieEndMsg(CMovieEndMsg *msg) { if (_hosePumping) { - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); _noseDispensed = true; CVisibleMsg visibleMsg(true); diff --git a/engines/titanic/game/useless_lever.cpp b/engines/titanic/game/useless_lever.cpp index 82d8983710..74b6371c06 100644 --- a/engines/titanic/game/useless_lever.cpp +++ b/engines/titanic/game/useless_lever.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/useless_lever.h" +#include "titanic/translation.h" namespace Titanic { @@ -42,11 +43,11 @@ void CUselessLever::load(SimpleFile *file) { bool CUselessLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_fieldE0) { playMovie(15, 30, 0); - playSound("z#56.wav"); + playSound(TRANSLATE("z#56.wav", "z#587.wav")); _fieldE0 = false; } else { playMovie(0, 14, 0); - playSound("z#56.wav"); + playSound(TRANSLATE("z#56.wav", "z#587.wav")); _fieldE0 = true; } diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index e5f46bc7b7..e3365be108 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -256,6 +256,7 @@ void CGameManager::updateMovies() { } eventsList.remove(movieEvent); + delete movieEvent; } repeatFlag = true; diff --git a/engines/titanic/gfx/music_slider_pitch.cpp b/engines/titanic/gfx/music_slider_pitch.cpp index 49d53f7724..48dee03d0c 100644 --- a/engines/titanic/gfx/music_slider_pitch.cpp +++ b/engines/titanic/gfx/music_slider_pitch.cpp @@ -21,6 +21,7 @@ */ #include "titanic/gfx/music_slider_pitch.h" +#include "titanic/translation.h" namespace Titanic { @@ -48,7 +49,7 @@ bool CMusicSliderPitch::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { loadFrame(3 - _controlVal); playSound("z#54.wav", 50); } else { - playSound("z#46.wav"); + playSound(TRANSLATE("z#46.wav", "z#577.wav")); } return true; diff --git a/engines/titanic/gfx/music_slider_speed.cpp b/engines/titanic/gfx/music_slider_speed.cpp index bc0490677f..50f98cc63f 100644 --- a/engines/titanic/gfx/music_slider_speed.cpp +++ b/engines/titanic/gfx/music_slider_speed.cpp @@ -21,6 +21,7 @@ */ #include "titanic/gfx/music_slider_speed.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,9 +47,9 @@ bool CMusicSliderSpeed::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { _controlVal = 0; loadFrame(3 - _controlVal); - playSound("z#54.wav", 50); + playSound(TRANSLATE("z#54.wav", "z#585.wav"), 50); } else { - playSound("z#46.wav"); + playSound(TRANSLATE("z#46.wav", "z#577.wav")); } return true; diff --git a/engines/titanic/gfx/music_switch_inversion.cpp b/engines/titanic/gfx/music_switch_inversion.cpp index b6aa1be3e3..9f554683d2 100644 --- a/engines/titanic/gfx/music_switch_inversion.cpp +++ b/engines/titanic/gfx/music_switch_inversion.cpp @@ -21,6 +21,7 @@ */ #include "titanic/gfx/music_switch_inversion.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,9 +47,9 @@ bool CMusicSwitchInversion::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) _controlVal = 0; loadFrame(_controlVal); - playSound("z#59.wav", 50); + playSound(TRANSLATE("z#59.wav", "z#590.wav"), 50); } else { - playSound("z#46.wav"); + playSound(TRANSLATE("z#46.wav", "z#577.wav")); } return true; diff --git a/engines/titanic/gfx/music_switch_reverse.cpp b/engines/titanic/gfx/music_switch_reverse.cpp index 674119d571..56d4f1329b 100644 --- a/engines/titanic/gfx/music_switch_reverse.cpp +++ b/engines/titanic/gfx/music_switch_reverse.cpp @@ -21,6 +21,7 @@ */ #include "titanic/gfx/music_switch_reverse.h" +#include "titanic/translation.h" namespace Titanic { @@ -46,9 +47,9 @@ bool CMusicSwitchReverse::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { _controlVal = 0; loadFrame(_controlVal); - playSound("z#59.wav", 50); + playSound(TRANSLATE("z#59.wav", "z#590.wav"), 50); } else { - playSound("z#46.wav"); + playSound(TRANSLATE("z#46.wav", "z#577.wav")); } return true; diff --git a/engines/titanic/gfx/music_voice_mute.cpp b/engines/titanic/gfx/music_voice_mute.cpp index 034cb4f6a6..075cd678fc 100644 --- a/engines/titanic/gfx/music_voice_mute.cpp +++ b/engines/titanic/gfx/music_voice_mute.cpp @@ -22,6 +22,7 @@ #include "titanic/gfx/music_voice_mute.h" #include "titanic/sound/music_room.h" +#include "titanic/translation.h" namespace Titanic { @@ -38,7 +39,7 @@ bool CMusicVoiceMute::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) { CMusicRoom *musicRoom = getMusicRoom(); musicRoom->setMuteControl(_controlArea, _controlVal == 1 ? 1 : 0); loadFrame(1 - _controlVal); - playSound("z#55.wav", 50); + playSound(TRANSLATE("z#55.wav", "z#586.wav"), 50); return true; } diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 2d98c813a6..2b026f9fae 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -49,6 +49,8 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm), } CMainGameWindow::~CMainGameWindow() { + delete _gameView; + delete _gameManager; delete _project; } @@ -65,7 +67,14 @@ void CMainGameWindow::applicationStarting() { SCREEN_WIDTH / 2 - image.w / 2, SCREEN_HEIGHT / 2 - image.h / 2 )); - _vm->_events->sleep(5000); + + // Delay for 5 seconds + const int NUM_STEPS = 20; + for (int idx = 0; idx < NUM_STEPS; ++idx) { + _vm->_events->sleep(5000 / NUM_STEPS); + if (_vm->_loadSaveSlot >= 0) + break; + } } // Set up the game project, and get game slot @@ -112,6 +121,10 @@ bool CMainGameWindow::isLoadingFromLauncher() const { } int CMainGameWindow::selectSavegame() { + // If a savegame was selected from GMM during the startup, return it + if (g_vm->_loadSaveSlot != -1) + return g_vm->_loadSaveSlot; + // If the user selected a savegame from the launcher, return it if (ConfMan.hasKey("save_slot")) return ConfMan.getInt("save_slot"); diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index c0bb289a00..f88ecbd2dc 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -23,6 +23,7 @@ #include "titanic/messages/bilge_dispensor_event.h" #include "titanic/events.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -66,7 +67,7 @@ bool CBilgeDispensorEvent::FrameMsg(CFrameMsg *msg) { if (getRandomNumber(2) == 0) { int volume = 20 + getRandomNumber(30); int balance = getRandomNumber(20) - 10; - _soundHandle = playSound("b#18.wav", volume, balance); + _soundHandle = playSound(TRANSLATE("b#18.wav", "b#102.wav"), volume, balance); } else { _ticksDelayEnd = ticks + 1000; } diff --git a/engines/titanic/moves/enter_sec_class_state.cpp b/engines/titanic/moves/enter_sec_class_state.cpp index b7209f83d8..1cb607b09e 100644 --- a/engines/titanic/moves/enter_sec_class_state.cpp +++ b/engines/titanic/moves/enter_sec_class_state.cpp @@ -22,6 +22,7 @@ #include "titanic/moves/enter_sec_class_state.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -49,7 +50,7 @@ void CEnterSecClassState::load(SimpleFile *file) { bool CEnterSecClassState::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (getPassengerClass() > 2) { - playSound("b#105.wav"); + playSound(TRANSLATE("b#105.wav", "b#84.wav")); petDisplayMessage(1, CLASS_NOT_PERMITTED_IN_AREA); } else if (!compareRoomNameTo("SecClassLittleLift") || _mode == 2) { CActMsg actMsg(getFullViewName().deleteRight(2) + ".S"); @@ -65,20 +66,20 @@ bool CEnterSecClassState::StatusChangeMsg(CStatusChangeMsg *msg) { if (msg->_newStatus == _mode || (_mode == 2 && msg->_newStatus == 3)) { if (_mode == 2) { - _soundHandle = queueSound("b#36.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("b#36.wav", "b#15.wav"), _soundHandle); } else { - _soundHandle = queueSound("b#31.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("b#31.wav", "b#10.wav"), _soundHandle); } if (msg->_newStatus == 3) msg->_newStatus = 2; } else { changeView("SecClassLittleLift.Node 1.N"); if (msg->_newStatus == 1) { - _soundHandle = queueSound("b#32.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("b#32.wav", "b#11.wav"), _soundHandle); } else if (msg->_newStatus == 2) { - _soundHandle = queueSound("b#25.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("b#25.wav", "b#4.wav"), _soundHandle); } else if (msg->_newStatus == 3) { - _soundHandle = queueSound("b#33.wav", _soundHandle); + _soundHandle = queueSound(TRANSLATE("b#33.wav", "b#12.wav"), _soundHandle); msg->_newStatus = 2; } } diff --git a/engines/titanic/moves/exit_bridge.cpp b/engines/titanic/moves/exit_bridge.cpp index 6b69b88004..973670abc9 100644 --- a/engines/titanic/moves/exit_bridge.cpp +++ b/engines/titanic/moves/exit_bridge.cpp @@ -21,6 +21,7 @@ */ #include "titanic/moves/exit_bridge.h" +#include "titanic/translation.h" namespace Titanic { @@ -48,7 +49,7 @@ void CExitBridge::load(SimpleFile *file) { bool CExitBridge::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (getGameManager()) { changeView(_destination); - playSound("a#53.wav"); + playSound(TRANSLATE("a#53.wav", "a#46.wav")); changeView(_viewName); } diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp index 3d1438a942..045c0e52bb 100644 --- a/engines/titanic/moves/exit_pellerator.cpp +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -22,6 +22,7 @@ #include "titanic/moves/exit_pellerator.h" #include "titanic/game/transport/pellerator.h" +#include "titanic/translation.h" namespace Titanic { @@ -66,13 +67,13 @@ bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_statics->_v2 != 2) { switch (getRandomNumber(2)) { case 0: - CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#457.wav", "z#194.wav"), CPellerator::_soundHandle); break; case 1: - CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#458.wav", "z#195.wav"), CPellerator::_soundHandle); break; default: - CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#464.wav", "z#201.wav"), CPellerator::_soundHandle); break; } } @@ -95,20 +96,20 @@ bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { break; default: petDisplayMessage(2, EXIT_FROM_OTHER_SIDE); - CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#438.wav", "z#183.wav"), CPellerator::_soundHandle); } } else if (name == "ExitPellerator2") { if (_statics->_v2 == 2) { switch (getRandomNumber(2)) { case 0: - CPellerator::_soundHandle = queueSound("z#457.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#457.wav", "z#194.wav"), CPellerator::_soundHandle); break; case 1: - CPellerator::_soundHandle = queueSound("z#458.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#458.wav", "z#195.wav"), CPellerator::_soundHandle); break; default: - CPellerator::_soundHandle = queueSound("z#464.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#464.wav", "z#201.wav"), CPellerator::_soundHandle); break; } } @@ -117,7 +118,7 @@ bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { changeView("Bar.Node 1.N"); } else { petDisplayMessage(2, EXIT_FROM_OTHER_SIDE); - CPellerator::_soundHandle = queueSound("z#438.wav", CPellerator::_soundHandle); + CPellerator::_soundHandle = queueSound(TRANSLATE("z#438.wav", "z#183.wav"), CPellerator::_soundHandle); } } diff --git a/engines/titanic/moves/restricted_move.cpp b/engines/titanic/moves/restricted_move.cpp index 52ff280437..279380a93c 100644 --- a/engines/titanic/moves/restricted_move.cpp +++ b/engines/titanic/moves/restricted_move.cpp @@ -21,6 +21,7 @@ */ #include "titanic/moves/restricted_move.h" +#include "titanic/translation.h" namespace Titanic { @@ -54,11 +55,12 @@ bool CRestrictedMove::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } else if (classNum != UNCHECKED) { petDisplayMessage(1, CLASS_NOT_ALLOWED_AT_DEST); } else if (compareRoomNameTo("EmbLobby")) { - playSound("a#17.wav"); + if (g_language != Common::DE_DEU) + playSound("a#17.wav"); petDisplayMessage(1, CHECK_IN_AT_RECEPTION); } else if (compareViewNameTo("Titania.Node 1.S")) { CProximity prox(Audio::Mixer::kSpeechSoundType); - playSound("z#226.wav", prox); + playSound(TRANSLATE("z#226.wav", "z#132.wav"), prox); changeView(_destination); } diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 2ba150a38c..029861fa49 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -23,6 +23,7 @@ #include "titanic/npcs/barbot.h" #include "titanic/support/files_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -243,7 +244,7 @@ bool CBarbot::ActMsg(CActMsg *msg) { _field160 = 1; _addedTV = true; - playSound("c#5.wav", _volume); + playSound(TRANSLATE("c#5.wav", "c#65.wav"), _volume); playRange(_frames[35], MOVIE_NOTIFY_OBJECT); movieEvent(); playRange(_frames[34]); @@ -415,12 +416,12 @@ bool CBarbot::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == _frames[57]._endFrame) { startTalking(this, 250575); - playSound("c#10.wav", _volume); + playSound(TRANSLATE("c#10.wav", "c#70.wav"), _volume); return true; } if (msg->_endFrame == _frames[55]._endFrame) { - playSound("c#10.wav", _volume); + playSound(TRANSLATE("c#10.wav", "c#70.wav"), _volume); return true; } @@ -476,22 +477,22 @@ bool CBarbot::MovieEndMsg(CMovieEndMsg *msg) { } if (msg->_endFrame == _frames[38]._endFrame || msg->_endFrame == _frames[23]._endFrame) { - playSound("c#3.wav", _volume); + playSound(TRANSLATE("c#3.wav", "c#63.wav"), _volume); } else if (msg->_endFrame == _frames[36]._endFrame) { - playSound("c#6.wav", _volume); + playSound(TRANSLATE("c#6.wav", "c#66.wav"), _volume); } else if (msg->_endFrame == _frames[35]._endFrame) { - playSound("c#8.wav", _volume); + playSound(TRANSLATE("c#8.wav", "c#68.wav"), _volume); } else if (msg->_endFrame == _frames[33]._endFrame) { - playSound("c#4.wav", _volume); + playSound(TRANSLATE("c#4.wav", "c#64.wav"), _volume); } else if (msg->_endFrame == _frames[32]._endFrame) { startTalking(this, 145); - playSound("c#9.wav", _volume); + playSound(TRANSLATE("c#9.wav", "c#69.wav"), _volume); } else if (msg->_endFrame == _frames[47]._endFrame) { - playSound("c#9.wav", _volume); + playSound(TRANSLATE("c#9.wav", "c#69.wav"), _volume); _addedVodka = true; _drunkFlag = true; } else if (msg->_endFrame == _frames[30]._endFrame) { - playSound("c#4.wav", 60); + playSound(TRANSLATE("c#4.wav", "c#64.wav"), 60); } else if (msg->_endFrame == _frames[29]._endFrame) { if (!_fieldC4) { performAction(true, nullptr); @@ -700,7 +701,7 @@ bool CBarbot::LoadSuccessMsg(CLoadSuccessMsg *msg) { bool CBarbot::MovieFrameMsg(CMovieFrameMsg *msg) { if (msg->_frameNumber == _frames[29]._startFrame) { - playSound("c#2.wav", _volume); + playSound(TRANSLATE("c#2.wav", "c#62.wav"), _volume); } else if (msg->_frameNumber == _frames[55]._startFrame || msg->_frameNumber == _frames[32]._startFrame) { diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp index c6c6a9e3a6..80c1121a2e 100644 --- a/engines/titanic/npcs/bellbot.cpp +++ b/engines/titanic/npcs/bellbot.cpp @@ -23,8 +23,9 @@ #include "titanic/npcs/bellbot.h" #include "titanic/carry/carry.h" #include "titanic/core/room_item.h" -#include "titanic/game_manager.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" +#include "titanic/translation.h" namespace Titanic { @@ -66,26 +67,31 @@ bool CBellBot::OnSummonBotMsg(COnSummonBotMsg *msg) { if (msg->_value == 1) { _npcFlags |= NPCFLAG_MOVE_LOOP; } else { - static const char *const ROOM_WAVES[8][2] = { - { "EmbLobby", "z#193.wav" }, - { "PromenadeDeck", "z#191.wav" }, - { "Arboretum", "z#195.wav" }, - { "Frozen Arboretum", "z#195.wav" }, - { "Bar", "z#194.wav" }, - { "MusicRoom", "z#192.wav" }, - { "MusicRoomLobby", "z#192.wav" }, - { "1stClassRestaurant", "z#190.wav" } + struct RoomWave { + const char *_room; + const char *_enSound; + const char *_deSound; + }; + static const RoomWave ROOM_WAVES[8] = { + { "EmbLobby", "z#193.wav", "z#723.wav" }, + { "PromenadeDeck", "z#191.wav", "z#721.wav" }, + { "Arboretum", "z#195.wav", "z#725.wav" }, + { "Frozen Arboretum", "z#195.wav", "z#725.wav" }, + { "Bar", "z#194.wav", "z#724.wav" }, + { "MusicRoom", "z#192.wav", "z#722.wav" }, + { "MusicRoomLobby", "z#192.wav", "z#722.wav" }, + { "1stClassRestaurant", "z#190.wav", "z#720.wav" } }; int idx; for (idx = 0; idx < 8; ++idx) { - if (compareRoomNameTo(ROOM_WAVES[idx][0])) { - playSound(ROOM_WAVES[idx][1]); + if (compareRoomNameTo(ROOM_WAVES[idx]._room)) { + playSound(TRANSLATE(ROOM_WAVES[idx]._enSound, ROOM_WAVES[idx]._deSound)); break; } } if (idx == 8) - playSound("z#147.wav"); + playSound(TRANSLATE("z#147.wav", "z#703.wav")); sleep(2000); _npcFlags &= ~NPCFLAG_MOVE_LOOP; @@ -103,7 +109,8 @@ bool CBellBot::EnterViewMsg(CEnterViewMsg *msg) { // WORKAROUND: Calling bot in front of doors and then going through them // can leave it in the view. Detect this and properly remove him when // the player returns to that view - if (msg->_newView == getParent() && getPetControl()->canSummonBot("BellBot")) + if (!hasActiveMovie() && msg->_newView == getParent() + && getPetControl()->canSummonBot("BellBot")) petMoveToHiddenRoom(); return true; @@ -284,8 +291,10 @@ bool CBellBot::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) { bool CBellBot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); - if (msg->_dialogueId == 20991) + if (msg->_dialogueId == TRANSLATE(20991, 20997)) { petDismissBot("DoorBot"); + getGameManager()->unlockInputHandler(); + } return true; } diff --git a/engines/titanic/npcs/bilge_succubus.cpp b/engines/titanic/npcs/bilge_succubus.cpp index 312f067bd4..827e39fb4b 100644 --- a/engines/titanic/npcs/bilge_succubus.cpp +++ b/engines/titanic/npcs/bilge_succubus.cpp @@ -24,6 +24,7 @@ #include "titanic/carry/chicken.h" #include "titanic/core/view_item.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -80,7 +81,7 @@ bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { if (_afterReceiveStartFrame >= 0) playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_WAIT_FOR_FINISH); - playSound("z#28.wav", 70); + playSound(TRANSLATE("z#28.wav", "z#559.wav"), 70); } else if (!_isOn) { petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY); return false; @@ -184,10 +185,10 @@ bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == _trayOutEndFrame) { if (_offStartFrame >= 0) - playSound("z#27.wav"); + playSound(TRANSLATE("z#27.wav", "z#558.wav")); } else if (msg->_endFrame == _offEndFrame) { if (_endingStartFrame >= 0) - playSound("z#30.wav"); + playSound(TRANSLATE("z#30.wav", "z#561.wav")); } else { if (msg->_endFrame == _onEndFrame && pet) { if (_motherBlocked) { @@ -212,11 +213,11 @@ bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { switch (_sendAction) { case SA_EATEN: stopSound(_soundHandle, 1); - _soundHandle = playSound("z#3.wav", 1); + _soundHandle = playSound(TRANSLATE("z#3.wav", "z#539.wav"), 1); break; case SA_BILGE_FEATHERS: stopSound(_soundHandle); - _soundHandle = playSound("z#12.wav"); + _soundHandle = playSound(TRANSLATE("z#12.wav", "z#532.wav")); break; case SA_BILGE_SENT: if (_isChicken) { @@ -250,8 +251,8 @@ bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { } } else if (msg->_endFrame == _sneezing1EndFrame) { - playSound("z#25.wav", 70); - playSound("z#24.wav", 70); + playSound(TRANSLATE("z#25.wav", "z#556.wav"), 70); + playSound(TRANSLATE("z#24.wav", "z#555.wav"), 70); } else if (msg->_endFrame == _sneezing2EndFrame) { changeView("BilgeRoomWith.Node 1.N", ""); @@ -337,7 +338,7 @@ bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { petContainerRemove(item); pet->phonographAction(""); item->setVisible(false); - playSound("z#23.wav"); + playSound(TRANSLATE("z#23.wav", "z#554.wav")); CChicken *chicken = dynamic_cast<CChicken *>(item); bool chickenFlag = chicken ? chicken->_condiment == "None" : false; @@ -399,7 +400,7 @@ bool CBilgeSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { if (_isOn) { _isOn = false; if (_offStartFrame >= 0) - playSound("z#27.wav"); + playSound(TRANSLATE("z#27.wav", "z#558.wav")); } performAction(true); @@ -422,7 +423,7 @@ bool CBilgeSuccUBus::TurnOn(CTurnOn *msg) { if (pet) { if (_onStartFrame >= 0) { playMovie(_onStartFrame, _onEndFrame, MOVIE_NOTIFY_OBJECT); - playSound("z#26.wav"); + playSound(TRANSLATE("z#26.wav", "z#557.wav")); } if (mailExists(pet->getRoomFlags()) && _okStartFrame >= 0) diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 27bea6f9a0..aa9ec7e6cd 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -22,6 +22,8 @@ #include "titanic/npcs/deskbot.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" +#include "titanic/translation.h" namespace Titanic { @@ -84,7 +86,7 @@ bool CDeskbot::TurnOn(CTurnOn *msg) { playClip("BellRinging"); playClip("Opening", MOVIE_NOTIFY_OBJECT); - playSound("b#69.wav"); + playSound(TRANSLATE("b#69.wav", "b#47.wav")); petSetArea(PET_CONVERSATION); _npcFlags |= NPCFLAG_MOVE_START; @@ -118,7 +120,7 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { petSetArea(PET_ROOMS); decTransitions(); unlockMouse(); - playSound("z#47.wav"); + playSound(TRANSLATE("z#47.wav", "z#578.wav")); _classNum = NO_CLASS; } @@ -133,6 +135,7 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { CTurnOn turnOn; turnOn.execute("EmbBellbotTrigger"); unlockMouse(); + getGameManager()->lockInputHandler(); changeView("EmbLobby.Node 4.N", ""); } else if (_npcFlags & NPCFLAG_MOVE_LEFT) { CTurnOn turnOn; @@ -257,16 +260,31 @@ bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *m return true; CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(msg); - switch (msg->_dialogueId) { - case 41684: - case 41686: - case 41787: - case 41788: - case 41789: - lockMouse(); - break; - default: - break; + + if (g_language == Common::DE_DEU) { + switch (msg->_dialogueId) { + case 41701: + case 41703: + case 41804: + case 41805: + case 41806: + lockMouse(); + break; + default: + break; + } + } else { + switch (msg->_dialogueId) { + case 41684: + case 41686: + case 41787: + case 41788: + case 41789: + lockMouse(); + break; + default: + break; + } } return true; @@ -278,23 +296,43 @@ bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) CTurnOff turnOff; CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); + + if (g_language == Common::DE_DEU) { + switch (msg->_dialogueId) { + case 41701: + case 41804: + case 41805: + case 41806: + _npcFlags |= NPCFLAG_MOVE_FINISH; + turnOff.execute(this); + break; - switch (msg->_dialogueId) { - case 41684: - case 41787: - case 41788: - case 41789: - _npcFlags |= NPCFLAG_MOVE_FINISH; - turnOff.execute(this); - break; + case 41703: + _npcFlags |= NPCFLAG_MOVE_LEFT; + turnOff.execute(this); + break; - case 41686: - _npcFlags |= NPCFLAG_MOVE_LEFT; - turnOff.execute(this); - break; + default: + break; + } + } else { + switch (msg->_dialogueId) { + case 41684: + case 41787: + case 41788: + case 41789: + _npcFlags |= NPCFLAG_MOVE_FINISH; + turnOff.execute(this); + break; - default: - break; + case 41686: + _npcFlags |= NPCFLAG_MOVE_LEFT; + turnOff.execute(this); + break; + + default: + break; + } } return true; diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index 8ee1e3220c..5512468099 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -24,6 +24,7 @@ #include "titanic/core/room_item.h" #include "titanic/debugger.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -162,27 +163,32 @@ bool CDoorbot::MovieEndMsg(CMovieEndMsg *msg) { } bool CDoorbot::OnSummonBotMsg(COnSummonBotMsg *msg) { - const char *const ROOM_WAVES[8][2] = { - { "EmbLobby", "z#186.wav" }, - { "PromenadeDeck", "z#184.wav" }, - { "Arboretum", "z#188.wav" }, - { "Frozen Arboretum", "z#188.wav" }, - { "Bar", "z#187.wav" }, - { "MusicRoom", "z#185.wav" }, - { "MusicRoomLobby", "z#185.wav" }, - { "1stClassRestaurant", "z#183.wav" }, + struct RoomWave { + const char *_room; + const char *_enSound; + const char *_deSound; + }; + const RoomWave ROOM_WAVES[8] = { + { "EmbLobby", "z#186.wav", "z#716.wav" }, + { "PromenadeDeck", "z#184.wav", "z#714.wav" }, + { "Arboretum", "z#188.wav", "z#718.wav" }, + { "Frozen Arboretum", "z#188.wav", "z#718.wav" }, + { "Bar", "z#187.wav", "z#717.wav" }, + { "MusicRoom", "z#185.wav", "z#715.wav" }, + { "MusicRoomLobby", "z#185.wav", "z#715.wav" }, + { "1stClassRestaurant", "z#183.wav", "z#713.wav" }, }; if (msg->_value != -1) { int idx; for (idx = 0; idx < 8; ++idx) { - if (compareRoomNameTo(ROOM_WAVES[idx][0])) { - playSound(ROOM_WAVES[idx][1]); + if (compareRoomNameTo(ROOM_WAVES[idx]._room)) { + playSound(TRANSLATE(ROOM_WAVES[idx]._enSound, ROOM_WAVES[idx]._deSound)); break; } } if (idx == 8) - playSound("z#146.wav"); + playSound(TRANSLATE("z#146.wav", "z#702.wav")); sleep(2000); } @@ -424,27 +430,27 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) if (_npcFlags & NPCFLAG_DOORBOT_INTRO) { // Initial speech by Doorbot in - switch (msg->_dialogueId) { - case 10552: + switch (msg->_dialogueId - TRANSLATE(10552, 10563)) { + case 0: playClip("SE Try Buttons", MOVIE_NOTIFY_OBJECT); _introMovieNum = 9; break; - case 10553: + case 1: enableMouse(); break; - case 10557: + case 5: playClip("SE Move To Right", MOVIE_NOTIFY_OBJECT); _introMovieNum = 11; break; - case 10559: + case 7: stopAnimTimer(_timerId); _timerId = addTimer(0, 2500, 0); break; - case 10560: + case 8: petShow(); petSetArea(PET_CONVERSATION); petIncAreaLocks(); @@ -452,31 +458,31 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) _timerId = addTimer(1, 1000, 0); break; - case 10561: + case 9: enableMouse(); _introMovieNum = 1; stopAnimTimer(_timerId); _timerId = addTimer(2, 10000, 0); break; - case 10562: + case 10: if (_introMovieNum == 1) { stopAnimTimer(_timerId); _timerId = addTimer(2, getRandomNumber(5000) + 5000, 0); } break; - case 10563: - case 10564: + case 11: + case 12: disableMouse(); startTalking(this, 221480); break; - case 10565: + case 13: startTalking(this, 221481); break; - case 10566: + case 14: stopAnimTimer(_timerId); _timerId = 0; if (_field110 == 2) { @@ -487,7 +493,7 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) } break; - case 10567: { + case 15: { CActMsg actMsg("BecomeGettable"); actMsg.execute("Photograph"); enableMouse(); @@ -496,26 +502,26 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) break; } - case 10568: + case 16: // Start moving cursor to photograph mouseDisableControl(); mouseSetPosition(Point(600, 250), 2500); _timerId = addTimer(6, 2500, 0); break; - case 10569: + case 17: if (_field110 != 2) { stopAnimTimer(_timerId); _timerId = addTimer(5, 3000, 0); } break; - case 10570: + case 18: mouseSetPosition(Point(200, 430), 2500); _timerId = addTimer(7, 3000, 0); break; - case 10571: + case 19: playClip("Cloak On", MOVIE_NOTIFY_OBJECT); _introMovieNum = 6; break; diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index dd033abbae..ba07d1d15c 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -25,6 +25,7 @@ #include "titanic/carry/carry.h" #include "titanic/carry/chicken.h" #include "titanic/game_manager.h" +#include "titanic/translation.h" namespace Titanic { @@ -45,6 +46,7 @@ BEGIN_MESSAGE_MAP(CParrot, CTrueTalkNPC) ON_MESSAGE(PreEnterViewMsg) ON_MESSAGE(PanningAwayFromParrotMsg) ON_MESSAGE(LeaveRoomMsg) + ON_MESSAGE(TrueTalkNotifySpeechStartedMsg) ON_MESSAGE(TrueTalkNotifySpeechEndedMsg) END_MESSAGE_MAP() @@ -385,7 +387,7 @@ bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) { if ((getTicksCount() - _lastSpeakTime) < 20000 || _speechCounter) return true; - playSound("z#475.wav", 50); + playSound(TRANSLATE("z#475.wav", "z#212.wav"), 50); if (msg->_target == "Bomb") { startTalking("PerchedParrot", 280236); @@ -547,6 +549,9 @@ bool CParrot::FrameMsg(CFrameMsg *msg) { | NPCFLAG_MOVE_FINISH | NPCFLAG_MOVE_LEFT | NPCFLAG_MOVE_RIGHT | NPCFLAG_MOVE_END); return true; } + + // WORKAROUND: Prevent panning away from stalling if Parrot was moving + _npcFlags &= ~NPCFLAG_MOVING; } else { if (dragObject) chickenFlag = dragObject && dragObject->isEquals("Chicken"); @@ -726,6 +731,15 @@ bool CParrot::LeaveRoomMsg(CLeaveRoomMsg *msg) { return true; } +bool CParrot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { + // WORKAROUND: Fix parrot freezing up if you drag the chicken whilst + // he's still returning to the center from a prior chicken drag + if (_npcFlags & (NPCFLAG_MOVE_LEFT | NPCFLAG_MOVE_RIGHT)) + _npcFlags &= ~(NPCFLAG_MOVING | NPCFLAG_MOVE_LEFT | NPCFLAG_MOVE_RIGHT); + + return CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(msg); +} + bool CParrot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { if (msg->_dialogueId == 80022) { // WORKAROUND: End of parrot speech after having fixed Titania diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index 6fc4d6a182..ee275158e6 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -51,6 +51,7 @@ class CParrot : public CTrueTalkNPC { bool PreEnterViewMsg(CPreEnterViewMsg *msg); bool PanningAwayFromParrotMsg(CPanningAwayFromParrotMsg *msg); bool LeaveRoomMsg(CLeaveRoomMsg *msg); + bool TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg); bool TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg); public: static bool _eatingChicken; diff --git a/engines/titanic/npcs/parrot_succubus.cpp b/engines/titanic/npcs/parrot_succubus.cpp index 964b91b106..64611e89b3 100644 --- a/engines/titanic/npcs/parrot_succubus.cpp +++ b/engines/titanic/npcs/parrot_succubus.cpp @@ -23,6 +23,7 @@ #include "titanic/npcs/parrot_succubus.h" #include "titanic/pet_control/pet_control.h" #include "titanic/carry/hose.h" +#include "titanic/translation.h" namespace Titanic { @@ -79,7 +80,7 @@ bool CParrotSuccUBus::HoseConnectedMsg(CHoseConnectedMsg *msg) { _isOn = false; } else { playMovie(_onStartFrame, _onEndFrame, 0); - playSound("z#26.wav"); + playSound(TRANSLATE("z#26.wav", "z#557.wav")); } playMovie(_hoseStartFrame, _hoseEndFrame, MOVIE_NOTIFY_OBJECT); @@ -117,7 +118,7 @@ bool CParrotSuccUBus::EnterViewMsg(CEnterViewMsg *msg) { bool CParrotSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == _hoseEndFrame) { playMovie(_pumpingStartFrame, _pumpingEndFrame, MOVIE_REPEAT); - _pumpingSound = playSound("z#472.wav"); + _pumpingSound = playSound(TRANSLATE("z#472.wav", "z#209.wav")); return true; } else { return CSuccUBus::MovieEndMsg(msg); @@ -139,7 +140,7 @@ bool CParrotSuccUBus::LeaveNodeMsg(CLeaveNodeMsg *msg) { if (_hoseConnected) { getHiddenObject(_pumpingTarget); if (CHose::_statics->_actionTarget.empty()) { - playSound("z#51.wav"); + playSound(TRANSLATE("z#51.wav", "z#582.wav")); CHoseConnectedMsg hoseMsg; hoseMsg._connected = false; hoseMsg.execute(this); diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp index 6eeccd345a..b8fddf2079 100644 --- a/engines/titanic/npcs/succubus.cpp +++ b/engines/titanic/npcs/succubus.cpp @@ -25,6 +25,7 @@ #include "titanic/carry/chicken.h" #include "titanic/core/view_item.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/translation.h" namespace Titanic { @@ -289,7 +290,7 @@ bool CSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { item->setVisible(false); if (_startFrame1 >= 0) { - playSound("z#23.wav"); + playSound(TRANSLATE("z#23.wav", "z#554.wav")); playMovie(_startFrame1, _endFrame1, 0); } @@ -366,7 +367,7 @@ bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { if (_isOn) { _isOn = false; if (_offStartFrame >= 0) - playSound("z#27.wav", 100); + playSound(TRANSLATE("z#27.wav", "z#558.wav"), 100); if (_signalFlag) setVisible(false); @@ -535,7 +536,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == _offEndFrame) { if (_endingStartFrame >= 0) - playSound("z#30.wav", 100); + playSound(TRANSLATE("z#30.wav", "z#561.wav"), 100); if (_signalFlag) { _signalFlag = false; @@ -680,12 +681,12 @@ bool CSuccUBus::TurnOn(CTurnOn *msg) { if (pet) { if (!_signalFlag && _initialStartFrame >= 0) { playMovie(_initialStartFrame, _initialEndFrame, 0); - playSound("z#30.wav", 100); + playSound(TRANSLATE("z#30.wav", "z#561.wav"), 100); } if (_onStartFrame >= 0) { playMovie(_onStartFrame, _onEndFrame, MOVIE_NOTIFY_OBJECT); - playSound("z#26.wav", 100); + playSound(TRANSLATE("z#26.wav", "z#557.wav"), 100); } uint petRoomFlags = pet->getRoomFlags(); @@ -712,7 +713,7 @@ bool CSuccUBus::TurnOff(CTurnOff *msg) { } if (_offStartFrame >= 0) { - playSound("z#27.wav", 100); + playSound(TRANSLATE("z#27.wav", "z#558.wav"), 100); playMovie(_offStartFrame, _offEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } @@ -753,7 +754,7 @@ bool CSuccUBus::SUBTransition(CSUBTransition *msg) { bool CSuccUBus::SetChevRoomBits(CSetChevRoomBits *msg) { if (_isOn) { _destRoomFlags = msg->_roomFlags; - playSound("z#98.wav", 100); + playSound(TRANSLATE("z#98.wav", "z#629.wav"), 100); } return true; diff --git a/engines/titanic/npcs/titania.cpp b/engines/titanic/npcs/titania.cpp index d3e3395fc8..bfc0ba1bfd 100644 --- a/engines/titanic/npcs/titania.cpp +++ b/engines/titanic/npcs/titania.cpp @@ -21,6 +21,7 @@ */ #include "titanic/npcs/titania.h" +#include "titanic/translation.h" namespace Titanic { @@ -146,7 +147,7 @@ bool CTitania::ActMsg(CActMsg *msg) { if (msg->_action == "SleepTitania") { setVisible(true); playCutscene(52, 104); - playSound("z#47.wav", 100); + playSound(TRANSLATE("z#47.wav", "z#578.wav"), 100); changeView("Titania.Node 7.S", ""); // Re-enable control, and reset bomb's volume back to normal 60% @@ -178,7 +179,7 @@ bool CTitania::ActMsg(CActMsg *msg) { && _mouth && _visionCentre && _speechCentre && _olfactoryCentre && _auditoryCentre) { CProximity prox(Audio::Mixer::kSpeechSoundType); - playSound("z#47.wav", prox); + playSound(TRANSLATE("z#47.wav", "z#578.wav"), prox); CActMsg actMsg("Woken"); actMsg.execute("MouthSlot"); diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index cfd209f763..b3291623c3 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -182,6 +182,7 @@ void CPetControl::enterNode(CNodeItem *node) { void CPetControl::enterRoom(CRoomItem *room) { _rooms.enterRoom(room); _remote.enterRoom(room); + _inventory.enterRoom(room); } void CPetControl::resetRemoteTarget() { @@ -562,6 +563,10 @@ bool CPetControl::checkNode(const CString &name) { return nameLower.contains(str); } +void CPetControl::syncSoundSettings() { + _realLife.syncSoundSettings(); +} + void CPetControl::playSound(int soundNum) { CTreeItem *player = getHiddenObject("PETSoundPlayer"); if (player) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 35556e08d2..6408c8a29b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -297,6 +297,11 @@ public: bool checkNode(const CString &name); /** + * Handles updates to the sound levels + */ + void syncSoundSettings(); + + /** * Play a sound */ void playSound(int soundNum); diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index 91d9b9ccb2..3d2a06db97 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -67,6 +67,12 @@ public: * Get the game object associated with this item */ virtual CGameObject *getObject() const; + + /** + * Gets the explicit bounds set for the graphic element, + * ignoring any associated sub-object bounds + */ + const Rect &getRawBounds() const { return _bounds; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 6229d17994..8f335f882b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -476,6 +476,11 @@ public: bool isGlyphHighlighted(const CPetGlyph *glyph) const; /** + * Returns the highlighted index, if any + */ + int getHighlightIndex() const { return _highlightIndex; } + + /** * Get the top-left position of the currently highlighted glyph */ Point getHighlightedGlyphPos() const; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index b2f530c5fa..0f9f253cb0 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -71,6 +71,14 @@ void CPetInventory::changed(int changeType) { } } +void CPetInventory::enterRoom(CRoomItem *room) { + int index = _items.getHighlightIndex(); + if (index != -1) { + _items.resetHighlight(); + _items.highlight(index); + } +} + bool CPetInventory::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return _items.MouseButtonDownMsg(msg->_mousePos); } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index dc85b31420..32f5eb4b12 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -86,6 +86,11 @@ public: virtual void changed(int changeType); /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room); + + /** * Following are handlers for the various messages that the PET can * pass onto the currently active section/area */ diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 57d81c739e..ff87a2fab4 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -123,6 +123,12 @@ void CPetRealLife::addButton(CPetGlyph *glyph) { } } - +void CPetRealLife::syncSoundSettings() { + for (CPetGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { + CPetSound *sound = dynamic_cast<CPetSound *>(*i); + if (sound) + sound->setSliders(); + } +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index 294f9a3f9f..965b4eab2a 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -126,6 +126,10 @@ public: */ virtual CTextControl *getText() { return &_text; } + /** + * Handles updates to the sound levels + */ + void syncSoundSettings(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index eb07012f43..9fb173871f 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -89,7 +89,7 @@ double CPetSlider::getOffsetPixels() const { if (minVal == maxVal) return 0.0; - return _sliderOffset / (maxVal - minVal); + return (double)_sliderOffset / (maxVal - minVal); } void CPetSlider::setSliderOffset(double offset) { diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 085ee649b2..c2c9110b03 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -24,10 +24,12 @@ #include "titanic/pet_control/pet_control.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/game_manager.h" +#include "titanic/titanic.h" +#include "common/config-manager.h" namespace Titanic { -CPetSound::CPetSound() : CPetGlyph(), _draggingSlider(nullptr), _draggingSliderNum(0) { +CPetSound::CPetSound() : CPetGlyph(), _draggingSlider(nullptr), _draggingSliderNum(MASTER_SLIDER) { } bool CPetSound::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -109,6 +111,62 @@ bool CPetSound::reset() { return false; } +void CPetSound::setSliders() { + // Get the mute settings + bool muteAll = ConfMan.hasKey("mute") ? ConfMan.getBool("mute") : false; + bool musicMute = muteAll || (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")); + bool sfxMute = muteAll || (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")); + bool speechMute = muteAll || (ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute")); + + // Get the volume levels + uint musicVol = musicMute ? 0 : MIN(255, ConfMan.getInt("music_volume")); + uint parrotVol = sfxMute ? 0 : MIN(255, ConfMan.getInt("sfx_volume")); + uint speechVol = speechMute ? 0 : MIN(255, ConfMan.getInt("speech_volume")); + uint masterVol = MAX(musicVol, MAX(parrotVol, speechVol)); + + const double FACTOR = 1.0 / 255.0; + _masterVolume.setSliderOffset(masterVol * FACTOR); + _musicVolume.setSliderOffset(musicVol * FACTOR); + _parrotVolume.setSliderOffset(parrotVol * FACTOR); + _speechVolume.setSliderOffset(speechVol * FACTOR); +} + +void CPetSound::sliderChanged(double offset, SliderType sliderNum) { + uint newVol = (uint)(offset * 255.0); + + switch (sliderNum) { + case MASTER_SLIDER: + ConfMan.setBool("music_mute", false); + ConfMan.setBool("sfx_mute", false); + ConfMan.setBool("sfx_mute", false); + ConfMan.setInt("music_volume", newVol); + ConfMan.setInt("sfx_volume", newVol); + ConfMan.setInt("speech_volume", newVol); + + _musicVolume.setSliderOffset(newVol * 0.01); + _parrotVolume.setSliderOffset(newVol * 0.01); + _speechVolume.setSliderOffset(newVol * 0.01); + break; + case MUSIC_SLIDER: + ConfMan.setBool("music_mute", false); + ConfMan.setInt("music_volume", newVol); + break; + case PARROT_SLIDER: + ConfMan.setBool("sfx_mute", false); + ConfMan.setInt("sfx_volume", newVol); + break; + case SPEECH_SLIDER: + ConfMan.setBool("speech_mute", false); + ConfMan.setInt("speech_volume", newVol); + break; + default: + return; + } + + ConfMan.setBool("mute", false); + g_vm->syncSoundSettings(); +} + void CPetSound::draw2(CScreenManager *screenManager) { _element.draw(screenManager); @@ -142,7 +200,7 @@ bool CPetSound::MouseButtonDownMsg(const Point &pt) { rectRight.translate(567, 378); CPetSlider *sliders[4] = { &_masterVolume, &_musicVolume, &_parrotVolume, &_speechVolume }; - for (int idx = 0; idx < 4; ++idx) { + for (int idx = MASTER_SLIDER; idx <= SPEECH_SLIDER; ++idx) { CPetSlider *slider = sliders[idx]; bool isLeft = rectLeft.contains(pt); bool isRight = rectRight.contains(pt); @@ -157,7 +215,7 @@ bool CPetSound::MouseButtonDownMsg(const Point &pt) { } if (isLeft || isRight) { - sliderChanged(offset, idx); + sliderChanged(offset, (SliderType)idx); return true; } @@ -169,56 +227,26 @@ bool CPetSound::MouseButtonDownMsg(const Point &pt) { return false; } -void CPetSound::sliderChanged(double offset, int sliderNum) { - CPetControl *pet = getPetControl(); - if (!pet) - return; - - CGameManager *gameManager = pet->getGameManager(); - if (!gameManager) - return; - - QSoundManager &soundManager = gameManager->_sound._soundManager; - double percent = offset * 100.0; - - switch (sliderNum) { - case 0: - soundManager.setMasterPercent(percent); - break; - case 1: - soundManager.setMusicPercent(percent); - break; - case 2: - soundManager.setParrotPercent(percent); - break; - case 3: - soundManager.setSpeechPercent(percent); - break; - default: - break; - } -} - bool CPetSound::MouseDragStartMsg(CMouseDragStartMsg *msg) { - if (_musicVolume.resetThumbFocus()) { - _draggingSlider = &_musicVolume; + if (_masterVolume.resetThumbFocus()) { + _draggingSlider = &_masterVolume; getOwner()->startDragging(this, msg); - _draggingSliderNum = 0; + _draggingSliderNum = MASTER_SLIDER; return true; - } else if (_masterVolume.resetThumbFocus()) { - _draggingSlider = &_masterVolume; + } else if (_musicVolume.resetThumbFocus()) { + _draggingSlider = &_musicVolume; getOwner()->startDragging(this, msg); - _draggingSliderNum = 1; + _draggingSliderNum = MUSIC_SLIDER; return true; } else if (_parrotVolume.resetThumbFocus()) { _draggingSlider = &_parrotVolume; getOwner()->startDragging(this, msg); - _draggingSliderNum = 2; + _draggingSliderNum = PARROT_SLIDER; return true; } else if (_speechVolume.resetThumbFocus()) { _draggingSlider = &_speechVolume; getOwner()->startDragging(this, msg); - _draggingSliderNum = 3; + _draggingSliderNum = SPEECH_SLIDER; return true; } @@ -244,6 +272,9 @@ bool CPetSound::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (!_draggingSlider) return false; + // Flush the changed settings + ConfMan.flushToDisk(); + bool result = _draggingSlider->MouseDragEndMsg(msg->_mousePos); getOwner()->endDragging(); @@ -251,20 +282,20 @@ bool CPetSound::MouseDragEndMsg(CMouseDragEndMsg *msg) { } bool CPetSound::MouseButtonUpMsg(const Point &pt) { - int sliderNum = 0; + SliderType sliderNum = MASTER_SLIDER; CPetSlider *slider = nullptr; - if (_musicVolume.MouseButtonUpMsg(pt)) { - sliderNum = 0; - slider = &_musicVolume; - } else if (_masterVolume.MouseButtonUpMsg(pt)) { - sliderNum = 1; + if (_masterVolume.MouseButtonUpMsg(pt)) { + sliderNum = MASTER_SLIDER; slider = &_masterVolume; + } else if (_musicVolume.MouseButtonUpMsg(pt)) { + sliderNum = MUSIC_SLIDER; + slider = &_musicVolume; } else if (_parrotVolume.MouseButtonUpMsg(pt)) { - sliderNum = 2; + sliderNum = PARROT_SLIDER; slider = &_parrotVolume; } else if (_speechVolume.MouseButtonUpMsg(pt)) { - sliderNum = 3; + sliderNum = SPEECH_SLIDER; slider = &_speechVolume; } else { return false; diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index e4fd21006a..54e2fc12e7 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -33,6 +33,9 @@ namespace Titanic { class CPetRealLife; class CPetSound : public CPetGlyph { + enum SliderType { + MASTER_SLIDER = 0, MUSIC_SLIDER = 1, PARROT_SLIDER = 2, SPEECH_SLIDER = 3 + }; private: CPetGfxElement _element; CPetSoundSlider _masterVolume; @@ -44,12 +47,12 @@ private: CTextControl _textParrotVolume; CTextControl _textSpeechVolume; CPetSlider *_draggingSlider; - int _draggingSliderNum; + SliderType _draggingSliderNum; private: /** * Called when a slider has changed */ - void sliderChanged(double offset, int sliderNum); + void sliderChanged(double offset, SliderType sliderNum); public: CPetSound(); @@ -94,9 +97,21 @@ public: virtual bool MouseButtonUpMsg(const Point &pt); /** + * Highlight any currently highlighted element + */ + virtual void highlightCurrent(const Point &pt) { + setSliders(); + } + + /** * Returns the tooltip text for when the glyph is selected */ virtual void getTooltip(CTextControl *text); + + /** + * Sets the positions of the volume sliders + */ + void setSliders(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp index bbe892464f..7476c6eda2 100644 --- a/engines/titanic/pet_control/pet_starfield.cpp +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -94,7 +94,7 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { _petControl->displayMessage(SUPPLY_GALACTIC_REFERENCE); } } else if (!_btnSetDest.MouseButtonDownMsg(msg->_mousePos)) { - return elementsMouseDown(msg); + return markersMouseDown(msg); } return true; @@ -216,33 +216,36 @@ void CPetStarfield::makePetDirty() { _petControl->makeDirty(); } -bool CPetStarfield::elementsMouseDown(CMouseButtonDownMsg *msg) { - if (elementMouseButton(0, msg, _leds[0].getBounds())) +bool CPetStarfield::markersMouseDown(CMouseButtonDownMsg *msg) { + if (markerMouseDown(0, msg, _leds[0].getRawBounds())) return true; - if (elementMouseButton(1, msg, _leds[2].getBounds())) + if (markerMouseDown(1, msg, _leds[2].getRawBounds())) return true; - if (elementMouseButton(2, msg, _leds[4].getBounds())) + if (markerMouseDown(2, msg, _leds[4].getRawBounds())) return true; return false; } -bool CPetStarfield::elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect) { +bool CPetStarfield::markerMouseDown(int index, CMouseButtonDownMsg *msg, const Rect &rect) { if (!rect.contains(msg->_mousePos)) return false; switch (_markerStates[index]) { - case 1: + case MS_FLICKERING: + // Marker is flickering, so lock it in if (_petControl->_remoteTarget) { CPETStarFieldLockMsg lockMsg(1); lockMsg.execute(_petControl->_remoteTarget); } break; - case 2: - if (index < 2 && _markerStates[index] >= 2) { + case MS_HIGHLIGHTED: + // Marker is locked in. If the most recently locked marker + // is clicked on, allow it to be unlocked + if (index == 2 || _markerStates[index + 1] != MS_HIGHLIGHTED) { if (_petControl->_remoteTarget) { - CPETStarFieldLockMsg lockMsg(1); + CPETStarFieldLockMsg lockMsg(0); lockMsg.execute(_petControl->_remoteTarget); } } diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h index deefae74c6..a0aa1c762a 100644 --- a/engines/titanic/pet_control/pet_starfield.h +++ b/engines/titanic/pet_control/pet_starfield.h @@ -56,11 +56,14 @@ private: void drawButton(MarkerState state, int index, CScreenManager *screenManager); /** - * Mouse down handling for Nav elements + * Handles clicking on any of the three locked star LED markers */ - bool elementsMouseDown(CMouseButtonDownMsg *msg); + bool markersMouseDown(CMouseButtonDownMsg *msg); - bool elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect); + /** + * Handles clicking on a specific locked star LED marker + */ + bool markerMouseDown(int index, CMouseButtonDownMsg *msg, const Rect &rect); public: CPetStarfield(); diff --git a/engines/titanic/sound/audio_buffer.cpp b/engines/titanic/sound/audio_buffer.cpp index 636f4a5107..0e1abc4213 100644 --- a/engines/titanic/sound/audio_buffer.cpp +++ b/engines/titanic/sound/audio_buffer.cpp @@ -26,45 +26,45 @@ namespace Titanic { CAudioBuffer::CAudioBuffer(int maxSize) : _finished(false) { - _data.resize(maxSize); reset(); } void CAudioBuffer::reset() { - _frontP = _backP = &_data[0]; + _data.clear(); } void CAudioBuffer::push(int16 value) { - assert(!full()); - compact(); - - *_backP++ = value; + enterCriticalSection(); + _data.push(value); + leaveCriticalSection(); } -void CAudioBuffer::push(int16 *values, int count) { - compact(); - assert(freeSize() >= count); +void CAudioBuffer::push(const int16 *values, int count) { + enterCriticalSection(); + + for (; count > 0; --count, ++values) + _data.push(*values); - Common::copy(values, values + count, _backP); - _backP += count; + leaveCriticalSection(); } int16 CAudioBuffer::pop() { - assert(!empty()); - return *_frontP++; -} + enterCriticalSection(); + int16 value = _data.pop(); + leaveCriticalSection(); -void CAudioBuffer::compact() { - if (_frontP != &_data[0]) { - Common::copy(_frontP, _backP, &_data[0]); - _backP -= _frontP - &_data[0]; - _frontP = &_data[0]; - } + return value; } -int CAudioBuffer::freeSize() { - compact(); - return &_data[0] + _data.size() - _backP; +int CAudioBuffer::read(int16 *values, int count) { + enterCriticalSection(); + + int bytesRead = 0; + for (; count > 0 && !_data.empty(); --count, ++bytesRead) + *values++ = _data.pop(); + + leaveCriticalSection(); + return bytesRead; } void CAudioBuffer::enterCriticalSection() { diff --git a/engines/titanic/sound/audio_buffer.h b/engines/titanic/sound/audio_buffer.h index 8d27667e93..c775c5bb35 100644 --- a/engines/titanic/sound/audio_buffer.h +++ b/engines/titanic/sound/audio_buffer.h @@ -23,22 +23,27 @@ #ifndef TITANIC_AUDIO_BUFFER_H #define TITANIC_AUDIO_BUFFER_H -#include "common/array.h" +#include "titanic/support/fixed_queue.h" #include "common/mutex.h" namespace Titanic { +#define AUDIO_SAMPLING_RATE 22050 + class CAudioBuffer { private: Common::Mutex _mutex; - Common::Array<int16> _data; - int16 *_frontP, *_backP; + FixedQueue<int16, AUDIO_SAMPLING_RATE * 4> _data; +private: + /** + * Enters a critical section + */ + void enterCriticalSection(); /** - * Reclaims any space at the start of the array resulting from - * having read values off the font + * Leave a critical section */ - void compact(); + void leaveCriticalSection(); public: bool _finished; public: @@ -57,17 +62,17 @@ public: /** * Returns the number of 16-bit entries in the buffer */ - int size() const { return _backP - _frontP; } + int size() const { return _data.size(); } /** - * Returns true if the buffer is full + * Returns the number of entries free in the buffer */ - bool full() const { return (_backP - _frontP) == (int)_data.size(); } + int freeSize() const { return _data.freeSize(); } /** - * Returns the number of entries free in the buffer + * Returns true if the buffer is full */ - int freeSize(); + bool full() const { return _data.full(); } /** * Adds a value to the buffer @@ -77,7 +82,7 @@ public: /** * Adds a value to the buffer */ - void push(int16 *values, int count); + void push(const int16 *values, int count); /** * Removes a value from the buffer @@ -85,14 +90,9 @@ public: int16 pop(); /** - * Enters a critical section + * Reads out a specified number of samples */ - void enterCriticalSection(); - - /** - * Leave a critical section - */ - void leaveCriticalSection(); + int read(int16 *values, int count); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/music_room_handler.cpp b/engines/titanic/sound/music_room_handler.cpp index dbbe4e4ca8..5c1cd6012d 100644 --- a/engines/titanic/sound/music_room_handler.cpp +++ b/engines/titanic/sound/music_room_handler.cpp @@ -202,8 +202,6 @@ bool CMusicRoomHandler::update() { } void CMusicRoomHandler::updateAudio() { - _audioBuffer->enterCriticalSection(); - int size = _audioBuffer->freeSize(); int count; int16 *ptr; @@ -220,9 +218,9 @@ void CMusicRoomHandler::updateAudio() { // Iterate through each of the four instruments and do an additive // read that will merge their data onto the output buffer for (count = size, ptr = audioData; count > 0; ) { - int amount = musicWave->read(ptr, count); + int amount = musicWave->read(ptr, count * 2); if (amount > 0) { - count -= amount; + count -= amount / sizeof(uint16); ptr += amount / sizeof(uint16); } else if (!pollInstrument(instrument)) { --_instrumentsActive; @@ -234,8 +232,6 @@ void CMusicRoomHandler::updateAudio() { _audioBuffer->push(audioData, size); delete[] audioData; } - - _audioBuffer->leaveCriticalSection(); } void CMusicRoomHandler::updateInstruments() { diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp index b92329850b..15ac2cd192 100644 --- a/engines/titanic/sound/music_room_instrument.cpp +++ b/engines/titanic/sound/music_room_instrument.cpp @@ -115,7 +115,7 @@ void CMusicRoomInstrument::start() { case MV_BELLS: _gameObjects[0]->loadFrame(0); - _gameObjects[0]->movieSetAudioTiming(true); + _gameObjects[0]->movieSetPlaying(true); break; case MV_SNAKE: @@ -210,8 +210,8 @@ void CMusicRoomInstrument::update(int val) { case MV_BELLS: switch (val) { case 60: - _gameObjects[0]->movieSetAudioTiming(true); _gameObjects[0]->playMovie(0, 512, MOVIE_STOP_PREVIOUS); + _gameObjects[0]->movieSetPlaying(true); _animTime = 0.6; break; diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp index a3c06da2f8..a1091a9763 100644 --- a/engines/titanic/sound/qmixer.cpp +++ b/engines/titanic/sound/qmixer.cpp @@ -29,6 +29,10 @@ namespace Titanic { QMixer::QMixer(Audio::Mixer *mixer) : _mixer(mixer) { } +QMixer::~QMixer() { + _channels.clear(); +} + bool QMixer::qsWaveMixInitEx(const QMIXCONFIG &config) { assert(_channels.empty()); assert(config.iChannels > 0 && config.iChannels < 256); @@ -237,6 +241,11 @@ void QMixer::qsWaveMixPump() { /*------------------------------------------------------------------------*/ +QMixer::ChannelEntry::~ChannelEntry() { + for (Common::List<SoundEntry>::iterator i = _sounds.begin(); i != _sounds.end(); ++i) + delete (*i)._waveFile; +} + byte QMixer::ChannelEntry::getRawVolume() const { // Emperically decided adjustment divisor for distances const double ADJUSTMENT_FACTOR = 5.0; diff --git a/engines/titanic/sound/qmixer.h b/engines/titanic/sound/qmixer.h index 17ca441e83..c6d7fcd520 100644 --- a/engines/titanic/sound/qmixer.h +++ b/engines/titanic/sound/qmixer.h @@ -204,6 +204,7 @@ class QMixer { ChannelEntry() : _volume(0), _panRate(0), _volumeChangeStart(0), _volumeChangeEnd(0), _volumeStart(0), _volumeEnd(0), _distance(0.0), _resetDistance(true) {} + ~ChannelEntry(); /** * Calculates the raw volume level to pass to ScummVM playStream, taking @@ -217,7 +218,7 @@ protected: Audio::Mixer *_mixer; public: QMixer(Audio::Mixer *mixer); - virtual ~QMixer() {} + virtual ~QMixer(); /** * Initializes the mixer diff --git a/engines/titanic/sound/seasonal_music_player.cpp b/engines/titanic/sound/seasonal_music_player.cpp index 40bf7096f2..637a0020ba 100644 --- a/engines/titanic/sound/seasonal_music_player.cpp +++ b/engines/titanic/sound/seasonal_music_player.cpp @@ -21,6 +21,7 @@ */ #include "titanic/sound/seasonal_music_player.h" +#include "titanic/translation.h" namespace Titanic { @@ -119,14 +120,14 @@ bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) { if (!_isRepeated && msg->_flags == 2) { _isRepeated = true; - loadSound("c#64.wav"); - loadSound("c#63.wav"); - loadSound("c#65.wav"); - loadSound("c#62.wav"); - playGlobalSound("c#64.wav", _springMode, _isSpring, true, 0); - playGlobalSound("c#63.wav", _summerMode, _isSummer, true, 1); - playGlobalSound("c#65.wav", _autumnMode, _isAutumn, true, 2); - playGlobalSound("c#62.wav", _winterMode, _isWinter, true, 3); + loadSound(TRANSLATE("c#64.wav", "c#47.wav")); + loadSound(TRANSLATE("c#63.wav", "c#46.wav")); + loadSound(TRANSLATE("c#65.wav", "c#48.wav")); + loadSound(TRANSLATE("c#62.wav", "c#47.wav")); + playGlobalSound(TRANSLATE("c#64.wav", "c#47.wav"), _springMode, _isSpring, true, 0); + playGlobalSound(TRANSLATE("c#63.wav", "c#46.wav"), _summerMode, _isSummer, true, 1); + playGlobalSound(TRANSLATE("c#65.wav", "c#48.wav"), _autumnMode, _isAutumn, true, 2); + playGlobalSound(TRANSLATE("c#62.wav", "c#47.wav"), _winterMode, _isWinter, true, 3); } return true; diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index fb8cc299df..befe1a8e09 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -210,8 +210,10 @@ int CSound::playSpeech(CDialogueFile *dialogueFile, int speechId, CProximity &pr return -1; prox._soundDuration = waveFile->getDurationTicks(); - activateSound(waveFile, prox._disposeAfterUse); + if (prox._soundType != Audio::Mixer::kPlainSoundType) + waveFile->_soundType = prox._soundType; + activateSound(waveFile, prox._disposeAfterUse); return _soundManager.playSound(*waveFile, prox); } diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index a4d838ce2f..677ae0b7f3 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -26,7 +26,6 @@ namespace Titanic { -const uint SAMPLING_RATE = 22050; const uint LATENCY = 100; const uint CHANNELS_COUNT = 16; @@ -110,7 +109,7 @@ QSoundManager::QSoundManager(Audio::Mixer *mixer) : CSoundManager(), QMixer(mixe Common::fill(&_channelsVolume[0], &_channelsVolume[16], 0); Common::fill(&_channelsMode[0], &_channelsMode[16], 0); - qsWaveMixInitEx(QMIXCONFIG(SAMPLING_RATE, CHANNELS_COUNT, LATENCY)); + qsWaveMixInitEx(QMIXCONFIG(AUDIO_SAMPLING_RATE, CHANNELS_COUNT, LATENCY)); qsWaveMixActivate(true); qsWaveMixOpenChannel(0, QMIX_OPENALL); } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 59a514ca3d..e07c62ddec 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -42,11 +42,13 @@ enum VolumeMode { */ class CSoundManager { protected: + uint _handleCtr; + // Old volume levels, deprecated in favor of setting the volumes + // directly in the ScummVM mixer double _musicPercent; double _speechPercent; double _masterPercent; double _parrotPercent; - uint _handleCtr; public: CSoundManager(); virtual ~CSoundManager() {} diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index bd41845712..30446fd992 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -21,6 +21,7 @@ */ #include "titanic/sound/titania_speech.h" +#include "titanic/translation.h" namespace Titanic { @@ -57,15 +58,15 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { CProximity prox(Audio::Mixer::kSpeechSoundType); switch (_actionNum) { case 1: - movieSetAudioTiming(true); - loadSound("a#12.wav"); + loadSound(TRANSLATE("a#12.wav", "a#0.wav")); sleep(1000); playMovie(0, 187, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); + movieSetPlaying(true); movieEvent(0); break; case 2: - loadSound("a#11.wav"); + loadSound(TRANSLATE("a#11.wav", "a#4.wav")); addTimer(0); startAnimTimer("Para2", 300); addTimer(6000); @@ -78,25 +79,25 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { case 3: visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); - loadSound("a#10.wav"); + loadSound(TRANSLATE("a#10.wav", "a#2.wav")); playMovie(585, 706, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound("a#10.wav", prox); + playSound(TRANSLATE("a#10.wav", "a#2.wav"), prox); break; case 4: visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); - loadSound("a#9.wav"); + loadSound(TRANSLATE("a#9.wav", "a#3.wav")); playMovie(707, 905, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound("a#9.wav", prox); + playSound(TRANSLATE("a#9.wav", "a#3.wav"), prox); break; case 5: visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); - loadSound("a#8.wav"); + loadSound(TRANSLATE("a#8.wav", "a#1.wav")); playMovie(906, 938, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); - playSound("a#8.wav", prox); + playSound(TRANSLATE("a#8.wav", "a#1.wav"), prox); break; default: @@ -125,7 +126,7 @@ bool CTitaniaSpeech::MovieFrameMsg(CMovieFrameMsg *msg) { int frame = getMovieFrame(); if (frame == 0) { CProximity prox(Audio::Mixer::kSpeechSoundType); - playSound("a#12.wav", prox); + playSound(TRANSLATE("a#12.wav", "a#0.wav"), prox); } return true; @@ -142,7 +143,7 @@ bool CTitaniaSpeech::TimerMsg(CTimerMsg *msg) { actMsg.execute(this); } else if (msg->_action == "Para2") { CProximity prox(Audio::Mixer::kSpeechSoundType); - playSound("a#11.wav", prox); + playSound(TRANSLATE("a#11.wav", "a#4.wav"), prox); } else { frameMsg._frameNumber = _backgroundFrame++; frameMsg.execute("TitaniaStillControl"); diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp index c1aab42a7f..ba895088ad 100644 --- a/engines/titanic/sound/wave_file.cpp +++ b/engines/titanic/sound/wave_file.cpp @@ -48,14 +48,7 @@ public: }; int AudioBufferStream::readBuffer(int16 *buffer, const int numSamples) { - _audioBuffer->enterCriticalSection(); - int samplesToRead = MIN((const int)numSamples, (const int)_audioBuffer->size()); - - for (int idx = 0; idx < samplesToRead; ++idx) - *buffer++ = _audioBuffer->pop(); - - _audioBuffer->leaveCriticalSection(); - return samplesToRead; + return _audioBuffer->read(buffer, numSamples); } bool AudioBufferStream::endOfData() const { @@ -188,7 +181,7 @@ const int16 *CWaveFile::lock() { switch (_loadMode) { case LOADMODE_SCUMMVM: // Sanity checking that only raw 16-bit LE 22Khz waves can be locked - assert(_waveData && _rate == 22050); + assert(_waveData && _rate == AUDIO_SAMPLING_RATE); assert(_flags == (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS)); assert(_wavType == kWaveFormatPCM); diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index fcd1e9e0ee..71f7de85b2 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -41,27 +41,7 @@ CCameraAutoMover::CCameraAutoMover() : _srcPos(0.0, 1000000.0, 0.0) { _transitionPercentInc = 0.0; } -// TODO: same as setPath also orientations are not used -void CCameraAutoMover::setPath2(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation) { - _srcPos = oldPos; - _destPos = newPos; - _posDelta = _destPos - _srcPos; - - float temp = 0.0; - _posDelta.normalize(temp); // Do the normalization, put the scale amount in temp - _distance = temp; - _active = false; - _field34 = false; - _transitionPercent = 1.0; - _field40 = -1; - _field44 = -1; - _field48 = -1; - _field4C = 0; -} - -// TODO: same as proc2 also orientations are not used -void CCameraAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient) { +void CCameraAutoMover::clear() { _srcPos.clear(); _destPos.clear(); _transitionPercent = 1.0; @@ -70,18 +50,14 @@ void CCameraAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix & _field34 = false; } -// TODO: same as setPath2 also orientations are not used -void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { +void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV) { _srcPos = srcV; _destPos = destV; _posDelta = _destPos - _srcPos; float temp = 0.0; - if (!_posDelta.normalize(temp)) { - // Do the normalization, put the scale amount in temp, - // but if it is unsuccessful, crash - assert(temp); - } + _posDelta.normalize(temp); // normalization won't happen if _posDelta is zero vector + // and that is okay _distance = temp; _active = false; diff --git a/engines/titanic/star_control/camera_auto_mover.h b/engines/titanic/star_control/camera_auto_mover.h index 25384632fa..db57627e33 100644 --- a/engines/titanic/star_control/camera_auto_mover.h +++ b/engines/titanic/star_control/camera_auto_mover.h @@ -32,7 +32,8 @@ namespace Titanic { class CErrorCode; class FMatrix; const int nMoverTransitions = 32; // The number of vector transitions when doing a mover change is fixed -enum MoverState {NOT_ACTIVE=0,MOVING=1,DONE_MOVING=2}; +enum MoverState { NOT_ACTIVE = 0, MOVING = 1, DONE_MOVING = 2 }; + /** * Base class for automatic movement of the starview camera */ @@ -59,14 +60,15 @@ public: CCameraAutoMover(); virtual ~CCameraAutoMover() {} - virtual void setPath2(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation); - /** * Clear src and dest orientation and set some default values for other fields */ - virtual void setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient); - virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation); + void clear(); + + /** + * Setup a transition to from one position to another + */ + void setPath(const FVector &srcV, const FVector &destV); /** * Applys speeds to the mover. More than one application is usually done for several transitions diff --git a/engines/titanic/star_control/fpose.cpp b/engines/titanic/star_control/fpose.cpp index 6795622a93..f3ba1b17d0 100644 --- a/engines/titanic/star_control/fpose.cpp +++ b/engines/titanic/star_control/fpose.cpp @@ -223,7 +223,7 @@ FPose FPose::compose(const FMatrix &m) { am._row2 = m._row2; am._row3 = m._row3; - fposeProd(*this,am,dm); + fposeProd(*this, am, dm); return dm; } diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index aeee2e877b..46094dbdfc 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -117,14 +117,14 @@ FPose FVector::getFrameTransform(const FVector &v) { FVector vector1 = getAnglesAsVect(); matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg); matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg); - fposeProd(matrix1,matrix2,matrix3); + fposeProd(matrix1, matrix2, matrix3); matrix4 = matrix3.inverseTransform(); vector1 = v.getAnglesAsVect(); matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg); matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg); - fposeProd(matrix1,matrix2,matrix3); - fposeProd(matrix4,matrix3,matrix1); + fposeProd(matrix1, matrix2, matrix3); + fposeProd(matrix4, matrix3, matrix1); return matrix1; } @@ -135,7 +135,7 @@ FPose FVector::formRotXY() const { m1.setRotationMatrix(X_AXIS, v1._y * Rad2Deg); m2.setRotationMatrix(Y_AXIS, v1._z * Rad2Deg); FPose m3; - fposeProd(m1,m2,m3); + fposeProd(m1, m2, m3); return m3; } diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp index 0787c48de3..ae987aa8fc 100644 --- a/engines/titanic/star_control/marked_auto_mover.cpp +++ b/engines/titanic/star_control/marked_auto_mover.cpp @@ -26,9 +26,9 @@ namespace Titanic { -void CMarkedAutoMover::setPath2(const FVector &oldPos, const FVector &newPos, +void CMarkedAutoMover::setPathOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation) { - CCameraAutoMover::setPath2(oldPos, newPos, oldOrientation, newOrientation); + CCameraAutoMover::setPath(oldPos, newPos); double distance = _distance; _active = true; diff --git a/engines/titanic/star_control/marked_auto_mover.h b/engines/titanic/star_control/marked_auto_mover.h index 856df99c03..ca7fbf3b7f 100644 --- a/engines/titanic/star_control/marked_auto_mover.h +++ b/engines/titanic/star_control/marked_auto_mover.h @@ -41,7 +41,7 @@ private: public: virtual ~CMarkedAutoMover() {} - virtual void setPath2(const FVector &oldPos, const FVector &newPos, + void setPathOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation); /** diff --git a/engines/titanic/star_control/marked_camera_mover.cpp b/engines/titanic/star_control/marked_camera_mover.cpp index ff9c055abb..df6edbec5f 100644 --- a/engines/titanic/star_control/marked_camera_mover.cpp +++ b/engines/titanic/star_control/marked_camera_mover.cpp @@ -32,13 +32,12 @@ CMarkedCameraMover::CMarkedCameraMover(const CNavigationInfo *src) : CCameraMover(src) { } - void CMarkedCameraMover::transitionBetweenPosOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation) { if (isLocked()) decLockCount(); - _autoMover.setPath2(oldPos, newPos, oldOrientation, newOrientation); + _autoMover.setPathOrients(oldPos, newPos, oldOrientation, newOrientation); incLockCount(); } diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index cab29a99f4..4a5515f419 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -41,7 +41,7 @@ FMatrix *CStarCamera::_newOrientation; CStarCamera::CStarCamera(const CNavigationInfo *data) : _starLockState(ZERO_LOCKED), _mover(nullptr), _isMoved(false), _isInLockingProcess(false) { - setupHandler(data); + setMoverType(data); } CStarCamera::CStarCamera(CViewport *src) : @@ -69,7 +69,7 @@ bool CStarCamera::isNotInLockingProcess() { } CStarCamera::~CStarCamera() { - deleteHandler(); + removeMover(); } void CStarCamera::proc2(const CViewport *src) { @@ -246,7 +246,7 @@ FVector CStarCamera::proc30(int index, const FVector &v) { } FVector CStarCamera::proc31(int index, const FVector &v) { - return _viewport.getRelativePosCentering2(index, v); + return _viewport.getRelativePosCenteringRaw(index, v); } void CStarCamera::setViewportAngle(const FPoint &angles) { @@ -255,8 +255,6 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { if (isLocked()) return; - _isInLockingProcess = false; - switch(_starLockState) { case ZERO_LOCKED: { FPose subX(X_AXIS, angles._y); @@ -329,11 +327,11 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { diffV = tempV1; m1 = diffV.formRotXY(); FPose m11; - fposeProd(m1,subX,m11); + fposeProd(m1, subX, m11); subX = m11.inverseTransform(); FPose m12; - fposeProd(subX,subY,m12); + fposeProd(subX, subY, m12); FMatrix m3 = _viewport.getOrientation(); tempV2 = _viewport._position; @@ -391,7 +389,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { break; } - // TODO: should three stars locked do anything in this function? Error? + // All three stars are locked on in this case so the camera does not move + // in response to the users mouse movements case THREE_LOCKED: break; } @@ -403,12 +402,12 @@ bool CStarCamera::addLockedStar(const FVector v) { CNavigationInfo data; _mover->copyTo(&data); - deleteHandler(); + removeMover(); FVector &row = _lockedStarsPos[(int)_starLockState]; _starLockState = StarLockState((int)_starLockState + 1); row = v; - setupHandler(&data); + setMoverType(&data); return true; } @@ -418,10 +417,10 @@ bool CStarCamera::removeLockedStar() { CNavigationInfo data; _mover->copyTo(&data); - deleteHandler(); + removeMover(); _starLockState = StarLockState((int)_starLockState - 1); - setupHandler(&data); + setMoverType(&data); return true; } @@ -437,7 +436,7 @@ void CStarCamera::save(SimpleFile *file, int indent) { _viewport.save(file, indent); } -bool CStarCamera::setupHandler(const CNavigationInfo *src) { +bool CStarCamera::setMoverType(const CNavigationInfo *src) { CCameraMover *mover = nullptr; switch (_starLockState) { @@ -456,7 +455,7 @@ bool CStarCamera::setupHandler(const CNavigationInfo *src) { } if (mover) { - assert(!_mover); + assert(!_mover); // removeMover() is usually called before this function so _mover is null _mover = mover; return true; } else { @@ -464,10 +463,11 @@ bool CStarCamera::setupHandler(const CNavigationInfo *src) { } } -void CStarCamera::deleteHandler() { +void CStarCamera::removeMover() { if (_mover) { delete _mover; _mover = nullptr; + _isInLockingProcess = false; } } @@ -505,7 +505,9 @@ bool CStarCamera::lockMarker1(FVector v1, FVector firstStarPosition, FVector v3) FMatrix matrix = _viewport.getOrientation(); const FVector &pos = _viewport._position; - _mover->transitionBetweenOrientations(v3, tempV, pos, matrix); // TODO: pos does not get used in this function + _mover->transitionBetweenOrientations(v3, tempV, pos, matrix); // TODO: pos does not get used in this function, + // i.e., _mover has CUnmarkedCameraMover handle which means + // CUnmarkedCameraMover::transitionBetweenOrientations gets called CStarVector *sv = new CStarVector(this, firstStarPosition); _mover->setVector(sv); @@ -523,7 +525,7 @@ bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosi FVector starDelta = secondStarPosition - firstStarPosition; FPose m10 = starDelta.formRotXY(); FPose m11; - fposeProd(m10,m3,m11); + fposeProd(m10, m3, m11); m10 = m11.inverseTransform(); @@ -570,7 +572,7 @@ bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosi FVector x1(viewPosition2); FVector x2(m3._row1); // Find the angle of rotation for m4._row1 that gives the minimum distance to viewPosition - float minDegree = calcAngleForMinDist(x1,x2,minDistance); + float minDegree = calcAngleForMinDist(x1, x2, minDistance); m3.rotVectAxisY((double)minDegree); FPose m13; @@ -613,7 +615,7 @@ bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &thirdStarPosit FMatrix newOr = viewport->getOrientation(); FMatrix oldOr = _viewport.getOrientation(); FVector newPos = viewport->_position; - FVector oldPos = _viewport._position; + //FVector oldPos = _viewport._position; // WORKAROUND: set old position to new position (1st argument), this prevents // locking issues when locking the 3rd star. Fixes #9961. diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index 3ffb74950a..f2d27212fe 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -47,20 +47,22 @@ private: private: StarLockState _starLockState; FMatrix _lockedStarsPos; // Each row represents the location of a locked star - CCameraMover *_mover; + CCameraMover *_mover; // A marked or unmarked camera mover, contains an automover CViewport _viewport; - bool _isMoved; // TODO: determine if this is being used + bool _isMoved; // Used in CPetStarfield to determine if a star destination can be set bool _isInLockingProcess; // The mover/view is homing in on a new star private: /** - * Set up a handler + * Set Mover type to be unmarked or marked camera mover based on + * the number of stars currently locked (_starLockState) + * The CNavigationInfo data is used to initialize the mover */ - bool setupHandler(const CNavigationInfo *src); + bool setMoverType(const CNavigationInfo *src); /** - * Deletes any previous handler + * Deletes the previous mover handle */ - void deleteHandler(); + void removeMover(); /** * Return whether the handler is locked diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index cc414305eb..8464262b31 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -145,6 +145,18 @@ void CStarControl::newFrame() { } } +bool CStarControl::isStarFieldMode() { + if (!_petControl) + _petControl = getPetControl(); + + if (_petControl) { + + if (_starField.getMode() == MODE_STARFIELD) + return true; + } + return false; +} + void CStarControl::doAction(StarControlAction action) { if (!_enabled) return; diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index e4072d7d62..7efd3869c1 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -70,6 +70,11 @@ public: virtual void draw(CScreenManager *screenManager); /** + * _starField is currently showing the starfield + */ + bool isStarFieldMode(); + + /** * Does an action in the star control */ void doAction(StarControlAction action); diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp index d8a0bdc405..0328743a98 100644 --- a/engines/titanic/star_control/star_points1.cpp +++ b/engines/titanic/star_control/star_points1.cpp @@ -56,6 +56,7 @@ bool CStarPoints1::initialize() { entry._z = sin(v2) * 3000000.0; } + delete stream; return true; } diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp index 23cef4ce4c..aa5444f16b 100644 --- a/engines/titanic/star_control/star_points2.cpp +++ b/engines/titanic/star_control/star_points2.cpp @@ -61,6 +61,7 @@ bool CStarPoints2::initialize() { } } + delete stream; return true; } diff --git a/engines/titanic/star_control/unmarked_auto_mover.cpp b/engines/titanic/star_control/unmarked_auto_mover.cpp index c84fbbab00..b8cd042e9c 100644 --- a/engines/titanic/star_control/unmarked_auto_mover.cpp +++ b/engines/titanic/star_control/unmarked_auto_mover.cpp @@ -28,7 +28,7 @@ namespace Titanic { void CUnmarkedAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient) { - CCameraAutoMover::setOrientations(srcOrient, destOrient); + CCameraAutoMover::clear(); _orientationChanger.load(srcOrient, destOrient); _transitionPercentInc = 0.1; _transitionPercent = 0.0; @@ -36,8 +36,8 @@ void CUnmarkedAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix _active = true; } -void CUnmarkedAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { - CCameraAutoMover::setPath(srcV, destV, orientation); +void CUnmarkedAutoMover::setPathOrient(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { + CCameraAutoMover::setPath(srcV, destV); if (_distance > 8000.0) { _active = true; diff --git a/engines/titanic/star_control/unmarked_auto_mover.h b/engines/titanic/star_control/unmarked_auto_mover.h index b7fb4e3c66..41c13311e0 100644 --- a/engines/titanic/star_control/unmarked_auto_mover.h +++ b/engines/titanic/star_control/unmarked_auto_mover.h @@ -37,9 +37,9 @@ public: virtual void setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient); /** - * Sets the path to animate movement between + * Sets the path and starting and ending orientations to animate movement between */ - virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation); + void setPathOrient(const FVector &srcV, const FVector &destV, const FMatrix &orientation); virtual MoverState move(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); }; diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp index 200d549ce1..c879dc25e8 100644 --- a/engines/titanic/star_control/unmarked_camera_mover.cpp +++ b/engines/titanic/star_control/unmarked_camera_mover.cpp @@ -41,7 +41,7 @@ void CUnmarkedCameraMover::moveTo(const FVector &srcV, const FVector &destV, con debugC(DEBUG_BASIC, kDebugStarfield, "Starfield move %s to %s", srcV.toString().c_str(), destV.toString().c_str()); - _autoMover.setPath(srcV, destV, orientation); + _autoMover.setPathOrient(srcV, destV, orientation); } // TODO: v3 is unused diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp index d277f4a2c5..e368dfa317 100644 --- a/engines/titanic/star_control/viewport.cpp +++ b/engines/titanic/star_control/viewport.cpp @@ -260,8 +260,8 @@ FVector CViewport::getRelativePosCentering(int index, const FVector &src) { return dest; } -// TODO: Identical to getRelativePosCentering, was this meant to be different? -FVector CViewport::getRelativePosCentering2(int index, const FVector &src) { +// Similar to getRelativePosCentering, but uses the raw/transpose version of Pose +FVector CViewport::getRelativePosCenteringRaw(int index, const FVector &src) { FVector dest; FPose pose = getRawPose(); FVector tv = src.matProdRowVect(pose); diff --git a/engines/titanic/star_control/viewport.h b/engines/titanic/star_control/viewport.h index d5c35b6317..082d063233 100644 --- a/engines/titanic/star_control/viewport.h +++ b/engines/titanic/star_control/viewport.h @@ -125,7 +125,7 @@ public: FPose getRawPose(); FVector getRelativePosNoCentering(int index, const FVector &src); FVector getRelativePosCentering(int index, const FVector &src); - FVector getRelativePosCentering2(int index, const FVector &src); + FVector getRelativePosCenteringRaw(int index, const FVector &src); /** * All arguments are return values diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index bddbb9808e..4b60921e31 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -44,7 +44,7 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) { _videoSurface = nullptr; _streamCount = 0; _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; - _framePixels = nullptr; + _framePixels = false; _priorFrameTime = 0; // Reset current frame. We need to keep track of frames separately from the decoder, @@ -55,8 +55,15 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) { // Create a decoder _decoder = new AVIDecoder(); - if (!_decoder->loadFile(_movieName)) + + // Load the video into it + if (_movieName == "y222.avi") { + // The y222.avi is the bells animation for the music room. + // It needs on the fly fixing for the video header + _decoder->loadStream(new y222()); + } else if (!_decoder->loadFile(_movieName)) { error("Could not open video - %s", key.getString().c_str()); + } _streamCount = _decoder->getTransparencyTrack() ? 2 : 1; @@ -68,7 +75,6 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) { AVISurface::~AVISurface() { if (_videoSurface) _videoSurface->_flipVertically = false; - delete _framePixels; delete _movieFrameSurface[0]; delete _movieFrameSurface[1]; delete _decoder; @@ -285,8 +291,7 @@ void AVISurface::setupDecompressor() { } if (!flag) { - _framePixels = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(), - _decoder->getVideoTrack(0).getPixelFormat()); + _framePixels = true; } else if (idx == 0) { // The original developers used a vertical flipped playback to indicate // an incompatibility between source video and dest surface bit-depths, @@ -486,6 +491,12 @@ bool AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { if (_currentFrame != ((int)startFrame - 1) || startFrame == 0) { // Start video playback at the desired starting frame + if (startFrame > 0) { + // Give a chance for a key frame just prior to the start frame + // to be loaded first + setFrame(startFrame - 1); + } + setFrame(startFrame); startAtFrame(startFrame); _currentFrame = startFrame; @@ -532,4 +543,28 @@ uint AVISurface::getBitDepth() const { return _decoder->getVideoTrack(0).getBitCount(); } +/*------------------------------------------------------------------------*/ + +y222::y222() { + _innerStream = new File(); + _innerStream->open("y222.avi"); +} + +y222::~y222() { + delete _innerStream; +} + +uint32 y222::read(void *dataPtr, uint32 dataSize) { + int32 currPos = pos(); + uint32 bytesRead = _innerStream->read(dataPtr, dataSize); + + if (currPos <= 48 && (currPos + bytesRead) >= 52) { + byte *framesP = (byte *)dataPtr + (48 - currPos); + if (READ_LE_UINT32(framesP) == 1) + WRITE_LE_UINT32(framesP, 1085); + } + + return bytesRead; +} + } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index cb2e562d54..3ee8c38c5c 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -23,6 +23,7 @@ #ifndef TITANIC_AVI_SURFACE_H #define TITANIC_AVI_SURFACE_H +#include "common/stream.h" #include "video/avi_decoder.h" #include "graphics/managed_surface.h" #include "titanic/core/resource_key.h" @@ -41,6 +42,37 @@ enum MovieFlag { MOVIE_WAIT_FOR_FINISH = 0x10 // Let finish before playing next movie for object }; +/** + * This implements a special read stream for the y222.avi video + * that fixes that totalFrames field of the header from it's + * incorrect value of 1 to a correct 1085. + */ +class y222 : virtual public Common::SeekableReadStream { +private: + File *_innerStream; +public: + y222(); + virtual ~y222(); + + virtual uint32 read(void *dataPtr, uint32 dataSize); + virtual bool eos() const { return _innerStream->eos(); } + virtual int32 pos() const { return _innerStream->pos(); } + virtual int32 size() const { return _innerStream->size(); } + virtual bool seek(int32 offset, int whence = SEEK_SET) { + return _innerStream->seek(offset, whence); + } + virtual bool skip(uint32 offset) { + return _innerStream->skip(offset); + } + virtual char *readLine(char *s, size_t bufSize) { + return _innerStream->readLine(s, bufSize); + } + virtual Common::String readLine() { + return _innerStream->readLine(); + } +}; + + class AVIDecoder : public Video::AVIDecoder { public: AVIDecoder() {} @@ -72,7 +104,7 @@ private: CMovieRangeInfoList _movieRangeInfo; int _streamCount; Graphics::ManagedSurface *_movieFrameSurface[2]; - Graphics::ManagedSurface *_framePixels; + bool _framePixels; double _frameRate; int _currentFrame, _priorFrame; uint32 _priorFrameTime; @@ -152,6 +184,13 @@ public: } /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag) { + _decoder->pauseVideo(!playingFlag); + } + + /** * Handle any movie events relevent for the frame */ virtual bool handleEvents(CMovieEventList &events); diff --git a/engines/titanic/support/direct_draw.cpp b/engines/titanic/support/direct_draw.cpp index 71a90ad00d..9559480a3b 100644 --- a/engines/titanic/support/direct_draw.cpp +++ b/engines/titanic/support/direct_draw.cpp @@ -64,6 +64,8 @@ DirectDrawManager::DirectDrawManager(TitanicEngine *vm, bool windowed) { void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSurfaces) { debugC(DEBUG_BASIC, kDebugGraphics, "Initialising video surfaces"); + assert(numBackSurfaces == 0); + _directDraw._width = width; _directDraw._numBackSurfaces = numBackSurfaces; _directDraw._height = height; @@ -81,10 +83,9 @@ void DirectDrawManager::initFullScreen() { _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, _directDraw._bpp, 0); + // Set up the main surface to point to the screen _mainSurface = new DirectDrawSurface(); _mainSurface->create(g_vm->_screen); - _backSurfaces[0] = new DirectDrawSurface(); - _backSurfaces[0]->create(_directDraw._width, _directDraw._height, 32); } DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int bpp, int surfaceNum) { diff --git a/engines/titanic/support/exe_resources.cpp b/engines/titanic/support/exe_resources.cpp index 2b2c9c7635..b216ea5c26 100644 --- a/engines/titanic/support/exe_resources.cpp +++ b/engines/titanic/support/exe_resources.cpp @@ -27,12 +27,12 @@ namespace Titanic { CExeResources::CExeResources() : _owner(nullptr), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0) { + _fieldC(0), _field10(0), _field14(0), _vocabMode(VOCAB_MODE_NONE) { } -void CExeResources::reset(CScriptHandler *owner, int val1, int val2) { +void CExeResources::reset(CScriptHandler *owner, int val1, VocabMode vocabMode) { _owner = owner; - _field18 = val2; + _vocabMode = vocabMode; } } // End of namespace Titanic diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h index 993c34db97..382df39984 100644 --- a/engines/titanic/support/exe_resources.h +++ b/engines/titanic/support/exe_resources.h @@ -29,6 +29,8 @@ class CScriptHandler; enum FileHandle { HANDLE_STDIN = 0, HANDLE_STDOUT = 1, HANDLE_STDERR = 2 }; +enum VocabMode { VOCAB_MODE_NONE = 0, VOCAB_MODE_EN = 3, VOCAB_MODE_DE = 5 }; + class CExeResources { public: CScriptHandler *_owner; @@ -37,14 +39,21 @@ public: int _fieldC; int _field10; int _field14; - int _field18; + VocabMode _vocabMode; public: CExeResources(); - void reset(CScriptHandler *owner, int val1, int val2); + void reset(CScriptHandler *owner, int val1, VocabMode vocabMode); + + /** + * Tests whether the vocab mode equals the passed mode + */ + bool isVocabMode(int mode) const { return _vocabMode == mode; } - bool is18Equals(int val) const { return _field18 == val; } - int get18() const { return _field18; } + /** + * Returns the vocab mode + */ + VocabMode getVocabMode() const { return _vocabMode; } }; } // End of namespace Titanic diff --git a/engines/titanic/support/fixed_queue.h b/engines/titanic/support/fixed_queue.h new file mode 100644 index 0000000000..dbcbeb669c --- /dev/null +++ b/engines/titanic/support/fixed_queue.h @@ -0,0 +1,143 @@ +/* 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_FIXED_QUEUE_H +#define TITANIC_FIXED_QUEUE_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace Titanic { + +/** + * Extremly simple fixed size queue class. + */ +template<class T, uint MAX_SIZE = 10> +class FixedQueue { + typedef uint size_type; +protected: + Common::Array<T> _data; + size_type _topIndex; +public: + FixedQueue<T, MAX_SIZE>() : _topIndex(0) { + _data.reserve(MAX_SIZE); + } + + /** + * Returns the size of the queue in use + */ + size_type size() const { return _data.size() - _topIndex; } + + /** + * Returns the amount of free remaining space in the queue + */ + size_type freeSize() const { return MAX_SIZE - size(); } + + /** + * Returns true if the queue is empty + */ + bool empty() const { + return size() == 0; + } + + /** + * Returns true if the queue is full + */ + bool full() const { + return freeSize() == 0; + } + + /** + * Clears the queue + */ + void clear() { + _data.clear(); + _topIndex = 0; + } + + /** + * If the tail of the queue in use has reached the end of the internal + * array, pushes all pending data back to the start of the array + */ + void compact() { + if (_data.size() == MAX_SIZE && _topIndex > 0) { + if (_topIndex < MAX_SIZE) + Common::copy(&_data[_topIndex], &_data[0] + MAX_SIZE, &_data[0]); + _data.resize(size()); + _topIndex = 0; + } + } + + /** + * Adds a value to the end of the queue + */ + void push(const T &v) { + assert(size() < MAX_SIZE); + compact(); + _data.push_back(v); + } + + /** + * Returns the top value on the queue + */ + const T &top() const { + assert(size() > 0); + return _data[_topIndex]; + } + + /** + * Returns the top value on the queue + */ + T &top() { + assert(size() > 0); + return _data[_topIndex]; + } + + /** + * Pops the top value off the queue + */ + T pop() { + T tmp = top(); + ++_topIndex; + return tmp; + } + + /** + * Returns values from within the queue without popping them + */ + T &operator[](size_type i) { + assert(i < size()); + return _data[_topIndex + i]; + } + + /** + * Returns values from within the queue without popping them + */ + const T &operator[](size_type i) const { + assert(i < size()); + return _data[_topIndex + i]; + } +}; + +} // End of namespace Titanic + +#endif diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 56e7b7e6f2..8c130ddb6f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -40,8 +40,7 @@ namespace Titanic { CMovieList *CMovie::_playingMovies; CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false), - _hasAudioTiming(false) { +CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false) { } CMovie::~CMovie() { @@ -200,6 +199,10 @@ void OSMovie::setFrameRate(double rate) { _aviSurface.setFrameRate(rate); } +void OSMovie::setPlaying(bool playingFlag) { + _aviSurface.setPlaying(playingFlag); +} + Graphics::ManagedSurface *OSMovie::duplicateTransparency() const { return _aviSurface.duplicateTransparency(); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index cedf7c4d20..36a76654e4 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -50,7 +50,6 @@ protected: public: bool _handled; bool _hasVideoFrame; - bool _hasAudioTiming; public: static CMovieList *_playingMovies; static CVideoSurface *_movieSurface; @@ -139,6 +138,11 @@ public: virtual void setFrameRate(double rate) = 0; /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag) = 0; + + /** * Creates a duplicate of the transparency surface */ virtual Graphics::ManagedSurface *duplicateTransparency() const = 0; @@ -247,6 +251,11 @@ public: virtual void setFrameRate(double rate); /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag); + + /** * Creates a duplicate of the transparency surface */ virtual Graphics::ManagedSurface *duplicateTransparency() const; diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 67bdf82fa0..e0e4a07ce6 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -56,10 +56,12 @@ namespace Titanic { TitanicEngine *g_vm; +Common::Language g_language; TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic") { g_vm = this; + g_language = getLanguage(); _debugger = nullptr; _events = nullptr; _filesManager = nullptr; @@ -69,6 +71,7 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe _scriptHandler = nullptr; _script = nullptr; CMusicRoom::_musicHandler = nullptr; + _loadSaveSlot = -1; // Set up debug channels DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level"); @@ -119,6 +122,8 @@ bool TitanicEngine::initialize() { setItemNames(); setRoomNames(); + syncSoundSettings(); + _window->applicationStarting(); return true; } @@ -186,12 +191,16 @@ void TitanicEngine::setRoomNames() { bool TitanicEngine::canLoadGameStateCurrently() { CGameManager *gameManager = _window->_gameManager; CScreenManager *screenMan = CScreenManager::_screenManagerPtr; + + if (!gameManager) + // Allow loading from copyright screen and continue dialogs + return true; if (!_window->_inputAllowed) return false; if (screenMan && screenMan->_inputHandler->isLocked()) return false; - if (!gameManager || !gameManager->isntTransitioning()) + if (!gameManager->isntTransitioning()) return false; CProjectItem *project = gameManager->_project; @@ -218,7 +227,11 @@ bool TitanicEngine::canSaveGameStateCurrently() { } Common::Error TitanicEngine::loadGameState(int slot) { - _window->_project->loadGame(slot); + CGameManager *gameManager = _window->_gameManager; + if (!gameManager) + _loadSaveSlot = slot; + else + _window->_project->loadGame(slot); return Common::kNoError; } @@ -258,6 +271,17 @@ CString TitanicEngine::getSavegameName(int slot) { return CString(); } +void TitanicEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + if (_window->_project) { + CPetControl *pet = _window->_project->getPetControl(); + if (pet) { + pet->syncSoundSettings(); + } + } +} + void TitanicEngine::GUIError(const char *msg, ...) { char buffer[STRINGBUFLEN]; va_list va; diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index c49a13747f..5efefe41bd 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -63,8 +63,6 @@ namespace Titanic { #define MAX_SAVES 99 -#define SOUND(enName, deName) (g_vm->isGerman() ? deName : enName) - // If enabled, fixes an original bug where dispensed chickens weren't // meant to be hot unless the Yellow fuse was left in the Fusebox. // This is being left disabled for now, since most walkthroughs for @@ -105,7 +103,6 @@ private: void setRoomNames(); protected: const TitanicGameDescription *_gameDescription; - int _loadSaveSlot; // Engine APIs virtual void initializePath(const Common::FSNode &gamePath); @@ -130,6 +127,7 @@ public: StringArray _roomNames; Strings _strings; CString _stateRoomExitView; + int _loadSaveSlot; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); @@ -156,6 +154,11 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); /** + * Handles updates to the sound levels + */ + virtual void syncSoundSettings(); + + /** * Gets the game features */ uint32 getFeatures() const; diff --git a/engines/titanic/translation.h b/engines/titanic/translation.h new file mode 100644 index 0000000000..c34e557208 --- /dev/null +++ b/engines/titanic/translation.h @@ -0,0 +1,36 @@ +/* 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_TRANSLATION_H +#define TITANIC_TRANSLATION_H + +#include "common/language.h" + +namespace Titanic { + +#define TRANSLATE(enVal, deVal) (g_language == Common::DE_DEU ? deVal : enVal) + +extern Common::Language g_language; + +} // End of namespace Titanic + +#endif /* TITANIC_TRANSLATION_H */ diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index be1c73b1e9..430330a35a 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -24,22 +24,34 @@ #include "titanic/true_talk/barbot_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { -static const int STATE_ARRAY[7] = { - 0xCAB0, 0xCAB2, 0xCAB3, 0xCAB4, 0xCAB5, 0xCAB6, 0xCAB7 +static const int STATE_ARRAY_EN[7] = { + 51888, 51890, 51891, 51892, 51893, 51894, 51895 +}; +static const int STATE_ARRAY_DE[7] = { + 51903, 51905, 51906, 51907, 51908, 51909, 51910 }; -static const uint ARRAY1[] = { +static const uint ARRAY1_EN[23] = { 0, 50033, 50044, 50045, 50046, 50047, 50048, 50049, 50050, 50051, 50034, 50035, 50036, 50037, 50038, 50039, 50040, 50041, 50042, 50043, 50411, 0 }; +static const uint ARRAY1_DE[23] = { + 0, 50033, 50044, 50045, 50046, 50047, 50048, 50049, 50050, + 50051, 50034, 50035, 50036, 50037, 50038, 50039, 50040, + 50041, 50042, 50043, 50421, 0, 0 +}; -static const uint ARRAY2[] = { +static const uint ARRAY2_EN[10] = { 51899, 51900, 51901, 51902, 51903, 51904, 51905, 51906, 51907, 0 }; +static const uint ARRAY2_DE[10] = { + 51914, 51915, 51916, 51917, 51918, 51919, 51920, 51921, 51922, 0 +}; BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : @@ -74,9 +86,9 @@ int BarbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentenc if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { if (_state < 7) { - addResponse(STATE_ARRAY[_state++]); + addResponse(TRANSLATE(STATE_ARRAY_EN[_state++], STATE_ARRAY_DE[_state++])); } else { - selectResponse(51896); + selectResponse(TRANSLATE(51896, 51911)); setState(1); _state = 0; } @@ -142,7 +154,11 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent if (isState9()) { if (sentence->localWord("visioncenter") || sentence->localWord("brain") || sentence->contains("vision") || sentence->contains("visual") || - sentence->contains("brain") || sentence->contains("crystal")) { + sentence->contains("brain") || sentence->contains("crystal") || + sentence->contains("gesichtsmodul") || sentence->contains("sehmodul") || + sentence->contains("gesichtszentrum") || sentence->contains("hirn") || + sentence->contains("hirnstueck") + ) { if (CTrueTalkManager::getStateValue(2)) { addResponse(getDialogueId(251003)); applyResponse(); @@ -151,40 +167,40 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent } } - if (sentence->contains("goldfish")) { + if (sentence->contains("goldfish") || sentence->contains("goldfisch")) { addResponse(getDialogueId(250184)); applyResponse(); return 2; } - dialogueId = ARRAY1[getRandomNumber(20)]; - if (!ARRAY2[_arrIndex]) + dialogueId = TRANSLATE(ARRAY1_EN[getRandomNumber(20)], ARRAY1_DE[getRandomNumber(20)]); + if (!TRANSLATE(ARRAY2_EN[_arrIndex], ARRAY2_DE[_arrIndex])) _arrIndex = 0; if (_arrIndex) { - dialogueId = ARRAY2[_arrIndex++]; + dialogueId = TRANSLATE(ARRAY2_EN[_arrIndex++], ARRAY2_DE[_arrIndex++]); } else if (getRandomNumber(100) > 35) { - dialogueId = ARRAY2[0]; + dialogueId = TRANSLATE(ARRAY2_EN[0], ARRAY2_DE[0]); _arrIndex = 1; } else if (getRandomNumber(100) > 60) { switch (sentence->_category) { case 2: - dialogueId = 51914; + dialogueId = TRANSLATE(51914, 51929); break; case 3: - dialogueId = 51911; + dialogueId = TRANSLATE(51911, 51926); break; case 4: - dialogueId = 51913; + dialogueId = TRANSLATE(51913, 51928); break; case 5: - dialogueId = 51912; + dialogueId = TRANSLATE(51912, 51927); break; case 6: - dialogueId = 51915; + dialogueId = TRANSLATE(51915, 51930); break; case 7: - dialogueId = 51909; + dialogueId = TRANSLATE(51909, 51924); break; default: break; @@ -215,56 +231,60 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent if (!val34) { goto done; - } else if (val34 > 50357) { + } else if (val34 > TRANSLATE(50357, 50366)) { goto done; - } else if (val34 == 50357) { - return applySentenceIds(50358, -1); + } else if (val34 == TRANSLATE(50357, 50366)) { + return applySentenceIds(TRANSLATE(50358, 50367), -1); } switch (val34) { case 1: if (flag) - return applySentenceIds(51898, 2); + return applySentenceIds(TRANSLATE(51898, 51913), 2); if (flag2) - return applySentenceIds(51897); + return applySentenceIds(TRANSLATE(51897, 51912)); break; case 2: if (flag) - return applySentenceIds(51897); + return applySentenceIds(TRANSLATE(51897, 51912)); break; case 3: - if (sentence->localWord("useless") || sentence->contains("useless")) - return applySentenceIds(50824); + if (sentence->localWord("useless") || sentence->contains("useless") || + sentence->contains("hoffnungsloser fall")) + return applySentenceIds(TRANSLATE(50824, 50837)); break; case 4: if (flag) - return applySentenceIds(getRandomBit() ? 50512 : 51642); + return applySentenceIds(getRandomBit() ? + TRANSLATE(50512, 50522) : TRANSLATE(51642, 51657)); else if (flag2) - return applySentenceIds(getRandomBit() ? 50511 : 51643); + return applySentenceIds(getRandomBit() ? + TRANSLATE(50511, 50521) : TRANSLATE(51643, 51658)); break; case 5: if (flag) - return applySentenceIds(50829, 6); + return applySentenceIds(TRANSLATE(50829, 50842), 6); if (flag2) - return applySentenceIds(50828); + return applySentenceIds(TRANSLATE(50828, 50841)); break; case 6: if (flag) - return applySentenceIds(50831); + return applySentenceIds(TRANSLATE(50831, 50844)); if (flag2) - return applySentenceIds(50830); + return applySentenceIds(TRANSLATE(50830, 50843)); break; case 7: - if (flag2 || sentence->contains("never")) - return applySentenceIds(51553); - if (flag || sentence->contains("nicest")) - return applySentenceIds(51554); + if (flag2 || sentence->contains("never") || sentence->contains("niemals") || + sentence->contains("nie")) + return applySentenceIds(TRANSLATE(51553, 51568)); + if (flag || sentence->contains("nicest") || sentence->contains("schoenste")) + return applySentenceIds(TRANSLATE(51554, 51569)); break; case 8: if (flag) - return applySentenceIds(50961); + return applySentenceIds(TRANSLATE(50961, 50974)); if (flag2) - return applySentenceIds(50960); + return applySentenceIds(TRANSLATE(50960, 50973)); break; case 9: if (flag) @@ -299,7 +319,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent return applySentenceIds(getDialogueId(250946)); break; case 15: - if (flag || sentence->contains("or")) { + if (flag || sentence->contains("or") || sentence->contains("oder")) { return applySentenceIds(getDialogueId(250526), 16); } else { if (g_vm->_trueTalkManager->_quotesTree.search( @@ -311,9 +331,9 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent break; case 17: if (flag) { - return applySentenceIds(50382); + return applySentenceIds(TRANSLATE(50382, 50391)); } else if (flag2) { - return applySentenceIds(51423); + return applySentenceIds(TRANSLATE(51423, 51438)); } // Intentional fall-through @@ -327,15 +347,15 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent return applySentenceIds(getDialogueId(250565), 20); case 20: if (flag) - return applySentenceIds(50307); + return applySentenceIds(TRANSLATE(50307, 50315)); if (flag2) - return applySentenceIds(50306); + return applySentenceIds(TRANSLATE(50306, 50314)); break; case 21: if (flag) - return applySentenceIds(50359); + return applySentenceIds(TRANSLATE(50359, 50368)); if (flag2) - return applySentenceIds(50357); + return applySentenceIds(TRANSLATE(50357, 50366)); break; case 23: if (val2C == 6 || val2C == 10) @@ -344,7 +364,10 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent case 24: if (sentence->contains("do not know") || sentence->contains("no idea") - || sentence->contains("a clue")) { + || sentence->contains("a clue") + || sentence->contains("keine ahnung") + || sentence->contains("weiss nicht") + || sentence->contains("keinen schimmer")) { return applySentenceIds(getDialogueId(250553)); } else { return applySentenceIds(getDialogueId(250552)); @@ -354,7 +377,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent if (flag || val2C == 10) applySentenceIds(getDialogueId(251899), 26); else if (flag2) - return applySentenceIds(50215); + return applySentenceIds(TRANSLATE(50215, 50223)); break; case 26: if (g_vm->_trueTalkManager->_quotesTree.search( @@ -387,7 +410,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent return applySentenceIds(getDialogueId(250642)); break; case 33: - return applySentenceIds(50763); + return applySentenceIds(TRANSLATE(50763, 50776)); case 34: if (flag) return applySentenceIds(getDialogueId(251622)); @@ -400,15 +423,15 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent break; case 36: if (flag) - return applySentenceIds(50335); + return applySentenceIds(TRANSLATE(50335, 50344)); if (flag2) - return applySentenceIds(50334); + return applySentenceIds(TRANSLATE(50334, 50343)); break; case 37: if (flag) - return applySentenceIds(50217); + return applySentenceIds(TRANSLATE(50217, 50225)); if (flag2) - return applySentenceIds(50153); + return applySentenceIds(TRANSLATE(50153, 50157)); break; case 38: return applySentenceIds(getDialogueId(250637)); @@ -426,9 +449,9 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent break; case 43: if (flag) - return applySentenceIds(50416, -1); + return applySentenceIds(TRANSLATE(50416, 50426), -1); if (flag2) - return applySentenceIds(50415, -1); + return applySentenceIds(TRANSLATE(50415, 50425), -1); break; case 44: if (flag) @@ -443,91 +466,99 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent if (sentence->localWord("summer") || sentence->contains("summer") || sentence->localWord("autumn") - || sentence->contains("autumn")) { - return applySentenceIds(50743); + || sentence->contains("autumn") + || sentence->contains("herbst")) { + return applySentenceIds(TRANSLATE(50743, 50755)); } else if (sentence->localWord("winter") || sentence->contains("winter")) { - return applySentenceIds(50696); + return applySentenceIds(TRANSLATE(50696, 50708)); } else { - return applySentenceIds(50225); + return applySentenceIds(TRANSLATE(50225, 50233)); } break; case 46: if (val2C == 7 || val2C == 10) - return applySentenceIds(50698); + return applySentenceIds(TRANSLATE(50698, 50710)); break; case 47: if (flag || flag2 || val2C == 6) - return applySentenceIds(50717); + return applySentenceIds(TRANSLATE(50717, 50729)); break; case 48: if (flag) - return applySentenceIds(50710); + return applySentenceIds(TRANSLATE(50710, 50722)); if (flag2) - return applySentenceIds(50225); + return applySentenceIds(TRANSLATE(50225, 50233)); break; case 49: - if (sentence->localWord("scraliontis") || sentence->contains("scraliontis")) - return applySentenceIds(50711); + if (sentence->localWord("scraliontis") || sentence->contains("scraliontis") || + sentence->contains("skraliontis")) + return applySentenceIds(TRANSLATE(50711, 50723)); if (sentence->localWord("brobostigon") || sentence->contains("brobostigon")) - return applySentenceIds(50712); + return applySentenceIds(TRANSLATE(50712, 50724)); break; case 50: - return applySentenceIds(50713); + return applySentenceIds(TRANSLATE(50713, 50725)); case 51: if (flag) - return applySentenceIds(50715); + return applySentenceIds(TRANSLATE(50715, 50727)); if (flag2) - return applySentenceIds(50714); + return applySentenceIds(TRANSLATE(50714, 50726)); break; case 52: if (sentence->localWord("note") || sentence->contains("note")) - return applySentenceIds(50716); - return applySentenceIds(50210); + return applySentenceIds(TRANSLATE(50716, 50728)); + return applySentenceIds(TRANSLATE(50210, 50218)); case 53: - return applySentenceIds(50210); + return applySentenceIds(TRANSLATE(50210, 50218)); case 54: if (getDialRegion(0) != 0) { - if (val2C == 12) - return applySentenceIds(50174); + if (val2C) + return applySentenceIds(TRANSLATE(50174, 50178)); else - return applySentenceIds(50300); + return applySentenceIds(TRANSLATE(50300, 50308)); } else if (val2C == 7 || val2C == 10) { - return applySentenceIds(50871); + return applySentenceIds(TRANSLATE(50871, 50884)); } break; case 55: if (flag) - return applySentenceIds(50302); + return applySentenceIds(TRANSLATE(50302, 50310)); if (flag2) - return applySentenceIds(50301); + return applySentenceIds(TRANSLATE(50301, 50309)); break; case 56: if (flag) - return applySentenceIds(50304); + return applySentenceIds(TRANSLATE(50304, 50312)); if (flag2) - return applySentenceIds(50303); + return applySentenceIds(TRANSLATE(50303, 50311)); break; case 57: if (sentence->localWord("mustard") || sentence->contains("mustard") || sentence->localWord("tomato") - || sentence->contains("tomato")) - return applySentenceIds(50320); + || sentence->contains("tomato") + || sentence->contains("senf") + || sentence->contains("tomate")) + return applySentenceIds(TRANSLATE(50320, 50329)); if (sentence->localWord("sauce") || sentence->localWord("puree") || sentence->contains("sauce") || sentence->contains("puree") || sentence->contains("bird") - || sentence->contains("starling")) { - applySentenceIds(50321); + || sentence->contains("starling") + || sentence->contains("sosse") + || sentence->contains("pueree") + || sentence->contains("vogel") + || sentence->contains("staren")) { + applySentenceIds(TRANSLATE(50321, 50330)); CTrueTalkManager::triggerAction(30, 0); return 2; } - return applySentenceIds(50320); + return applySentenceIds(TRANSLATE(50320, 50329)); case 58: if (val2C == 6 || val2C == 10) - return applySentenceIds(50880); + return applySentenceIds(TRANSLATE(50880, 50893)); break; case 59: if (flag) { @@ -581,7 +612,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent return applySentenceIds(getDialogueId(250631)); break; case 65: - if (sentence->localWord("now") || sentence->localWord("soonh")) + if (sentence->localWord("now") || sentence->localWord("soon")) return applySentenceIds(getDialogueId(250424)); return applySentenceIds(getDialogueId(250506)); case 66: @@ -623,7 +654,7 @@ done: updateCurrentDial(true); - if (sentence->contains("goldfish")) { + if (sentence->contains("goldfish") || sentence->contains("goldfisch")) { addResponse(250184); } else if ((sentence->localWord("puree") || sentence->localWord("pureed")) && sentence->localWord("parrot")) { diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7496bd5fc1..84d5c59713 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -26,6 +26,7 @@ #include "titanic/pet_control/pet_control.h" #include "titanic/core/node_item.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -41,6 +42,10 @@ static const RoomDialogueId ROOM_DIALOGUE_IDS[] = { { 0, 0 } }; +static const uint PRERESPONSE_IDS_DE[] = { + 0 +}; + BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), @@ -89,75 +94,78 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen if (getValue(1) <= 2) updateCurrentDial(1); - // Handle room specific sentences - switch (roomScript->_scriptId) { - case 101: - if (getValue(2) == 1) { - result = processEntries(&_sentences[11], 0, roomScript, sentence); - } - break; + if (g_language != Common::DE_DEU) { + // Handle room specific sentences + switch (roomScript->_scriptId) { + case 101: + if (getValue(2) == 1) { + result = processEntries(&_sentences[11], 0, roomScript, sentence); + } + break; - case 107: - result = processEntries(&_sentences[5], 0, roomScript, sentence); - break; + case 107: + result = processEntries(&_sentences[5], 0, roomScript, sentence); + break; - case 108: - result = processEntries(&_sentences[7], 0, roomScript, sentence); - break; + case 108: + result = processEntries(&_sentences[7], 0, roomScript, sentence); + break; - case 109: - result = processEntries(&_sentences[13], 0, roomScript, sentence); - break; + case 109: + result = processEntries(&_sentences[13], 0, roomScript, sentence); + break; - case 110: - result = processEntries(&_sentences[16], 0, roomScript, sentence); - break; + case 110: + result = processEntries(&_sentences[16], 0, roomScript, sentence); + break; - case 111: - result = processEntries(&_sentences[10], 0, roomScript, sentence); - break; + case 111: + result = processEntries(&_sentences[10], 0, roomScript, sentence); + break; - case 112: - result = processEntries(&_sentences[15], 0, roomScript, sentence); - break; + case 112: + result = processEntries(&_sentences[15], 0, roomScript, sentence); + break; - case 113: - result = processEntries(&_sentences[9], 0, roomScript, sentence); - break; + case 113: + result = processEntries(&_sentences[9], 0, roomScript, sentence); + break; - case 114: - result = processEntries(&_sentences[18], 0, roomScript, sentence); - break; + case 114: + result = processEntries(&_sentences[18], 0, roomScript, sentence); + break; - case 115: - result = processEntries(&_sentences[12], 0, roomScript, sentence); - break; + case 115: + result = processEntries(&_sentences[12], 0, roomScript, sentence); + break; - case 116: - result = processEntries(&_sentences[8], 0, roomScript, sentence); - break; + case 116: + result = processEntries(&_sentences[8], 0, roomScript, sentence); + break; - case 117: - result = processEntries(&_sentences[6], 0, roomScript, sentence); - break; + case 117: + result = processEntries(&_sentences[6], 0, roomScript, sentence); + break; - case 123: - result = processEntries(&_sentences[17], 0, roomScript, sentence); - break; + case 123: + result = processEntries(&_sentences[17], 0, roomScript, sentence); + break; - case 125: - result = processEntries(&_sentences[14], 0, roomScript, sentence); - break; + case 125: + result = processEntries(&_sentences[14], 0, roomScript, sentence); + break; - case 131: - if (getValue(26) == 0) { - result = processEntries(&_sentences[getValue(6) ? 5 : 4], 0, roomScript, sentence); + case 131: + if (getValue(26) == 0) { + result = processEntries(&_sentences[getValue(6) ? 5 : 4], 0, roomScript, sentence); + } + break; } - break; + + if (result == 2) + return 2; } - if (result == 2) - return 2; if (sentence->contains("pretend you summoned yourself") || sentence->contains("pretend you just summoned yourself")) { if (scriptChanged(roomScript, 157) == 2) @@ -193,20 +201,38 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen } if (sentence->contains("what should i do here") - || sentence->contains("what do i do here") - || sentence->contains("what shall i do in here") - || sentence->contains("what shall i do in this room") - || sentence->contains("what should i do in this room") - || sentence->contains("what am i supposed to do in here") - || sentence->contains("what should i do in here") - || sentence->contains("what do i do in this room")) { + || sentence->contains("what do i do here") + || sentence->contains("what shall i do in here") + || sentence->contains("what shall i do in this room") + || sentence->contains("what should i do in this room") + || sentence->contains("what am i supposed to do in here") + || sentence->contains("what should i do in here") + || sentence->contains("what do i do in this room") + || sentence->localWord("doidohere") + || sentence->contains("was soll ich denn hier tun") + || sentence->contains("was soll ich hier tun") + || sentence->contains("was gibt es hier zu tun") + || sentence->contains("was kann man denn hier machen") + || sentence->contains("was kann man denn hier tun") + || sentence->contains("was soll ich hier drin tun") + || sentence->contains("was soll ich hier") + || sentence->contains("wohin soll ich jetzt") + || sentence->contains("was ist das hier fuer ein raum") + || sentence->contains("was ist denn hier zu tun") + || sentence->contains("was kann man hier machen") + || sentence->contains("was soll ich jetzt machen") + || sentence->contains("was kommt jetzt") + || sentence->contains("was kommt nun") + || sentence->contains("wozu bin ich eigentlich hier") + || sentence->contains("wozu bin ich denn hier")) { if (addRoomDescription(roomScript)) { applyResponse(); return 2; } } - if (sentence->contains("help") + if (sentence->localWord("help") + || (g_language == Common::DE_DEU && sentence->contains("help")) || sentence->contains("what now") || sentence->contains("what next") || sentence->contains("give me a hint") @@ -216,7 +242,20 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen || sentence->contains("what shall i do") || sentence->contains("what would you do") || sentence->contains("what should i do") - || sentence->contains("what do i do")) { + || sentence->contains("what do i do") + || sentence->contains("was nun") + || sentence->contains("so und was kommt jetzt") + || sentence->contains("und jetzt") + || sentence->contains("einen hinweis") + || sentence->contains("einen tip") + || sentence->contains("ich bin verzweifelt") + || sentence->contains("bin ich auf der richtigen spur") + || sentence->contains("was soll ich jetzt anfangen") + || sentence->contains("wozu raetst du mir") + || sentence->contains("was muss ich jetzt") + || sentence->contains("was wuerdest du an meiner stelle") + || sentence->contains("was soll ich als naechstes tun") + || sentence->contains("was soll ich hier")) { if (getDialRegion(0) == 1) { randomResponse4(roomScript, getValue(1)); applyResponse(); @@ -241,35 +280,48 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2) return 2; - if ((sentence->_category == 4 && sentence->localWord("am") && sentence->localWord("i")) - || (sentence->localWord("are") && sentence->localWord("we")) - || (sentence->_category == 3 && sentence->localWord("room") - && sentence->localWord("we") && sentence->localWord("in")) - || (sentence->_category == 3 && sentence->localWord("rom") - && sentence->localWord("is") && sentence->localWord("this")) - ) { - uint id = getRangeValue(getRoomDialogueId(roomScript)); - addResponse(getDialogueId(id ? id : 201384)); - applyResponse(); - return 2; - } + if (g_language != Common::DE_DEU) { + if ((sentence->_category == 4 && sentence->localWord("am") && sentence->localWord("i")) + || (sentence->localWord("are") && sentence->localWord("we")) + || (sentence->_category == 3 && sentence->localWord("room") + && sentence->localWord("we") && sentence->localWord("in")) + || (sentence->_category == 3 && sentence->localWord("rom") + && sentence->localWord("is") && sentence->localWord("this")) + ) { + uint id = getRangeValue(getRoomDialogueId(roomScript)); + addResponse(getDialogueId(id ? id : 201384)); + applyResponse(); + return 2; + } - if (getValue(1) >= 3) { - result = processEntries(&_sentences[1], 0, roomScript, sentence); - } else if (getValue(1) == 2) { - result = processEntries(&_sentences[2], 0, roomScript, sentence); - } else if (getValue(1) == 1) { - result = processEntries(&_sentences[3], 0, roomScript, sentence); + if (getValue(1) >= 3) { + result = processEntries(&_sentences[1], 0, roomScript, sentence); + } else if (getValue(1) == 2) { + result = processEntries(&_sentences[2], 0, roomScript, sentence); + } else if (getValue(1) == 1) { + result = processEntries(&_sentences[3], 0, roomScript, sentence); - if (sentence->contains("shrinkbot")) { + if (sentence->contains("shrinkbot")) { + addResponse(getDialogueId(200583)); + applyResponse(); + return 2; + } + } + if (result == 2) + return 2; + } else { + if (getValue(1) == 1 && (sentence->localWord("shrinkbot") || + sentence->contains("psychobot"))) { addResponse(getDialogueId(200583)); applyResponse(); return 2; } } - if (sentence->localWord("television") || sentence->localWord("tv") - || sentence->localWord("crush") || sentence->localWord("crushed")) { + if ((g_language != Common::DE_DEU || getValue(40) == 0) && + (sentence->localWord("television") || sentence->localWord("tv") + || sentence->localWord("crush") || sentence->localWord("crushed") + || sentence->localWord("crushedtv"))) { if (roomScript->_scriptId == 111 || getRandomBit()) { addResponse(getDialogueId(getRandomBit() ? 200912 : 200913)); } else { @@ -287,7 +339,8 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen return 2; } - if (sentence->contains("my") && (sentence->contains("where can i find") + if ((sentence->contains("my") || sentence->contains("mein")) + && (sentence->contains("where can i find") || sentence->contains("where is") || sentence->contains("wheres") || sentence->contains("help me find") @@ -296,13 +349,26 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen || sentence->contains("id like") || sentence->contains("i would like") || sentence->contains("have you seen") + || sentence->contains("gibt es hier") + || sentence->contains("wo finde ich") + || sentence->contains("sind hier") + || sentence->contains("habt ihr") + || sentence->contains("gibt es") + || sentence->contains("wo sind") + || sentence->contains("wo ist") + || sentence->contains("wie komme ich") + || sentence->contains("wie erreicht man") + || sentence->contains("hast du") + || sentence->contains("ich moechte") + || sentence->contains("gib mir") + || sentence->contains("haettest du vielleicht") + || sentence->contains("ich haette gern") )) { addResponse(getDialogueId(200799)); applyResponse(); return 2; } - setupSentences(); uint tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine); if (tagId && chooseResponse(roomScript, sentence, tagId) == 2) return 2; @@ -640,104 +706,183 @@ int BellbotScript::updateState(uint oldId, uint newId, int index) { } int BellbotScript::preResponse(uint id) { + if (g_language == Common::DE_DEU && getDialRegion(0) == 0 + && getRandomNumber(100) > 80) + return 251250; + int newId = _preResponses.find(id); - if (newId == 202277) { - applyResponse(); - CTrueTalkManager::triggerAction(1, 0); - } - if (newId == 200769) { - applyResponse(); - CTrueTalkManager::triggerAction(18, 0); - } + if (g_language != Common::DE_DEU) { + if (newId == 202277) { + applyResponse(); + CTrueTalkManager::triggerAction(1, 0); + } + if (newId == 200769) { + applyResponse(); + CTrueTalkManager::triggerAction(18, 0); + } - if (id == 21790) - CTrueTalkManager::triggerAction(13, 0); + if (id == 21790) + CTrueTalkManager::triggerAction(13, 0); + } return newId; } int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { - switch (val1) { - case 1: - addResponse(getDialogueId(*srcIdP)); - applyResponse(); - return 2; - - case 2: - addResponse(getDialogueId(*srcIdP)); - addResponse(getDialogueId(getRandomNumber(2) == 1 ? 200192 : 200157)); - addResponse(getDialogueId(200176)); - applyResponse(); - return 2; + if (g_language == Common::EN_ANY) { + switch (val1) { + case 1: + addResponse(getDialogueId(*srcIdP)); + applyResponse(); + return 2; - case 21: - if (CTrueTalkManager::getStateValue(7) == 0) { - selectResponse(21372); + case 2: + addResponse(getDialogueId(*srcIdP)); + addResponse(getDialogueId(getRandomNumber(2) == 1 ? 200192 : 200157)); + addResponse(getDialogueId(200176)); applyResponse(); return 2; - } - if (!sentence->localWord("broken") && !sentence->contains("broken") && + case 21: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && CTrueTalkManager::_currentNPC) { - CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); - if (node) { - CString nodeName = node->getName(); - if (nodeName.containsIgnoreCase("5") || nodeName.containsIgnoreCase("6") + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName.containsIgnoreCase("5") || nodeName.containsIgnoreCase("6") || nodeName.containsIgnoreCase("7")) { - CTrueTalkManager::triggerAction(29, 2); - selectResponse(201571); - applyResponse(); - return 2; + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } } } - } - CTrueTalkManager::triggerAction(29, 1); - selectResponse(201771); - applyResponse(); - return 2; + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + applyResponse(); + return 2; - case 22: - if (CTrueTalkManager::getStateValue(7) == 0) { - selectResponse(21372); + case 22: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName.containsIgnoreCase("5") || nodeName.containsIgnoreCase("6") + || nodeName.containsIgnoreCase("7")) { + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } + } + } + + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); applyResponse(); return 2; + + case 23: + case 24: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + CTrueTalkManager::triggerAction(29, val1 == 23 ? 3 : 4); + break; + + default: + break; } + } else { + switch (val1) { + case 5001: + case 5021: + return 0; + + case 5002: + addResponse(getDialogueId(*srcIdP)); + addResponse(getDialogueId(200000)); + applyResponse(); + return 2; - if (!sentence->localWord("broken") && !sentence->contains("broken") && - CTrueTalkManager::_currentNPC) { - CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); - if (node) { - CString nodeName = node->getName(); - if (nodeName.containsIgnoreCase("5") || nodeName.containsIgnoreCase("6") - || nodeName.containsIgnoreCase("7")) { + case 5003: + addResponse(getDialogueId(*srcIdP)); + return 2; + + case 5022: + case 5023: + if (CTrueTalkManager::getStateValue(7)) { + bool flag = true; + + if (!sentence->localWord("broken") && !sentence->contains("kaputt") && + !sentence->contains("im eimer") && !sentence->contains("funktioniert nicht") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName.contains("5") || nodeName.contains("6") || nodeName.contains("7")) + flag = false; + } + } + + if (flag) { + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + } + else { CTrueTalkManager::triggerAction(29, 2); - selectResponse(201571); - applyResponse(); - return 2; + selectResponse(201554); } } - } + else { + selectResponse(21378); + } - CTrueTalkManager::triggerAction(29, 1); - selectResponse(201771); - applyResponse(); - return 2; + applyResponse(); + return 2; - case 23: - case 24: - if (CTrueTalkManager::getStateValue(7) == 0) { - selectResponse(21372); + case 5024: + if (CTrueTalkManager::getStateValue(7)) { + CTrueTalkManager::triggerAction(29, 3); + return 0; + } + + selectResponse(21378); applyResponse(); return 2; - } - CTrueTalkManager::triggerAction(29, val1 == 23 ? 3 : 4); - break; + case 5025: + if (CTrueTalkManager::getStateValue(7)) { + CTrueTalkManager::triggerAction(29, 4); + return 0; + } - default: - break; + selectResponse(21378); + applyResponse(); + return 2; + + default: + return TTnpcScript::doSentenceEntry(val1, srcIdP, roomScript, sentence); + } } return 0; @@ -974,14 +1119,15 @@ int BellbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 21: - if (sentence->contains("hiker") || sentence->contains("hug")) { + if (sentence->localWord("hiker") && (sentence->contains("hug") || + sentence->contains("anhalter"))) { addResponse(getDialogueId(200379)); applyFlag = true; } break; case 22: - if (sentence->localWord("get") || sentence->localWord("it")) { + if (sentence->localWord("get") && sentence->localWord("it")) { addResponse(getDialogueId(200474)); applyFlag = true; } @@ -1037,9 +1183,9 @@ int BellbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 30: - if ((sentence->localWord("did") || sentence->localWord("not")) - || (sentence->localWord("would") || sentence->localWord("not")) - || (sentence->localWord("could") || sentence->localWord("not")) + if ((sentence->localWord("did") && sentence->localWord("not")) + || (sentence->localWord("would") && sentence->localWord("not")) + || (sentence->localWord("could") && sentence->localWord("not")) || sentence->localWord("tried")) { addResponse(getDialogueId(200416)); applyFlag = true; @@ -1200,8 +1346,8 @@ case44: break; case 51: - if (sentence->localWord("no") || sentence->localWord("it") - || sentence->localWord("is") || sentence->localWord("not") + if ((sentence->localWord("no") && sentence->localWord("it") + && sentence->localWord("is") && sentence->localWord("not")) || sentence->contains("yeah right")) { addResponse(getDialogueId(200636)); applyFlag = true; @@ -1307,7 +1453,7 @@ stateFlag = false; break; case 64: - if (sentence->localWord("rowboat")) { + if (sentence->localWord("rowbot")) { addResponse(getDialogueId(200052)); applyFlag = true; } @@ -1338,9 +1484,9 @@ stateFlag = false; break; case 68: - if ((sentence->localWord("i") && sentence->localWord("care")) - || sentence->localWord("do") - || sentence->localWord("me")) { + if ((sentence->localWord("i") && (sentence->localWord("care") || + sentence->localWord("do"))) + || sentence->localWord("me")) { addResponse(getDialogueId(201006)); applyFlag = true; } @@ -1381,10 +1527,13 @@ stateFlag = false; break; case 73: - if (sentence->localWord("mood") && (charId() == 7 || charId() == 5)) { - addResponse(getDialogueId(201021)); - applyFlag = true; - stateFlag = false; + if (sentence->localWord("mood") || sentence->contains("stimmung") || + sentence->contains("laune") || sentence->contains("verfassung")) { + if (charId() == 7 || charId() == 5) { + addResponse(getDialogueId(201021)); + applyFlag = true; + stateFlag = false; + } } break; @@ -1553,7 +1702,8 @@ stateFlag = false; break; case 88: - if (sentence->_category == 6 || sentence->contains("upside down")) { + if (sentence->_category == 6 || + (g_language != Common::DE_DEU && sentence->contains("upside down"))) { addResponse(getDialogueId(202142)); applyFlag = true; } @@ -1834,7 +1984,7 @@ bool BellbotScript::addRoomDescription(const TTroomScript *roomScript) { switch (roomScript->_scriptId) { case 101: - addResponse(getDialogueId(getValue(2) == 1 ? 20185 : 201832)); + addResponse(getDialogueId(getValue(2) == 1 ? 201835 : 201832)); break; case 107: if (_room107First) { @@ -1905,5 +2055,4 @@ bool BellbotScript::addRoomDescription(const TTroomScript *roomScript) { return true; } - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index d44cedf636..128868c84e 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/deskbot_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -85,7 +86,16 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen || sentence->localWord("winning") || sentence->contains("winning") || sentence->localWord("winner") || sentence->contains("winner") || sentence->contains("35279") || sentence->contains("3 5 2 7 9") - ) { + || (g_language == Common::DE_DEU && ( + sentence->contains("preisaus") || + sentence->contains("tombola") || + sentence->contains("lotterie") || + sentence->contains("gewonnen") || + sentence->contains("glueck") || + sentence->contains("das goldene los") || + sentence->contains("sechs richtige") + )) + ) { addResponse(getDialogueId(41773)); applyResponse(); return 2; @@ -93,7 +103,8 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen addResponse(getDialogueId(41771)); applyResponse(); return 2; - } else if (sentence->localWord("upgrade") || sentence->contains("upgrade")) { + } else if (sentence->localWord("upgrade") || sentence->contains("upgrade") + || sentence->localWord("secondclass")) { if (CTrueTalkManager::_currentNPC) { CGameObject *obj; if (CTrueTalkManager::_currentNPC->find("Magazine", &obj, FIND_PET)) { @@ -353,10 +364,15 @@ exit: int DeskbotScript::preResponse(uint id) { int newId = 0; - if (getValue(1) >= 3 && (id == 41176 || id == 41738 || id == 41413 || id == 41740)) + if (getValue(1) >= 3 && ( + id == (uint)TRANSLATE(41176, 41190) || + id == (uint)TRANSLATE(41738, 41429) || + id == (uint)TRANSLATE(41413, 41755) || + id == (uint)TRANSLATE(41740, 41757) + )) { newId = 241601; - - if (id == 42114) + } + if (id == (uint)TRANSLATE(42114, 42132)) CTrueTalkManager::triggerAction(20, 0); return newId; @@ -372,6 +388,9 @@ uint DeskbotScript::getDialsBitset() const { int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { uint id; + if (g_language == Common::DE_DEU && val1 != 4501) + return TTnpcScript::doSentenceEntry(val1, srcIdP, roomScript, sentence); + switch (val1) { case 1: id = *srcIdP; @@ -618,9 +637,8 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 8: if (isDial1Low() && getValue(1) == 4) { - if (sentence->_category == 12 || sentence->_category == 13 - || sentence->contains("do not")) { - + if (sentence->_category == 12 || sentence->_category == 13 || + (g_language != Common::DE_DEU && sentence->contains("do not"))) { addResponse(getDialogueId(240447)); setDialRegion(0, 0); setDialRegion(1, 0); @@ -669,7 +687,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 11: if (isDial0Medium() && isDial1Medium() && searchQuotes(roomScript, sentence)) { - addResponse(getDialogueId(240403)); + addResponse(getDialogueId(240406)); applyFlag = true; stateFlag = false; } @@ -1123,12 +1141,18 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * if (sentence->_category == 11 || sentence->_category == 13) { // Player said they have a reservation addResponse(getDialogueId(241262)); - } else if (sentence->_category == 12 || sentence->contains("do not")) { + } else if (sentence->_category == 12 || + (g_language != Common::DE_DEU && sentence->contains("do not"))) { // Player said they don't have a reservation setDialRegion(0, 0); setDialRegion(1, 0); addResponse(getDialogueId(241268)); addAskBreakfast(); + } else if (sentence->contains("skip")) { + // WORKAROUND: Added 'skip' to allow skipping entire checkin + addAssignedRoom(); + setState(0); + CTrueTalkManager::setFlags(CURRENT_STATE, 0); } else { // Player didn't say yes or no addResponse(getDialogueId(240745)); @@ -1195,18 +1219,23 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * applyFlag = true; stateFlag = false; } else if (sentence->contains("continental") + || sentence->contains("kontinent") || sentence->contains("full") || sentence->contains("porky") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("former") - || sentence->contains("latter")) { + || sentence->contains("latter") + || sentence->contains("speck") + || sentence->contains("wurst") + || sentence->contains("englisch") + ) { addResponse(getDialogueId(241717)); addResponse(getDialogueId(241709)); applyFlag = true; stateFlag = false; } else { - if (sentence2C(sentence)) + if (getRandomNumber(100) < 80 && sentence2C(sentence)) addResponse(getDialogueId(241707)); addResponse(getDialogueId(241719)); applyFlag = true; @@ -1221,7 +1250,10 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("blerontin 1") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("the 3") || sentence->contains("the 4") || sentence->contains("all of them") - || sentence->contains("the lot")) { + || sentence->contains("the lot") || sentence->contains("buegelhorn") + || sentence->contains("bugelhorn") || sentence->contains("trompete") + || sentence->contains("saxophon") || sentence->contains("popanz") + ) { addResponse(getDialogueId(241710)); addResponse(getDialogueId(241713)); } else { @@ -1236,7 +1268,8 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 86: - if (sentence->_category == 12 || sentence->_category == 11 || sentence->contains("view")) { + if (sentence->_category == 12 || sentence->_category == 11 + || sentence->contains(TRANSLATE("view", "aussicht"))) { addResponse(getDialogueId(241714)); addResponse(getDialogueId(241699)); } else { @@ -1261,7 +1294,8 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("balcony") || sentence->contains("neither") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("former") || sentence->contains("latter") - || sentence->contains("either")) { + || sentence->contains("either") || sentence->contains("suedlage") + || sentence->contains("balkon")) { addResponse(getDialogueId(241700)); addResponse(getDialogueId(241687)); } else { @@ -1277,16 +1311,16 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * break; case 88: - if (sentence->contains("imperial") || sentence->contains("the 1")) { + if (sentence->contains("imperial") || sentence->contains(TRANSLATE("the 1", "fuerstlich"))) { addResponse(getDialogueId(241700)); addResponse(getDialogueId(241739)); - } else if (sentence->contains("royal") || sentence->contains("the 2")) { + } else if (sentence->contains("royal") || sentence->contains(TRANSLATE("the 2", "majest"))) { addResponse(getDialogueId(241690)); - } else if (sentence->contains("despotic") || sentence->contains("the last") - || sentence->contains("latter")) { + } else if (sentence->contains("despotic") || sentence->contains("despot") + || sentence->contains("the last") || sentence->contains("latter")) { addResponse(getDialogueId(241688)); } else if (sentence->contains("president") || sentence->contains("presidential") - || sentence->contains("the 3")) { + || sentence->contains("the 3") || sentence->contains("praesident")) { addResponse(getDialogueId(241689)); addResponse(getDialogueId(241739)); } else { @@ -1307,7 +1341,8 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("princess") || sentence->contains("small") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("the 3") || sentence->contains("the 4") - || sentence->contains("big") || sentence->contains("large")) { + || sentence->contains("big") || sentence->contains("large") + || sentence->contains("prinz") || sentence->contains("gross")) { addResponse(getDialogueId(241700)); addResponse(getDialogueId(241739)); } else { @@ -1325,7 +1360,9 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * if (sentence->contains("constitutional") || sentence->contains("const") || sentence->contains("absolute") || sentence->contains("small") || sentence->contains("the 1") || sentence->contains("the 2") - || sentence->contains("big") || sentence->contains("large")) { + || sentence->contains("big") || sentence->contains("large") + || sentence->contains("verfassung") || sentence->contains("absolut") + || sentence->contains("gross")) { addResponse(getDialogueId(241700)); addResponse(getDialogueId(241739)); } else { @@ -1344,7 +1381,9 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("small") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("big") || sentence->contains("large") || sentence->contains("former") - || sentence->contains("latter")) { + || sentence->contains("latter") + || sentence->contains("aufgekl") || sentence->contains("diktator") + || sentence->contains("gross")) { addResponse(getDialogueId(241700)); addResponse(getDialogueId(241739)); } else { @@ -1398,7 +1437,9 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence * || sentence->contains("suite") || sentence->contains("next door") || sentence->contains("the 1") || sentence->contains("the 2") || sentence->contains("former") || sentence->contains("latter") - || sentence->contains("same room")) { + || sentence->contains("same room") || sentence->contains("ohne") + || sentence->contains("mit") || sentence->contains("die gleiche kabine") + || sentence->contains("dieselbe kabine")) { addAssignedRoom(); setState(0); CTrueTalkManager::setFlags(CURRENT_STATE, 0); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index ffb6b1063c..941136d45e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -30,11 +30,6 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { private: - static int _oldId; - TTupdateStateArray _states; - TTsentenceEntries _entries2; - TTsentenceEntries _entries3; -private: /** * Setup sentence data */ @@ -43,11 +38,6 @@ private: /** * Adds dialogue for the player's assigned room */ - uint addAssignedRoomDialogue(); - - /** - * Adds dialogue for the player's assigned room - */ uint addAssignedRoomDialogue2(); /** @@ -66,11 +56,6 @@ private: void setCurrentState(uint newId, uint index); /** - * Does preprocessing for the sentence - */ - int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); - - /** * Scans the quotes tree */ int searchQuotes(const TTroomScript *roomScript, const TTsentence *sentence); @@ -89,6 +74,21 @@ private: * Adds a dialogue description for the player's assigned room */ void addAssignedRoom(); +protected: + static int _oldId; + TTupdateStateArray _states; + TTsentenceEntries _entries2; + TTsentenceEntries _entries3; +protected: + /** + * Does preprocessing for the sentence + */ + int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); + + /** + * Adds dialogue for the player's assigned room + */ + uint addAssignedRoomDialogue(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0323e3d021..9493af6fe2 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -24,15 +24,19 @@ #include "titanic/true_talk/doorbot_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/translation.h" #include "titanic/titanic.h" namespace Titanic { -static const int STATE_ARRAY[9] = { - 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 +static const int STATE_ARRAY_EN[9] = { + 11818, 11819, 11820, 11821, 11822, 11823, 11824, 11825, 11826 +}; +static const int STATE_ARRAY_DE[9] = { + 11831, 11832, 11833, 11834, 11835, 11836, 11837, 11838, 11839 }; -static const RoomDialogueId ROOM_DIALOGUES1[] = { +static const RoomDialogueId ROOM_DIALOGUES1_EN[] = { { 100, 10523 }, { 101, 10499 }, { 107, 10516 }, { 108, 10500 }, { 109, 10490 }, { 110, 10504 }, { 111, 10506 }, { 112, 10498 }, { 113, 10502 }, { 114, 10507 }, { 115, 10497 }, { 116, 10508 }, @@ -41,12 +45,28 @@ static const RoomDialogueId ROOM_DIALOGUES1[] = { { 128, 10495 }, { 129, 10496 }, { 130, 10491 }, { 131, 10493 }, { 132, 10492 }, { 0, 0 } }; -static const RoomDialogueId ROOM_DIALOGUES2[] = { +static const RoomDialogueId ROOM_DIALOGUES1_DE[] = { + { 101, 10375 }, { 107, 10379 }, { 108, 10378 }, { 109, 10364 }, + { 110, 10377 }, { 111, 10383 }, { 112, 10374 }, { 113, 10376 }, + { 114, 10384 }, { 115, 10373 }, { 116, 10385 }, { 117, 10380 }, + { 118, 10380 }, { 122, 10392 }, { 123, 10390 }, { 124, 10386 }, + { 125, 10387 }, { 126, 10389 }, { 127, 10388 }, { 128, 10371 }, + { 129, 10372 }, { 130, 10366 }, { 131, 10368 }, { 132, 10367 }, + { 0, 0 } +}; + +static const RoomDialogueId ROOM_DIALOGUES2_EN[] = { { 102, 221981 }, { 110, 221948 }, { 111, 221968 }, { 107, 222000 }, { 101, 221935 }, { 112, 221924 }, { 113, 221942 }, { 116, 221977 }, { 124, 221987 }, { 125, 221984 }, { 127, 221991 }, { 128, 221916 }, { 129, 221919 }, { 131, 221912 }, { 132, 221908 }, { 0, 0 } }; +static const RoomDialogueId ROOM_DIALOGUES2_DE[] = { + { 102, 221981 }, { 110, 221948 }, { 111, 221968 }, { 107, 222000 }, + { 101, 221935 }, { 112, 221924 }, { 113, 221942 }, { 116, 221977 }, + { 124, 221987 }, { 125, 221984 }, { 127, 221991 }, { 128, 221916 }, + { 129, 221919 }, { 131, 221912 }, { 132, 221909 }, { 0, 0 } +}; DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : @@ -60,6 +80,11 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, _states.load("States/Doorbot"); } +DoorbotScript::~DoorbotScript() { + for (int idx = 0; idx < 11; ++idx) + _sentences[idx].clear(); +} + void DoorbotScript::setupSentences() { for (int idx = 35; idx < 40; ++idx) CTrueTalkManager::setFlags(idx, 0); @@ -85,10 +110,10 @@ int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsenten tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { if (_stateIndex > 9) _stateIndex = 0; - addResponse(STATE_ARRAY[_stateIndex]); + addResponse(TRANSLATE(STATE_ARRAY_EN[_stateIndex], STATE_ARRAY_DE[_stateIndex])); applyResponse(); - if (STATE_ARRAY[_stateIndex] == 11826) + if (_stateIndex == 8) setState(1); ++_stateIndex; return 2; @@ -196,7 +221,8 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen return setResponse(getDialogueId(220113)); } - if (sentence->_category == 6 && sentence->contains("why not")) { + if (sentence->_category == 6 && (sentence->contains("why not") || + sentence->contains("warum nicht"))) { return setResponse(11871, 8); } @@ -209,53 +235,55 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen switch (currState) { case 1: if (flag1) - return setResponse(11828, 2); + return setResponse(TRANSLATE(11828, 11841), 2); if (flag2) - return setResponse(11827, 0); + return setResponse(TRANSLATE(11827, 11840), 0); break; case 2: if (flag1) - return setResponse(11827, 0); + return setResponse(TRANSLATE(11827, 11840), 0); break; case 3: if (sentMode == 3) - return setResponse(10406, 0); + return setResponse(TRANSLATE(10406, 10417), 0); break; case 4: if (flag1) - return setResponse(11332, 0); + return setResponse(TRANSLATE(11332, 11345), 0); if (flag2) - return setResponse(11331, 0); + return setResponse(TRANSLATE(11331, 11344), 0); break; case 5: - return setResponse(11868, 0); + if (g_language == Common::EN_ANY) + return setResponse(11868, 0); + break; case 6: - return setResponse(11872, 0); + return setResponse(TRANSLATE(11872, 11885), 7); case 7: - return setResponse(11869, 0); + return setResponse(TRANSLATE(11869, 11882), 0); case 8: - return setResponse(11870, 0); + return setResponse(TRANSLATE(11870, 11883), 0); case 12: if (flag1) - return setResponse(11894, 13); + return setResponse(TRANSLATE(11894, 11907), 13); if (flag2) - return setResponse(11893, 13); + return setResponse(TRANSLATE(11893, 11906), 13); break; case 13: - return setResponse(11895, 12); + return setResponse(TRANSLATE(11895, 11908), 12); case 15: if (sentMode == 3 || sentMode == 6) - return setResponse(10257, 0); + return setResponse(TRANSLATE(10257, 10260), 0); break; case 16: { @@ -301,47 +329,47 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen case 21: if (flag2) - return setResponse(10935, 0); + return setResponse(TRANSLATE(10935, 10947), 0); break; case 22: if (flag1) { if (getRandomBit()) { - return setResponse(11211, 23); + return setResponse(TRANSLATE(11211, 11223), 23); } else { - return setResponse(10127, 0); + return setResponse(TRANSLATE(10127, 10128), 0); } } if (flag2) - return setResponse(10136, 0); + return setResponse(TRANSLATE(10136, 10137), 0); break; case 23: - return setResponse(10212, 0); + return setResponse(TRANSLATE(10212, 10213), 0); case 24: if (flag1) - return setResponse(11151, 0); + return setResponse(TRANSLATE(11151, 11163), 0); if (flag2) - return setResponse(11150, 0); + return setResponse(TRANSLATE(11150, 11162), 0); break; case 25: case 26: if (flag2) { if (getRandomBit()) { - return setResponse(11211, 23); + return setResponse(TRANSLATE(11211, 11223), 23); } else { - return setResponse(10127, 0); + return setResponse(TRANSLATE(10127, 10128), 0); } } if (flag1) - return setResponse(10136, 0); + return setResponse(TRANSLATE(10136, 10137), 0); break; case 27: if (flag1 || sentence->localWord("did") || sentence->contains("did")) - return setResponse(221175, 28); + return setResponse(getDialogueId(221175), 28); break; case 28: @@ -359,17 +387,20 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen case 31: if (sentMode == 3 || sentMode == 10) - return setResponse(10350, 0); + return setResponse(TRANSLATE(10350, 10353), 0); break; case 32: - return setResponse(10110, 0); + return setResponse(TRANSLATE(10110, 10111), 0); case 33: if (sentence->contains("sieve") || sentence->contains("colander") || sentence->contains("vegetable") || sentence->contains("ground") || sentence->contains("earth") || sentence->contains("garden") - || sentence->contains("cheese") || sentence->contains("strainer")) { + || sentence->contains("cheese") || sentence->contains("strainer") + || sentence->contains("sieb") || sentence->contains("emmenthaler") + || sentence->contains("gemuese") || sentence->contains("kaese") + || sentence->contains("erde") || sentence->contains("garten")) { return setResponse(getDialogueId(221375), 0); } else if (getRandomNumber(100) > 30) { return setResponse(getDialogueId(221376), 33); @@ -380,67 +411,74 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen case 34: if (sentence->localWord("bellbot")) - return setResponse(10094, 0); - if (sentence->localWord("bellbot")) - return setResponse(10349, 0); - if (sentence->localWord("deskbot") || sentence->localWord("titania")) - return setResponse(10148, 0); - if (sentence->localWord("barbot") || sentence->localWord("rowbot") - || sentence->localWord("liftbot") || sentence->localWord("maitredbot")) - return setResponse(10147, 0); + return setResponse(TRANSLATE(10094, 10095), 0); + if (sentence->localWord("doorbot")) + return setResponse(TRANSLATE(10349, 10352), 0); + + if (g_language == Common::EN_ANY) { + if (sentence->localWord("deskbot") || sentence->localWord("titania")) + return setResponse(10148, 0); + if (sentence->localWord("barbot") || sentence->localWord("rowbot") + || sentence->localWord("liftbot") || sentence->localWord("maitredbot")) + return setResponse(10147, 0); + } break; case 35: - return setResponse(10811, 36); + return setResponse(TRANSLATE(10811, 10822), 36); case 36: if (flag1) - return setResponse(10813, 37); + return setResponse(TRANSLATE(10813, 10824), 37); if (flag2) - return setResponse(10812, 37); + return setResponse(TRANSLATE(10812, 10823), 37); break; case 37: if (flag1) - return setResponse(10815, 37); + return setResponse(TRANSLATE(10815, 10826), 37); if (flag2) - return setResponse(10814, 37); + return setResponse(TRANSLATE(10814, 10825), 37); break; case 38: - return setResponse(10848, 39); + if (g_language == Common::EN_ANY) + return setResponse(10848, 39); case 39: - return setResponse(10823, 40); + if (g_language == Common::EN_ANY) + return setResponse(10823, 40); case 40: - return setResponse(10832, 41); + return setResponse(TRANSLATE(10832, 10843), 41); case 41: - addResponse(10833); - return setResponse(10835, 0); + addResponse(TRANSLATE(10833, 10844)); + return setResponse(TRANSLATE(10835, 10846), 0); case 42: if (sentence->localWord("please")) - return setResponse(10840, 43); - return setResponse(10844, 0); + return setResponse(TRANSLATE(10840, 10851), 43); + return setResponse(TRANSLATE(10844, 10855), 0); case 43: case 45: - return setResponse(10844, 0); + return setResponse(TRANSLATE(10844, 10855), 0); case 44: if (sentence->localWord("thanks")) - return setResponse(10843, 45); - return setResponse(10844, 0); + return setResponse(TRANSLATE(10843, 10854), 45); + return setResponse(TRANSLATE(10844, 10855), 0); case 46: if (flag1) return setResponse(getDialogueId(222251), 0); - if (flag2) + if (g_language == Common::EN_ANY && flag2) return setResponse(10713, 0); break; + default: + break; } } @@ -451,39 +489,48 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen return setResponse(getDialogueId(221043), 0); int result = 0; - switch (roomScript->_scriptId) { - case 100: - case 101: - case 102: - case 107: - case 110: - case 111: - case 124: - case 129: - case 131: - case 132: - result = processEntries(&_sentences[roomScript->_scriptId], 0, roomScript, sentence); - break; - default: - break; + if (g_language == Common::EN_ANY) { + switch (roomScript->_scriptId) { + case 100: + case 101: + case 102: + case 107: + case 110: + case 111: + case 124: + case 129: + case 131: + case 132: + result = processEntries(&_sentences[roomScript->_scriptId], 0, roomScript, sentence); + break; + default: + break; + } + + if (result == 2) + return 2; } - if (result == 2) - return 2; if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2 || processEntries(_defaultEntries, 0, roomScript, sentence) == 2 || defaultProcess(roomScript, sentence)) return 2; + if (g_language == Common::DE_DEU && sentence->contains("42")) { + selectResponse(11831); + applyResponse(); + return 2; + } + switch (sentence->_category) { case 11: if (getRandomNumber(100) > 90) - return setResponse(10839, 42); - return setResponse(222415, 0); + return setResponse(TRANSLATE(10839, 10850), 42); + return setResponse(getDialogueId(222415), 0); case 12: if (getRandomNumber(100) > 90) - return setResponse(10841, 44); + return setResponse(TRANSLATE(10841, 10852), 44); return setResponse(getDialogueId(222416), 0); case 13: @@ -546,10 +593,10 @@ ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, CTrueTalkManager::setFlags(39, 0); } - if (id >= 220000 && id <= 222418) { + if (id >= 220000 && id <= (uint)TRANSLATE(222418, 222430)) { addResponse(getDialogueId(id)); applyResponse(); - } else if (id >= 10000 && id <= 11986) { + } else if (id >= 10000 && id <= (uint)TRANSLATE(11986, 11999)) { addResponse(id); applyResponse(); } @@ -690,10 +737,12 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { default: break; } - } else if (newId >= 220883) { + } + else if (newId >= 220883) { CTrueTalkManager::setFlags(38, 1); CTrueTalkManager::triggerAction(28, 0); - } else if (newId >= 220076) { + } + else if (newId >= 220076) { switch (newId) { case 220078: case 220080: @@ -709,11 +758,13 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { } CTrueTalkManager::setFlags(39, 1); - } else if (newId == 220075) { + } + else if (newId == 220075) { if (flag39) return getRangeValue(221381); CTrueTalkManager::setFlags(39, 1); - } else if (newId == 220038) { + } + else if (newId == 220038) { return 220038; } @@ -739,7 +790,7 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { int DoorbotScript::preResponse(uint id) { uint newId = 0; if (getDialRegion(0) != 1 && getRandomNumber(100) > 60) { - addResponse(11195); + addResponse(TRANSLATE(11195, 11207)); newId = 222193; } @@ -759,6 +810,15 @@ uint DoorbotScript::getDialsBitset() const { int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { int id2, id = 0; + if (g_language == Common::DE_DEU) { + if (val1 == 4010 || (val1 >= 4012 && val1 <= 4015)) { + return TTnpcScript::doSentenceEntry(val1, srcIdP, roomScript, sentence); + } + + if (val1 >= 4009 && val1 <= 4030) + val1 -= 4000; + } + switch (val1) { case 2: if (getValue(1) != 1) @@ -781,7 +841,8 @@ int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri return 1; break; case 9: - if (sentence->localWord("my") || sentence->contains("my")) + if (sentence->localWord("my") || sentence->contains("my") + || sentence->contains("mein")) return true; id2 = getRoomDialogueId1(roomScript); if (id2) { @@ -880,12 +941,20 @@ int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri CTrueTalkManager::triggerAction(29, 4); break; case 26: - if (!sentence->localWord("my") && !sentence->contains("my")) - return 1; + if (!sentence->localWord("my")) { + if (g_language == Common::EN_ANY && !sentence->contains("my")) + return 1; + if (g_language == Common::DE_DEU && !sentence->contains("mein")) + return 1; + } break; case 27: - if (!sentence->localWord("earth") && !sentence->contains("earth")) - return 1; + if (!sentence->localWord("earth")) { + if (g_language == Common::EN_ANY && !sentence->contains("earth")) + return 1; + if (g_language == Common::EN_ANY && !sentence->contains("erde")) + return 1; + } break; case 28: id2 = getRoomDialogueId2(roomScript); @@ -896,31 +965,36 @@ int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri } break; case 29: - if (sentence->localWord("another") || sentence->localWord("more") || - sentence->localWord("additional") || sentence->contains("another") || - sentence->contains("more") || sentence->contains("additional")) { + if (sentence->localWord("another") || sentence->localWord("more") + || sentence->localWord("additional") || sentence->contains("another") + || sentence->contains("more") || sentence->contains("additional") + || sentence->contains("noch ein") || sentence->contains("einen anderen") + || sentence->contains("ein anderes") || sentence->contains("eine andere") + || sentence->contains("zusaetzliche")) { addResponse(getDialogueId(220058)); applyResponse(); return 2; } break; case 30: - if (!sentence->localWord("because") && !sentence->contains("because")) + if (!sentence->localWord("because") && !sentence->contains("because") + && !(g_language == Common::DE_DEU && sentence->contains("well"))) return 1; break; - case 0x200: + + case 512: if (getValue(4) != 1) id = 221157; break; - case 0x201: + case 513: if (getValue(4) != 2) id = 221157; break; - case 0x202: + case 514: if (getValue(4) != 3) id = 221157; break; - case 0x203: + case 515: if (getValue(4) != 0) id = 221157; break; @@ -994,7 +1068,8 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { } int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { - for (const RoomDialogueId *r = ROOM_DIALOGUES1; r->_roomNum; ++r) { + const RoomDialogueId *r = TRANSLATE(ROOM_DIALOGUES1_EN, ROOM_DIALOGUES1_DE); + for (; r->_roomNum; ++r) { if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } @@ -1003,7 +1078,8 @@ int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { } int DoorbotScript::getRoomDialogueId2(const TTroomScript *roomScript) { - for (const RoomDialogueId *r = ROOM_DIALOGUES2; r->_roomNum; ++r) { + const RoomDialogueId *r = TRANSLATE(ROOM_DIALOGUES2_EN, ROOM_DIALOGUES2_DE); + for (; r->_roomNum; ++r) { if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 78ebcbfd68..536e9d42ca 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -58,6 +58,7 @@ private: public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); + virtual ~DoorbotScript(); /** * Chooses and adds a conversation response based on a specified tag Id. diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 5f0f6fbb66..757b640c76 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -24,13 +24,17 @@ #include "titanic/true_talk/liftbot_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { int LiftbotScript::_stateIndex; -static const int STATE_ARRAY[7] = { - 0x78BE, 0x78C0, 0x78C1, 0x78C2, 0x78C3, 0x78C4, 0x78C5 +static const int STATE_ARRAY_EN[7] = { + 30910, 30912, 30913, 30914, 30915, 30916, 30917 +}; +static const int STATE_ARRAY_DE[7] = { + 30919, 30921, 30922, 30923, 30924, 30925, 30926 }; LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, @@ -63,21 +67,22 @@ int LiftbotScript::chooseResponse(const TTroomScript *roomScript, const TTsenten case MKTAG('H', 'H', 'G', 'Q'): case MKTAG('A', 'N', 'S', 'W'): if (_stateIndex >= 7) { - selectResponse(30918); + selectResponse(TRANSLATE(30918, 30927)); setState(2); _stateIndex = 0; } else { - addResponse(STATE_ARRAY[_stateIndex++]); + addResponse(TRANSLATE(STATE_ARRAY_EN[_stateIndex++], + STATE_ARRAY_DE[_stateIndex++])); } applyResponse(); return 2; case MKTAG('O', 'R', 'D', '8'): - addResponse(30475); - addResponse(30467); - addResponse(30466); - addResponse(30474); + addResponse(TRANSLATE(30475, 30484)); + addResponse(TRANSLATE(30467, 30476)); + addResponse(TRANSLATE(30466, 30475)); + addResponse(TRANSLATE(30474, 30483)); applyResponse(); return SS_2; @@ -103,22 +108,22 @@ int LiftbotScript::process(const TTroomScript *roomScript, const TTsentence *sen switch (currState) { case 2: if (flag1) - return addDialogueAndState(30920, 3); + return addDialogueAndState(TRANSLATE(30920, 30929), 3); if (flag2) - return addDialogueAndState(30919, 1); + return addDialogueAndState(TRANSLATE(30919, 30928), 1); break; case 3: if (flag1) - return addDialogueAndState(30919, 1); + return addDialogueAndState(TRANSLATE(30919, 30928), 1); break; case 4: - return addDialogueAndState(210391, 1); + return addDialogueAndState(getDialogueId(210391), 1); case 5: if (sentence->contains("reborzo") || sentence->contains("is that")) - return addDialogueAndState(30515, 1); + return addDialogueAndState(TRANSLATE(30515, 30524), 1); break; case 6: @@ -184,7 +189,7 @@ ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, break; case 155: - selectResponse(30446); + selectResponse(TRANSLATE(30446, 30455)); applyResponse(); break; @@ -192,7 +197,7 @@ ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, if (getCurrentFloor() == 1) { addResponse(getDialogueId(210614)); } else { - selectResponse(30270); + selectResponse(TRANSLATE(30270, 30272)); } applyResponse(); break; @@ -201,7 +206,7 @@ ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, break; } - if (id >= 210000 && id <= 211001) { + if (id >= 210000 && id <= (uint)TRANSLATE(211001, 211003)) { addResponse(getDialogueId(id)); applyResponse(); } @@ -333,8 +338,13 @@ int LiftbotScript::updateState(uint oldId, uint newId, int index) { } int LiftbotScript::preResponse(uint id) { - if (id == 30565 || id == 30566 || id == 30567 || id == 30568 - || id == 30569 || id == 30570 || id == 30571) + if (id == (uint)TRANSLATE(30565, 30574) + || id == (uint)TRANSLATE(30566, 30575) + || id == (uint)TRANSLATE(30567, 30576) + || id == (uint)TRANSLATE(30568, 30577) + || id == (uint)TRANSLATE(30569, 30578) + || id == (uint)TRANSLATE(30570, 30579) + || id == (uint)TRANSLATE(30571, 30580)) return 210901; if (getDialRegion(0) == 0 && getRandomNumber(100) > 60) @@ -355,7 +365,6 @@ uint LiftbotScript::getDialsBitset() const { return bits; } - int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { // Responses for each floor when asked "what floor are we on" static const int FLOOR_RESPONSE_IDS[] = { @@ -374,7 +383,9 @@ int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri getState(); int stateVal; - switch (val1) { + int state = (g_language == Common::DE_DEU && val1 > 3000 && val1 < 3020) + ? val1 - 3000 : val1; + switch (state) { case 1: if (getValue(1) != 1) return 1; @@ -394,8 +405,9 @@ int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri if (sentence->localWord("big") || sentence->localWord("small")) { addResponse(getDialogueId(210215)); applyResponse(); - } else if (sentence->localWord("my") || sentence->contains("my") || - sentence->contains("bedroom") || sentence->contains("state")) { + } else if (sentence->localWord("my") || sentence->contains("my") + || sentence->contains("bedroom") || sentence->contains("state") + || sentence->contains("mein") || sentence->contains("schlafzimmer")) { addResponse1(CTrueTalkManager::getStateValue(4), true, 0); } else { selectResponse(210763); @@ -434,9 +446,11 @@ int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri case 14: // Which lift am I in stateVal = getState6(); - if (sentence->contains("elevator") || - (!sentence->contains("lift") && getRandomNumber(100) > 60)) - stateVal += 4; + if (g_language == Common::EN_ANY) { + if (sentence->contains("elevator") || + (!sentence->contains("lift") && getRandomNumber(100) > 60)) + stateVal += 4; + } selectResponse(LIFT_RESPONSE_IDS[stateVal]); applyResponse(); return 2; @@ -450,7 +464,9 @@ int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri applyResponse(); return 2; case 16: - if (sentence->contains("elevator") || sentence->contains("elavator")) + if (g_language == Common::DE_DEU) + addResponse(30589); + else if (sentence->contains("elevator") || sentence->contains("elavator")) addResponse(30579); else addResponse(30580); @@ -461,6 +477,7 @@ int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri return 1; break; default: + break; } @@ -510,11 +527,12 @@ int LiftbotScript::addResponse1(int index, bool flag, int id) { return 1; } else if (index == getCurrentFloor()) { if (index == 1) { - addResponse(30558 - (getRandomBit() ? 290 : 0)); + addResponse(TRANSLATE(30558 - (getRandomBit() ? 290 : 0), + 30567 - (getRandomBit() ? 297 : 0))); addResponse(getDialogueId(210589)); } else { if (index == 39) - addResponse(30346); + addResponse(TRANSLATE(30346, 30348)); addResponse(getDialogueId(210589)); } @@ -539,9 +557,10 @@ int LiftbotScript::addResponse1(int index, bool flag, int id) { if (flag) { if (index == 1) { - selectResponse(30558 - (getRandomBit() ? 290 : 0)); + selectResponse(TRANSLATE(30558 - (getRandomBit() ? 290 : 0), + 30567 - (getRandomBit() ? 297 : 0))); } else if (index == 39) { - addResponse(30346); + addResponse(TRANSLATE(30346, 30348)); } else { if (getRandomNumber(100) > 35 && index >= 2 && index <= 38) { addResponse(getDialogueId(DIALOGUE_IDS[index - 2])); @@ -638,7 +657,7 @@ int LiftbotScript::sentence1(const TTsentence *sentence) { diff = -100; } - if (sentence->localWord("lobby")) + if (g_language == Common::EN_ANY && sentence->localWord("lobby")) diff = (getValue(1) == 0 ? 1 : 0) - 99; if (sentence->localWord("bottomofwell") || sentence->contains("bottom")) diff = 39; @@ -656,22 +675,25 @@ int LiftbotScript::sentence1(const TTsentence *sentence) { } if (sentence->_category == 4 || sentence->localWord("find") - || sentence->contains("get to")) { + || sentence->contains("get to") + || sentence->contains("komme ich") + || sentence->contains("ich will zum") + || sentence->contains("ich will zur") + || sentence->contains("ich will ins") + || sentence->contains("ich will in")) { if (getCurrentFloor() != diff) { selectResponse(diff == 1 ? 210769 : 210764); - applyResponse(); } else if (!newId) { selectResponse(210764); - applyResponse(); - } else if (newId >= 210715 && newId <= 210719) { - selectResponse(newId); - applyResponse(); - } else { + } else if (newId > 210715 && newId <= 210719) { addResponse(getDialogueId(210720)); + selectResponse(getDialogueId(newId)); selectResponse(210715); - applyResponse(); + } else { + selectResponse(newId); } + applyResponse(); return 1; } diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 98a4b42e70..1033db29e0 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/maitred_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/translation.h" namespace Titanic { @@ -81,9 +82,10 @@ int MaitreDScript::process(const TTroomScript *roomScript, const TTsentence *sen stopFighting(false); _answerCtr = 0; - if (sentence->contains("restaurant at the end of the universe") + if (sentence->contains(TRANSLATE("restaurant at the end of the universe", + "restaurant am ende des universums")) || sentence->contains("milliway") - || sentence->contains("big bang burger bar")) { + || sentence->contains(TRANSLATE("big bang burger bar", "frittenbude"))) { addResponse(getDialogueId(260975)); applyResponse(); } else if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2) { @@ -111,7 +113,20 @@ int MaitreDScript::process(const TTroomScript *roomScript, const TTsentence *sen if (++_answerCtr > 50 || sentence->localWord("stop") || sentence->localWord("enough") || sentence->contains("i give up") || sentence->contains("i give in") - || sentence->contains("i surrender") || sentence->contains("i submit")) { + || sentence->contains("i surrender") || sentence->contains("i submit") + || sentence->contains("ich gebe auf") + || sentence->contains("ich ergebe mich") + || sentence->contains("ich kapituliere") + || sentence->contains("ich unterwerfe mich") + || sentence->contains("hoer auf") + || sentence->contains("lass") + || sentence->contains("schluss") + || sentence->contains("hoer sofort") + || sentence->contains("genug") + || sentence->contains("basta") + || sentence->contains("halt") + || sentence->contains("voll") + || sentence->contains("was soll")) { _answerCtr = 0; stopFighting(false); addResponse(getDialogueId(260063)); @@ -123,17 +138,22 @@ int MaitreDScript::process(const TTroomScript *roomScript, const TTsentence *sen addResponse(getDialogueId(260678)); } else if (sentence->contains("touche") || sentence->contains("toushe")) { addResponse(getDialogueId(260098)); - } else if (sentence->contains("have at you")) { + } else if (sentence->contains("have at you") || sentence->contains("ausfall")) { addResponse(getDialogueId(260047)); - } else if (sentence->contains("en garde") || sentence->contains("on guard")) { + } else if (sentence->contains("en garde") || sentence->contains("on guard") + || sentence->contains("attacke")) { addResponse(getDialogueId(260008)); + } else if (g_language == Common::DE_DEU && !sentence->contains("ich") + && (sentence->contains("surrender") || sentence->contains("gebe auf") + || sentence->contains("ergebe mich"))) { + addResponse(getDialogueId(260086)); } else if ((sentence->localWord("surrender") && !sentence->contains("i surrender")) || (sentence->contains("give up") && !sentence->contains("i give up")) || (sentence->contains("give in") && !sentence->contains("i give in")) || (sentence->contains("submit") && !sentence->contains("i submit"))) { addResponse(getDialogueId(260086)); } else { - addResponse(getDialogueId(260031)); + addResponse(getDialogueId(260131)); } applyResponse(); @@ -539,14 +559,14 @@ int MaitreDScript::updateState(uint oldId, uint newId, int index) { } if (!getValue(12)) { - static const uint FLAG_IDS[] = { + static const uint FIGHTING_IDS[] = { 260080, 260066, 260067, 260062, 260050, 260087, 260090, 260171, 260173, 260184, 260193, 260202, 260205, 260220, 260221, 260223, 260231, 260232, 260365, 260373, 260374, 260387, 260421, 260622, 260695, 0 }; - for (uint idx = 0; FLAG_IDS[idx]; ++idx) { - if (FLAG_IDS[idx] == newId) { + for (uint idx = 0; FIGHTING_IDS[idx]; ++idx) { + if (FIGHTING_IDS[idx] == newId) { startFighting(); break; } @@ -916,7 +936,7 @@ int MaitreDScript::preprocess(const TTroomScript *roomScript, const TTsentence * case 21: case 22: - if (sentence->contains("cooking") + if (sentence->contains(TRANSLATE("cooking", "kochen")) || (sentence->localWord("what") && sentence->localWord("mean"))) { addResponse(getDialogueId(260238)); applyFlag = true; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index f716a96130..0572cd4190 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -32,13 +32,13 @@ namespace Titanic { /*------------------------------------------------------------------------*/ -CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : +CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, VocabMode vocabMode) : _owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr) { g_vm->_scriptHandler = this; g_vm->_script = _script; - g_vm->_exeResources.reset(this, val1, val2); - _vocab = new TTvocab(val2); + g_vm->_exeResources.reset(this, val1, vocabMode); + _vocab = new TTvocab(vocabMode); } CScriptHandler::~CScriptHandler() { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index b8e62a586c..149532bd1b 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -50,7 +50,7 @@ public: TTconcept *_concept3P; TTconcept *_concept4P; public: - CScriptHandler(CTitleEngine *owner, int val1, int val2); + CScriptHandler(CTitleEngine *owner, int val1, VocabMode vocabMode); ~CScriptHandler(); /** diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 94875840b3..34ae772e1c 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/succubus_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -171,15 +172,28 @@ int SuccUBusScript::process(const TTroomScript *roomScript, const TTsentence *se } ScriptChangedResult SuccUBusScript::scriptChanged(const TTroomScript *roomScript, uint id) { - if (id == 148) - CTrueTalkManager::setFlags(3, 1); - else if (id == 150) - CTrueTalkManager::setFlags(2, 1); + if (g_language == Common::EN_ANY) { + if (id == 148) + CTrueTalkManager::setFlags(3, 1); + else if (id == 150) + CTrueTalkManager::setFlags(2, 1); + } else { + if (id == 70211 || id == 230013) { + addResponse(getDialogueId(230163)); + applyResponse(); + return SCR_2; + } else if (id < 70211) { + if (id == 148) + CTrueTalkManager::setFlags(3, 1); + else if (id == 150) + CTrueTalkManager::setFlags(2, 1); + } + } if (id >= 230000 && id <= 230245) { addResponse(getDialogueId(id)); applyResponse(); - } else if (id >= 70000 && id <= 70243) { + } else if (id >= 70000 && id <= (uint)TRANSLATE(70243, 70248)) { addResponse(id); applyResponse(); } diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 23327014d6..f11bf1df29 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -23,6 +23,7 @@ #include "titanic/true_talk/title_engine.h" #include "titanic/support/files_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" namespace Titanic { @@ -34,9 +35,9 @@ CTitleEngine::~CTitleEngine() { delete _scriptHandler; } -void CTitleEngine::setup(int val1, int val2) { +void CTitleEngine::setup(int val1, VocabMode vocabMode) { _script = new TTTitleScript(); - _scriptHandler = new CScriptHandler(this, val1, val2); + _scriptHandler = new CScriptHandler(this, val1, vocabMode); } /*------------------------------------------------------------------------*/ @@ -53,8 +54,8 @@ void STtitleEngine::reset() { _indexes.clear(); } -void STtitleEngine::setup(int val1, int val2) { - CTitleEngine::setup(val1, 3); +void STtitleEngine::setup(int val1, VocabMode vocabMode) { + CTitleEngine::setup(val1, TRANSLATE(VOCAB_MODE_EN, VOCAB_MODE_DE)); } int STtitleEngine::setResponse(TTscriptBase *script, TTresponse *response) { diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index ca7a5dcd14..d9b21af423 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -51,7 +51,7 @@ public: /** * Setup the engine */ - virtual void setup(int val1, int val2 = 0); + virtual void setup(int val1, VocabMode vocabMode = VOCAB_MODE_NONE); /** * Sets a conversation reponse @@ -80,7 +80,7 @@ public: /** * Setup the engine */ - virtual void setup(int val1, int val2 = 0); + virtual void setup(int val1, VocabMode vocabMode = VOCAB_MODE_NONE); /** * Sets a conversation reponse diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index e2e411559f..a7766e8d18 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -48,7 +48,7 @@ CTrueTalkNPC *CTrueTalkManager::_currentNPC; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { - _titleEngine.setup(3, 3); + _titleEngine.setup(3, VOCAB_MODE_EN); _quotes.load(); _quotesTree.load(); @@ -487,6 +487,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV // Setup proximities CProximity p1, p2, p3; if (isParrot) { + p1._soundType = Audio::Mixer::kSFXSoundType; p1._channelMode = 3; p2._channelMode = 5; p3._channelMode = 4; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 2140f45203..c9d1beb353 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -29,6 +29,7 @@ #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" +#include "titanic/translation.h" #include "common/algorithm.h" #include "common/textconsole.h" @@ -402,7 +403,135 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { } int TTnpcScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { - return 0; + if (g_language != Common::DE_DEU || !roomScript) + return 0; + + switch (val1) { + case 516: + return getValue(1) == 1 ? 0 : 1; + case 517: + return getValue(1) == 2 ? 0 : 1; + case 518: + return getValue(1) == 3 ? 0 : 1; + case 519: + return getValue(1) != 1 ? 0 : 1; + case 520: + return getValue(1) != 2 ? 0 : 1; + case 521: + return getValue(1) != 3 ? 0 : 1; + + case 522: + return roomScript->_scriptId == 101 ? 0 : 1; + case 523: + return roomScript->_scriptId == 106 ? 0 : 1; + case 524: + return roomScript->_scriptId == 107 ? 0 : 1; + case 525: + return roomScript->_scriptId == 108 ? 0 : 1; + case 526: + return roomScript->_scriptId == 109 ? 0 : 1; + case 527: + return roomScript->_scriptId == 110 ? 0 : 1; + case 528: + return roomScript->_scriptId == 111 ? 0 : 1; + case 529: + return roomScript->_scriptId == 112 ? 0 : 1; + case 530: + return roomScript->_scriptId == 113 ? 0 : 1; + case 531: + return roomScript->_scriptId == 114 ? 0 : 1; + case 532: + return roomScript->_scriptId == 115 ? 0 : 1; + case 533: + return roomScript->_scriptId == 116 ? 0 : 1; + case 534: + return roomScript->_scriptId == 117 ? 0 : 1; + case 535: + return roomScript->_scriptId == 118 ? 0 : 1; + case 536: + return roomScript->_scriptId == 120 ? 0 : 1; + case 537: + return roomScript->_scriptId == 121 ? 0 : 1; + case 538: + return roomScript->_scriptId == 122 ? 0 : 1; + case 539: + return roomScript->_scriptId == 123 ? 0 : 1; + case 540: + return roomScript->_scriptId == 124 ? 0 : 1; + case 541: + return roomScript->_scriptId == 125 ? 0 : 1; + case 542: + return roomScript->_scriptId == 126 ? 0 : 1; + case 543: + return roomScript->_scriptId == 127 ? 0 : 1; + case 544: + return roomScript->_scriptId == 128 ? 0 : 1; + case 545: + return roomScript->_scriptId == 129 ? 0 : 1; + case 546: + return roomScript->_scriptId == 130 ? 0 : 1; + case 547: + return roomScript->_scriptId == 131 ? 0 : 1; + case 548: + return roomScript->_scriptId == 132 ? 0 : 1; + + case 549: + return roomScript->_scriptId != 101 ? 0 : 1; + case 550: + return roomScript->_scriptId != 106 ? 0 : 1; + case 551: + return roomScript->_scriptId != 107 ? 0 : 1; + case 552: + return roomScript->_scriptId != 108 ? 0 : 1; + case 553: + return roomScript->_scriptId != 109 ? 0 : 1; + case 554: + return roomScript->_scriptId != 110 ? 0 : 1; + case 555: + return roomScript->_scriptId != 111 ? 0 : 1; + case 556: + return roomScript->_scriptId != 112 ? 0 : 1; + case 557: + return roomScript->_scriptId != 113 ? 0 : 1; + case 558: + return roomScript->_scriptId != 114 ? 0 : 1; + case 559: + return roomScript->_scriptId != 115 ? 0 : 1; + case 560: + return roomScript->_scriptId != 116 ? 0 : 1; + case 561: + return roomScript->_scriptId != 117 ? 0 : 1; + case 562: + return roomScript->_scriptId != 118 ? 0 : 1; + case 563: + return roomScript->_scriptId != 120 ? 0 : 1; + case 564: + return roomScript->_scriptId != 121 ? 0 : 1; + case 565: + return roomScript->_scriptId != 122 ? 0 : 1; + case 566: + return roomScript->_scriptId != 123 ? 0 : 1; + case 567: + return roomScript->_scriptId != 124 ? 0 : 1; + case 568: + return roomScript->_scriptId != 125 ? 0 : 1; + case 569: + return roomScript->_scriptId != 126 ? 0 : 1; + case 570: + return roomScript->_scriptId != 127 ? 0 : 1; + case 571: + return roomScript->_scriptId != 128 ? 0 : 1; + case 572: + return roomScript->_scriptId != 129 ? 0 : 1; + case 573: + return roomScript->_scriptId != 130 ? 0 : 1; + case 574: + return roomScript->_scriptId != 131 ? 0 : 1; + case 575: + return roomScript->_scriptId != 132 ? 0 : 1; + default: + return 0; + } } void TTnpcScript::save(SimpleFile *file) { diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 49f233888b..3481587b8d 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -401,7 +401,7 @@ int TTparser::replaceNumbers(TTstring &line, int startIndex) { return index; bool flag1 = false, flag2 = false, flag3 = false; - int total = 0, factor = 0, endIndex = index; + int total = 0, factor = 0, endIndex; do { if (!(numEntry->_flags & NF_1)) { diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index b1f18771fe..bda6e672bd 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -30,6 +30,7 @@ #include "titanic/true_talk/maitred_script.h" #include "titanic/true_talk/parrot_script.h" #include "titanic/true_talk/succubus_script.h" +#include "titanic/translation.h" namespace Titanic { @@ -63,14 +64,14 @@ TTscripts::TTscripts() { addScript(new TTroomScript(scriptNum)); // Load npc scripts - addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0), 100); + addScript(new BarbotScript(100, "Barbot", 0, "Fortillian", 9, 1, -1, -1, -1, 0), 112); addScript(new BellbotScript(101, "Bellbot", 0, "Krage", 8, 1), 110); - addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0), 103); addScript(new DeskbotScript(103, "DeskBot", 0, "Marsinta", 11, 2), 110); - addScript(new BarbotScript(100, "Barbot", 0, "Fortillian", 9, 1, -1, -1, -1, 0), 112); + addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0), 100); + addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0), 103); addScript(new ParrotScript(107, "Parrot", 0, "The Parrot", 5, 1, -1, -1, -1, 0), 111); - addScript(new MaitreDScript(112, "MaitreDBot", 0, "Dastrogaaar", 8, 1), 132); addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0), 110); + addScript(new MaitreDScript(112, "MaitreDBot", 0, "Dastrogaaar", 8, 1), 132); } void TTscripts::addScript(TTnpcScript *script, int scriptId) { diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 5a5bff7af8..b20f760f48 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -317,7 +317,7 @@ bool TTsentence::localWord(const char *str) const { foundMatch = true; } - int val = g_vm->_exeResources.get18(); + VocabMode mode = g_vm->_exeResources.getVocabMode(); bool result = false; for (TTsentenceNode *nodeP = _nodesP; nodeP && !result; @@ -327,9 +327,9 @@ bool TTsentence::localWord(const char *str) const { continue; const TTstring wordStr = nodeP->_wordP->_text; - if (val == 3 && wordStr == str) { + if (mode == VOCAB_MODE_EN && wordStr == str) { result = true; - } else if (nodeP->_wordP->findSynByName(str, &syn, val)) { + } else if (nodeP->_wordP->findSynByName(str, &syn, mode)) { result = true; } else if (foundMatch) { result = wordStr == "it" || wordStr == "that" || wordStr == "he" diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 43910fc823..d7e4e86348 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -55,6 +55,10 @@ TTstring::~TTstring() { } void TTstring::operator=(const TTstring &str) { + if (&str == this) + // Trying to assign string to itself + return; + // Delete old string reference, if any if (_data && --_data->_referenceCount == 0) delete _data; diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index 60c506e8cd..16860cc93f 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -55,9 +55,9 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } -TTstringNode *TTstringNode::findByName(const TTstring &str, int mode) { +TTstringNode *TTstringNode::findByName(const TTstring &str, VocabMode mode) { for (TTstringNode *nodeP = this; nodeP; nodeP = dynamic_cast<TTstringNode *>(nodeP->_nextP)) { - if (nodeP->_mode == mode || (mode == 3 && nodeP->_mode < 3)) { + if (nodeP->_mode == mode || (mode == VOCAB_MODE_EN && nodeP->_mode < 3)) { if (nodeP->_string == str) return nodeP; } diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index ced162b439..ee17cf1d38 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -51,7 +51,7 @@ public: /** * Find a string node in the linked chain by name */ - TTstringNode *findByName(const TTstring &str, int mode); + TTstringNode *findByName(const TTstring &str, VocabMode mode); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 20df6bd4bb..861d8f89a0 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -28,12 +28,13 @@ #include "titanic/true_talk/tt_picture.h"
#include "titanic/true_talk/tt_pronoun.h"
#include "titanic/titanic.h"
+#include "titanic/translation.h"
#include "common/file.h"
namespace Titanic {
-TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr),
- _word(nullptr), _vocabMode(val) {
+TTvocab::TTvocab(VocabMode vocabMode): _headP(nullptr), _tailP(nullptr),
+ _word(nullptr), _vocabMode(vocabMode) {
load("STVOCAB");
}
@@ -131,7 +132,8 @@ int TTvocab::load(const CString &name) { }
void TTvocab::addWord(TTword *word) {
- TTword *existingWord = findWord(word->_text);
+ TTword *existingWord = g_language == Common::DE_DEU ? nullptr :
+ findWord(word->_text);
if (existingWord) {
if (word->_synP) {
@@ -160,7 +162,7 @@ TTword *TTvocab::findWord(const TTstring &str) { TTword *word = _headP;
while (word && !flag) {
- if (_vocabMode != 3 || strcmp(word->c_str(), str)) {
+ if (_vocabMode != VOCAB_MODE_EN || strcmp(word->c_str(), str)) {
if (word->findSynByName(str, tempNode, _vocabMode))
flag = true;
else
@@ -203,7 +205,7 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { } else {
// Standard word
for (vocabP = _headP; vocabP; vocabP = vocabP->_nextP) {
- if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) {
+ if (_vocabMode == VOCAB_MODE_EN && !strcmp(str.c_str(), vocabP->c_str())) {
newWord = vocabP->copy();
newWord->_nextP = nullptr;
newWord->setSyn(nullptr);
diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 614d1bbf02..7e5cc29bc5 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -23,6 +23,7 @@ #ifndef TITANIC_ST_VOCAB_H #define TITANIC_ST_VOCAB_H +#include "titanic/support/exe_resources.h" #include "titanic/support/string.h" #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/tt_word.h" @@ -34,7 +35,7 @@ private: TTword *_headP; TTword *_tailP; TTword *_word; - int _vocabMode; + VocabMode _vocabMode; private: /** * Load the vocab data @@ -77,7 +78,7 @@ private: */ TTword *getPrefixedWord(TTstring &str) const; public: - TTvocab(int val); + TTvocab(VocabMode vocabMode); ~TTvocab(); /** diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 5ed3e5755f..c05b61e48c 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -163,14 +163,14 @@ uint TTword::readNumber(const char *str) { } bool TTword::testFileHandle(FileHandle file) const { - if (g_vm->_exeResources.is18Equals(3)) + if (g_vm->_exeResources.isVocabMode(VOCAB_MODE_EN)) return true; // TODO: Figure out why original compares passed file handle against specific values return true; } -bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const { +bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, VocabMode mode) const { if (!_synP) return false; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 7a42614f43..207c1c155b 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TT_WORD_H #define TITANIC_TT_WORD_H +#include "titanic/support/exe_resources.h" #include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/tt_synonym.h" @@ -102,9 +103,10 @@ public: * Finds a synonym in the word by name, if one exists * @param str Name to search for * @param dest Destination synonym instance to copy match into + * @param mode Specifies English or German vocab mode * @returns Returns true if a match was found */ - bool findSynByName(const TTstring &str, TTsynonym *dest, int mode) const; + bool findSynByName(const TTstring &str, TTsynonym *dest, VocabMode mode) const; const char *c_str() const { return _text.c_str(); } operator const char *() const { return c_str(); } |