diff options
author | Paul Gilbert | 2016-04-28 21:34:22 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:22:38 -0400 |
commit | 23f5691b97cb53fd45ef411f051b7f10f0523a24 (patch) | |
tree | cee825c0c3bc4af78b22ea691897feb7f4495930 | |
parent | 4fd482e41813f32359eb91a2b62867605af0382c (diff) | |
download | scummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.tar.gz scummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.tar.bz2 scummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.zip |
TITANIC: Implement summoning NPCs
-rw-r--r-- | engines/titanic/core/tree_item.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 6 | ||||
-rw-r--r-- | engines/titanic/game/television.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game_state.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/game_state.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 5 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_slider.cpp | 7 |
11 files changed, 45 insertions, 20 deletions
diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 039d597ece..8dd3da054d 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -314,9 +314,9 @@ CMusicRoom *CTreeItem::getMusicRoom() const { return gameManager ? &gameManager->_musicRoom : nullptr; } -int CTreeItem::getState8() const { +int CTreeItem::getPassengerClass() const { CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->_gameState._field8 : 3; + return gameManager ? gameManager->_gameState._passengerClass : 3; } int CTreeItem::getStateC() const { diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 151addee2e..1dcaee552d 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -279,7 +279,11 @@ public: */ CMusicRoom *getMusicRoom() const; - int getState8() const; + /** + * Return the player's passenger class + */ + int getPassengerClass() const; + int getStateC() const; }; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 6e1f5ca54c..888400960d 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -234,7 +234,7 @@ bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { parrotMsg.execute("PerchedParrot"); } - if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getState8()) { + if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getPassengerClass()) { playSound("z#47.wav", 100, 0, 0); _fieldF0 = playSound("b#20.wav", 100, 0, 0); CTreeItem *magazine = getRoot()->findByName("Magazine"); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 7c59aaf5c1..2c751c0aa1 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -45,14 +45,14 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), - _field1C(0), _quitGame(false), _field24(0), _nodeChangeCtr(0), - _nodeEnterTicks(0), _field38(0) { + _passengerClass(0), _fieldC(0), _mode(GSMODE_UNSELECTED), + _field14(0), _petActive(false), _field1C(0), _quitGame(false), + _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } void CGameState::save(SimpleFile *file) const { file->writeNumber(_petActive); - file->writeNumber(_field8); + file->writeNumber(_passengerClass); file->writeNumber(_fieldC); file->writeNumber(_field14); file->writeNumber(_field24); @@ -63,7 +63,7 @@ void CGameState::save(SimpleFile *file) const { void CGameState::load(SimpleFile *file) { _petActive = file->readNumber() != 0; - _field8 = file->readNumber(); + _passengerClass = file->readNumber(); _fieldC = file->readNumber(); _field14 = file->readNumber(); _field24 = file->readNumber(); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 1176b2f6f2..ff39dc6752 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -54,7 +54,7 @@ public: CGameManager *_gameManager; CGameLocation _gameLocation; CGameStateMovieList _movieList; - int _field8; + int _passengerClass; int _fieldC; GameStateMode _mode; int _field14; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e9a8e79b8b..89ea9e956a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -475,5 +475,16 @@ bool CPetControl::isNPCInView(const CString &name) const { return false; } +void CPetControl::summonNPC(const CString &name, int val) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CRoomItem *room = gameManager->getRoom(); + + if (room) { + CSummonBotMsg summonMsg(name, val); + summonMsg.execute(room); + } + } +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4cde477704..bd896575ce 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -262,6 +262,11 @@ public: * Check whether an NPC can be summoned */ int canSummonNPC(const CString &name); + + /** + * Summon an NPC to the player + */ + void summonNPC(const CString &name, int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 1012403727..3872d840fd 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -163,7 +163,13 @@ int CPetConversations::canSummonNPC(const CString &name) { } void CPetConversations::summonNPC(const CString &name) { - warning("TODO: summonNPC"); + if (_petControl) { + if (_petControl->getPassengerClass() >= 4) { + _petControl->displayMessage("Sorry, you must be at least 3rd class before you can summon for help."); + } else { + _petControl->summonNPC(name, 0); + } + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index fbe9e6db53..491930f46f 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -49,11 +49,11 @@ void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElem return; CString numString(3); - int state8 = petControl->getState8(); + int classNum = petControl->getPassengerClass(); - if (state8 >= 1 && state8 <= 3) { - numString = CString(state8); - } else if (state8 == 4) { + if (classNum >= 1 && classNum <= 3) { + numString = CString(classNum); + } else if (classNum == 4) { int stateC = petControl->getStateC(); if (stateC == 1) numString = CString(stateC); diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index a41118bf76..afdbc9fdd8 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -69,7 +69,7 @@ uint CPetSection::getColor(uint index) { const uint *CPetSection::getColorTable(int tableNum) { if (tableNum == -1) { CPetControl *pet = getPetControl(); - tableNum = pet ? pet->getState8() : 3; + tableNum = pet ? pet->getPassengerClass() : 3; } switch (tableNum) { diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index e8f31a70d2..82b02af3fb 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -198,7 +198,7 @@ void CPetSoundSlider::setupThumb(const CString &name, CPetControl *petControl) { void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petControl) { if (petControl) { CString numStr = "3"; - int mode = petControl->getState8(); + int mode = petControl->getPassengerClass(); if (mode <= 3) { numStr = CString(mode); } else if (mode == 4) { @@ -216,11 +216,10 @@ void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petCont void CPetSoundSlider::setupThumb2(const CString &name, CPetControl *petControl) { if (petControl) { CString numStr = "3"; - int mode = petControl->getState8(); + int mode = petControl->getPassengerClass(); if (mode <= 3) { numStr = CString(mode); - } - else if (mode == 4) { + } else if (mode == 4) { mode = petControl->getStateC(); if (mode == 1) { numStr = CString(mode); |