aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-29 19:34:36 -0400
committerPaul Gilbert2016-07-10 16:37:33 -0400
commitd6b84cd9e16ac584c5b57b1b94e1d071c30060ce (patch)
tree474b8e0fa9005d9a943ef75eced58fe1c802c6d5 /engines/titanic/pet_control
parent6ec129d188a2b5b86dba6540b38a959bbf8b2491 (diff)
downloadscummvm-rg350-d6b84cd9e16ac584c5b57b1b94e1d071c30060ce.tar.gz
scummvm-rg350-d6b84cd9e16ac584c5b57b1b94e1d071c30060ce.tar.bz2
scummvm-rg350-d6b84cd9e16ac584c5b57b1b94e1d071c30060ce.zip
TITANIC: Added PET Conversations leave and Text Cursor hide
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp12
-rw-r--r--engines/titanic/pet_control/pet_conversations.h9
-rw-r--r--engines/titanic/pet_control/pet_text.cpp8
-rw-r--r--engines/titanic/pet_control/pet_text.h5
4 files changed, 29 insertions, 5 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 960b325bc0..7596e65961 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -126,13 +126,15 @@ void CPetConversations::save(SimpleFile *file, int indent) const {
void CPetConversations::enter(PetArea oldArea) {
if (_petControl && _petControl->_activeNPC)
// Start a timer for the NPC
- addNPCTimer();
+ startNPCTimer();
+ // Show the text cursor
_textInput.showCursor(-2);
}
void CPetConversations::leave() {
-
+ _textInput.hideCursor();
+ stopNPCTimer();
}
bool CPetConversations::setupControl(CPetControl *petControl) {
@@ -233,10 +235,14 @@ void CPetConversations::summonNPC(const CString &name) {
}
}
-void CPetConversations::addNPCTimer() {
+void CPetConversations::startNPCTimer() {
_petControl->startPetTimer(1, 1000, 1000, this);
}
+void CPetConversations::stopNPCTimer() {
+ _petControl->stopPetTimer(1);
+}
+
bool CPetConversations::handleKey(const Common::KeyState &keyState) {
switch (keyState.keycode) {
case Common::KEYCODE_UP:
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index ca85e14583..c7fb207615 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -97,9 +97,14 @@ private:
void summonNPC(const CString &name);
/**
- * Adds an NPC timer
+ * Starts the NPC timer
*/
- void addNPCTimer();
+ void startNPCTimer();
+
+ /**
+ * Stops the NPC timer
+ */
+ void stopNPCTimer();
/**
* Handle a keypress
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 7e5f329632..6f870faa32 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -402,4 +402,12 @@ void CPetText::showCursor(int mode) {
}
}
+void CPetText::hideCursor() {
+ if (_textCursor) {
+ _textCursor->setMode(-1);
+ _textCursor->hide();
+ _textCursor = nullptr;
+ }
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index 2b68b743c2..9b914dcbc1 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -236,6 +236,11 @@ public:
* and give it suitable defaults
*/
void showCursor(int mode);
+
+ /**
+ * Removes the cursor attached to the text
+ */
+ void hideCursor();
};
} // End of namespace Titanic