aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-28 21:34:22 -0400
committerPaul Gilbert2016-07-10 16:22:38 -0400
commit23f5691b97cb53fd45ef411f051b7f10f0523a24 (patch)
treecee825c0c3bc4af78b22ea691897feb7f4495930 /engines/titanic/pet_control
parent4fd482e41813f32359eb91a2b62867605af0382c (diff)
downloadscummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.tar.gz
scummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.tar.bz2
scummvm-rg350-23f5691b97cb53fd45ef411f051b7f10f0523a24.zip
TITANIC: Implement summoning NPCs
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_control.cpp11
-rw-r--r--engines/titanic/pet_control/pet_control.h5
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp8
-rw-r--r--engines/titanic/pet_control/pet_gfx_element.cpp8
-rw-r--r--engines/titanic/pet_control/pet_section.cpp2
-rw-r--r--engines/titanic/pet_control/pet_slider.cpp7
6 files changed, 31 insertions, 10 deletions
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);