aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-25 16:41:31 -0400
committerPaul Gilbert2016-07-15 19:24:56 -0400
commit4ed93ca8f175d7a43c6a0de72ad02b42827938b7 (patch)
tree448c2cd5021192692041c967fc6571b29cd56f7f /engines/titanic
parent42c8ac1c880076c181071922aff3b923a185af98 (diff)
downloadscummvm-rg350-4ed93ca8f175d7a43c6a0de72ad02b42827938b7.tar.gz
scummvm-rg350-4ed93ca8f175d7a43c6a0de72ad02b42827938b7.tar.bz2
scummvm-rg350-4ed93ca8f175d7a43c6a0de72ad02b42827938b7.zip
TITANIC: Cleanup of PET section classes methods to match original
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp12
-rw-r--r--engines/titanic/pet_control/pet_conversations.h10
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp4
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp5
-rw-r--r--engines/titanic/pet_control/pet_rooms.h2
-rw-r--r--engines/titanic/pet_control/pet_section.cpp35
-rw-r--r--engines/titanic/pet_control/pet_section.h32
7 files changed, 60 insertions, 40 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 4ec6e8996d..276b99e610 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -506,13 +506,6 @@ void CPetConversations::textLineEntered(const CString &textLine) {
scrollToBottom();
}
-CString CPetConversations::getActiveNPCName() const {
- if (_petControl && _petControl->_activeNPC)
- return _petControl->_activeNPC->getName();
- else
- return CString();
-}
-
void CPetConversations::setActiveNPC(const CString &name) {
_npcName = name;
_field418 = 1;
@@ -520,11 +513,6 @@ void CPetConversations::setActiveNPC(const CString &name) {
startNPCTimer();
}
-void CPetConversations::copyColors(uint tableNum, uint colors[5]) {
- const uint *src = getColorTable(tableNum);
- Common::copy(src, src + 5, colors);
-}
-
void CPetConversations::updateDial(uint dialNum, const CString &npcName) {
TTnpcScript *script = getNPCScript(npcName);
uint newLevel = getDialLevel(dialNum, script);
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 9af1f14ee7..4deab3eb5f 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -125,21 +125,11 @@ private:
void textLineEntered(const CString &textLine);
/**
- * Returns the name of the currently active NPC, if any
- */
- CString getActiveNPCName() const;
-
- /**
* Set the active NPC
*/
void setActiveNPC(const CString &name);
/**
- * Create a color table
- */
- void copyColors(uint tableNum, uint colors[5]);
-
- /**
* Updates one of the dials with data from a given NPC
*/
void updateDial(uint dialNum, const CString &npcName);
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index eca6f309ad..c36bae6545 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -45,7 +45,7 @@ void CPetGlyph::updateTooltip() {
getTooltip(petText);
if (_owner)
- getPetSection()->proc29();
+ getPetSection()->stopTextTimer();
}
}
@@ -214,7 +214,7 @@ void CPetGlyphs::changeHighlight(int index) {
glyph->updateTooltip();
}
} else if (_owner) {
- _owner->proc28();
+ _owner->removeText();
}
}
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index 467c645e0e..fb7cb2bad8 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -276,11 +276,6 @@ uint CPetRooms::getRoomFlags() const {
return roomFlags.get();
}
-void CPetRooms::areaChanged(PetArea area) {
- if (_petControl && _petControl->_currentArea == area)
- _petControl->makeDirty();
-}
-
void CPetRooms::reassignRoom(int passClassNum) {
CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom();
if (glyph)
diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h
index 14dbf8f26f..64fd0168bc 100644
--- a/engines/titanic/pet_control/pet_rooms.h
+++ b/engines/titanic/pet_control/pet_rooms.h
@@ -60,8 +60,6 @@ private:
*/
Point getGlyphPos() const { return Point(509, 388); }
- void areaChanged(PetArea area);
-
/**
* Adds a glyph to the list
*/
diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp
index 116fd94ddb..a29a8f8115 100644
--- a/engines/titanic/pet_control/pet_section.cpp
+++ b/engines/titanic/pet_control/pet_section.cpp
@@ -39,30 +39,36 @@ static const uint PALETTE3[5] = {
};
void CPetSection::displayMessage(const CString &msg) {
- error("TODO");
+ CPetText *text = getText();
+
+ if (text) {
+ text->setColor(getColor(1));
+ _petControl->makeDirty();
+ removeText(5000);
+ }
}
void CPetSection::proc25(int val) {
if (!val) {
- proc28();
+ removeText();
_petControl->makeDirty();
}
}
-void CPetSection::proc27(int duration) {
+void CPetSection::removeText(int duration) {
if (duration > 0)
_petControl->startPetTimer(0, duration, 0, this);
else
- proc28();
+ removeText();
}
-void CPetSection::proc28() {
+void CPetSection::removeText() {
CPetText *text = getText();
if (text)
text->setup();
}
-void CPetSection::proc29() {
+void CPetSection::stopTextTimer() {
_petControl->stopPetTimer(0);
}
@@ -83,4 +89,21 @@ const uint *CPetSection::getColorTable(int tableNum) {
}
}
+void CPetSection::areaChanged(PetArea area) {
+ if (_petControl && _petControl->_currentArea == area)
+ _petControl->makeDirty();
+}
+
+CString CPetSection::getActiveNPCName() const {
+ if (_petControl && _petControl->_activeNPC)
+ return _petControl->_activeNPC->getName();
+ else
+ return CString();
+}
+
+void CPetSection::copyColors(uint tableNum, uint colors[5]) {
+ const uint *src = getColorTable(tableNum);
+ Common::copy(src, src + 5, colors);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index cf729b70a4..5ae86b785c 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -52,6 +52,21 @@ struct CPetSectionSubData {
class CPetSection {
public:
CPetControl *_petControl;
+protected:
+ /**
+ * Called when the current area is changed
+ */
+ void areaChanged(PetArea area);
+
+ /**
+ * Returns the name of the currently active NPC, if any
+ */
+ CString getActiveNPCName() const;
+
+ /**
+ * Create a color table
+ */
+ void copyColors(uint tableNum, uint colors[5]);
public:
CPetSection() : _petControl(nullptr) {}
virtual ~CPetSection() {}
@@ -153,9 +168,20 @@ public:
*/
virtual CPetText *getText() { return nullptr; }
- virtual void proc27(int duration);
- virtual void proc28();
- virtual void proc29();
+ /**
+ * Removes text after a given duration
+ */
+ virtual void removeText(int duration);
+
+ /**
+ * Removes text after a given duration
+ */
+ virtual void removeText();
+
+ /**
+ * Stops the text removal timer
+ */
+ virtual void stopTextTimer();
/**
* Get an element from the section by a designated Id